ALASKERNEL-5.15-2024-041

Related Vulnerabilities: CVE-2023-52447  

In the Linux kernel, the following vulnerability has been resolved: bpf: Defer the free of inner map when necessary When updating or deleting an inner map in map array or map htab, the mapmay still be accessed by non-sleepable program or sleepable program.However bpf_map_fd_put_ptr() decreases the ref-counter of the inner mapdirectly through bpf_map_put(), if the ref-counter is the last one(which is true for most cases), the inner map will be freed byops->map_free() in a kworker. But for now, most .map_free() callbacksdon't use synchronize_rcu() or its variants to wait for the elapse of aRCU grace period, so after the invocation of ops->map_free completes,the bpf program which is accessing the inner map may incuruse-after-free problem. Fix the free of inner map by invoking bpf_map_free_deferred() after bothone RCU grace period and one tasks trace RCU grace period if the innermap has been removed from the outer map before. The deferment isaccomplished by using call_rcu() or call_rcu_tasks_trace() whenreleasing the last ref-counter of bpf map. The newly-added rcu_headfield in bpf_map shares the same storage space with work field toreduce the size of bpf_map. (CVE-2023-52447)

ALASKERNEL-5.15-2024-041


Amazon Linux 2 Security Advisory: ALASKERNEL-5.15-2024-041
Advisory Release Date: 2024-04-10 22:27 Pacific
Advisory Updated Date: 2024-04-15 12:00 Pacific
Severity: Medium

Issue Overview:

In the Linux kernel, the following vulnerability has been resolved:

bpf: Defer the free of inner map when necessary

When updating or deleting an inner map in map array or map htab, the map
may still be accessed by non-sleepable program or sleepable program.
However bpf_map_fd_put_ptr() decreases the ref-counter of the inner map
directly through bpf_map_put(), if the ref-counter is the last one
(which is true for most cases), the inner map will be freed by
ops->map_free() in a kworker. But for now, most .map_free() callbacks
don't use synchronize_rcu() or its variants to wait for the elapse of a
RCU grace period, so after the invocation of ops->map_free completes,
the bpf program which is accessing the inner map may incur
use-after-free problem.

Fix the free of inner map by invoking bpf_map_free_deferred() after both
one RCU grace period and one tasks trace RCU grace period if the inner
map has been removed from the outer map before. The deferment is
accomplished by using call_rcu() or call_rcu_tasks_trace() when
releasing the last ref-counter of bpf map. The newly-added rcu_head
field in bpf_map shares the same storage space with work field to
reduce the size of bpf_map. (CVE-2023-52447)


Affected Packages:

kernel


Note:

This advisory is applicable to Amazon Linux 2 - Kernel-5.15 Extra. Visit this page to learn more about Amazon Linux 2 (AL2) Extras and this FAQ section for the difference between AL2 Core and AL2 Extras advisories.


Issue Correction:
Run yum update kernel to update your system.

New Packages:
aarch64:
    kernel-5.15.153-100.162.amzn2.aarch64
    kernel-headers-5.15.153-100.162.amzn2.aarch64
    kernel-debuginfo-common-aarch64-5.15.153-100.162.amzn2.aarch64
    perf-5.15.153-100.162.amzn2.aarch64
    perf-debuginfo-5.15.153-100.162.amzn2.aarch64
    python-perf-5.15.153-100.162.amzn2.aarch64
    python-perf-debuginfo-5.15.153-100.162.amzn2.aarch64
    kernel-tools-5.15.153-100.162.amzn2.aarch64
    kernel-tools-devel-5.15.153-100.162.amzn2.aarch64
    kernel-tools-debuginfo-5.15.153-100.162.amzn2.aarch64
    bpftool-5.15.153-100.162.amzn2.aarch64
    bpftool-debuginfo-5.15.153-100.162.amzn2.aarch64
    kernel-devel-5.15.153-100.162.amzn2.aarch64
    kernel-debuginfo-5.15.153-100.162.amzn2.aarch64
    kernel-livepatch-5.15.153-100.162-1.0-0.amzn2.aarch64

i686:
    kernel-headers-5.15.153-100.162.amzn2.i686

src:
    kernel-5.15.153-100.162.amzn2.src

x86_64:
    kernel-5.15.153-100.162.amzn2.x86_64
    kernel-headers-5.15.153-100.162.amzn2.x86_64
    kernel-debuginfo-common-x86_64-5.15.153-100.162.amzn2.x86_64
    perf-5.15.153-100.162.amzn2.x86_64
    perf-debuginfo-5.15.153-100.162.amzn2.x86_64
    python-perf-5.15.153-100.162.amzn2.x86_64
    python-perf-debuginfo-5.15.153-100.162.amzn2.x86_64
    kernel-tools-5.15.153-100.162.amzn2.x86_64
    kernel-tools-devel-5.15.153-100.162.amzn2.x86_64
    kernel-tools-debuginfo-5.15.153-100.162.amzn2.x86_64
    bpftool-5.15.153-100.162.amzn2.x86_64
    bpftool-debuginfo-5.15.153-100.162.amzn2.x86_64
    kernel-devel-5.15.153-100.162.amzn2.x86_64
    kernel-debuginfo-5.15.153-100.162.amzn2.x86_64
    kernel-livepatch-5.15.153-100.162-1.0-0.amzn2.x86_64