vulnerability

Ubuntu: (Multiple Advisories) (CVE-2024-45025): Linux kernel vulnerabilities

Severity
5
CVSS
(AV:L/AC:L/Au:S/C:N/I:N/A:C)
Published
Sep 11, 2024
Added
Nov 4, 2024
Modified
Aug 18, 2025

Description

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

fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE

copy_fd_bitmaps(new, old, count) is expected to copy the first
count/BITS_PER_LONG bits from old->full_fds_bits[] and fill
the rest with zeroes. What it does is copying enough words
(BITS_TO_LONGS(count/BITS_PER_LONG)), then memsets the rest.
That works fine, *if* all bits past the cutoff point are
clear. Otherwise we are risking garbage from the last word
we'd copied.

For most of the callers that is true - expand_fdtable() has
count equal to old->max_fds, so there's no open descriptors
past count, let alone fully occupied words in ->open_fds[],
which is what bits in ->full_fds_bits[] correspond to.

The other caller (dup_fd()) passes sane_fdtable_size(old_fdt, max_fds),
which is the smallest multiple of BITS_PER_LONG that covers all
opened descriptors below max_fds. In the common case (copying on
fork()) max_fds is ~0U, so all opened descriptors will be below
it and we are fine, by the same reasons why the call in expand_fdtable()
is safe.

Unfortunately, there is a case where max_fds is less than that
and where we might, indeed, end up with junk in ->full_fds_bits[] -
close_range(from, to, CLOSE_RANGE_UNSHARE) with
* descriptor table being currently shared
* 'to' being above the current capacity of descriptor table
* 'from' being just under some chunk of opened descriptors.
In that case we end up with observably wrong behaviour - e.g. spawn
a child with CLONE_FILES, get all descriptors in range 0..127 open,
then close_range(64, ~0U, CLOSE_RANGE_UNSHARE) and watch dup(0) ending
up with descriptor #128, despite #64 being observably not open.

The minimally invasive fix would be to deal with that in dup_fd().
If this proves to add measurable overhead, we can go that way, but
let's try to fix copy_fd_bitmaps() first.

* new helper: bitmap_copy_and_expand(to, from, bits_to_copy, size).
* make copy_fd_bitmaps() take the bitmap size in words, rather than
bits; it's 'count' argument is always a multiple of BITS_PER_LONG,
so we are not losing any information, and that way we can use the
same helper for all three bitmaps - compiler will see that count
is a multiple of BITS_PER_LONG for the large ones, so it'll generate
plain memcpy()+memset().

Reproducer added to tools/testing/selftests/core/close_range_test.c

Solutions

ubuntu-upgrade-linux-image-5-15-0-1038-xilinx-zynqmpubuntu-upgrade-linux-image-5-15-0-1055-gkeopubuntu-upgrade-linux-image-5-15-0-1065-ibmubuntu-upgrade-linux-image-5-15-0-1065-raspiubuntu-upgrade-linux-image-5-15-0-1067-intel-iotgubuntu-upgrade-linux-image-5-15-0-1067-nvidiaubuntu-upgrade-linux-image-5-15-0-1067-nvidia-lowlatencyubuntu-upgrade-linux-image-5-15-0-1069-gkeubuntu-upgrade-linux-image-5-15-0-1069-kvmubuntu-upgrade-linux-image-5-15-0-1070-oracleubuntu-upgrade-linux-image-5-15-0-1071-gcpubuntu-upgrade-linux-image-5-15-0-1072-awsubuntu-upgrade-linux-image-5-15-0-1075-azureubuntu-upgrade-linux-image-5-15-0-1078-azureubuntu-upgrade-linux-image-5-15-0-125-genericubuntu-upgrade-linux-image-5-15-0-125-generic-64kubuntu-upgrade-linux-image-5-15-0-125-generic-lpaeubuntu-upgrade-linux-image-5-15-0-125-lowlatencyubuntu-upgrade-linux-image-5-15-0-125-lowlatency-64kubuntu-upgrade-linux-image-5-4-0-1044-iotubuntu-upgrade-linux-image-5-4-0-1054-xilinx-zynqmpubuntu-upgrade-linux-image-5-4-0-1082-ibmubuntu-upgrade-linux-image-5-4-0-1094-bluefieldubuntu-upgrade-linux-image-5-4-0-1102-gkeopubuntu-upgrade-linux-image-5-4-0-1119-raspiubuntu-upgrade-linux-image-5-4-0-1123-kvmubuntu-upgrade-linux-image-5-4-0-1134-oracleubuntu-upgrade-linux-image-5-4-0-1135-awsubuntu-upgrade-linux-image-5-4-0-1139-azureubuntu-upgrade-linux-image-5-4-0-1139-gcpubuntu-upgrade-linux-image-5-4-0-1140-azureubuntu-upgrade-linux-image-5-4-0-200-genericubuntu-upgrade-linux-image-5-4-0-200-generic-lpaeubuntu-upgrade-linux-image-5-4-0-200-lowlatencyubuntu-upgrade-linux-image-6-8-0-1002-gkeopubuntu-upgrade-linux-image-6-8-0-1015-gkeubuntu-upgrade-linux-image-6-8-0-1016-raspiubuntu-upgrade-linux-image-6-8-0-1017-ibmubuntu-upgrade-linux-image-6-8-0-1017-oracleubuntu-upgrade-linux-image-6-8-0-1017-oracle-64kubuntu-upgrade-linux-image-6-8-0-1018-oemubuntu-upgrade-linux-image-6-8-0-1019-gcpubuntu-upgrade-linux-image-6-8-0-1019-nvidiaubuntu-upgrade-linux-image-6-8-0-1019-nvidia-64kubuntu-upgrade-linux-image-6-8-0-1019-nvidia-lowlatencyubuntu-upgrade-linux-image-6-8-0-1019-nvidia-lowlatency-64kubuntu-upgrade-linux-image-6-8-0-1020-awsubuntu-upgrade-linux-image-6-8-0-1020-azureubuntu-upgrade-linux-image-6-8-0-1020-azure-fdeubuntu-upgrade-linux-image-6-8-0-50-genericubuntu-upgrade-linux-image-6-8-0-50-generic-64kubuntu-upgrade-linux-image-6-8-0-50-lowlatencyubuntu-upgrade-linux-image-6-8-0-50-lowlatency-64kubuntu-upgrade-linux-image-awsubuntu-upgrade-linux-image-aws-lts-20-04ubuntu-upgrade-linux-image-aws-lts-22-04ubuntu-upgrade-linux-image-azureubuntu-upgrade-linux-image-azure-cvmubuntu-upgrade-linux-image-azure-fdeubuntu-upgrade-linux-image-azure-lts-20-04ubuntu-upgrade-linux-image-azure-lts-22-04ubuntu-upgrade-linux-image-bluefieldubuntu-upgrade-linux-image-gcpubuntu-upgrade-linux-image-gcp-lts-20-04ubuntu-upgrade-linux-image-gcp-lts-22-04ubuntu-upgrade-linux-image-genericubuntu-upgrade-linux-image-generic-64kubuntu-upgrade-linux-image-generic-64k-hwe-20-04ubuntu-upgrade-linux-image-generic-64k-hwe-22-04ubuntu-upgrade-linux-image-generic-64k-hwe-24-04ubuntu-upgrade-linux-image-generic-hwe-18-04ubuntu-upgrade-linux-image-generic-hwe-20-04ubuntu-upgrade-linux-image-generic-hwe-22-04ubuntu-upgrade-linux-image-generic-hwe-24-04ubuntu-upgrade-linux-image-generic-lpaeubuntu-upgrade-linux-image-generic-lpae-hwe-20-04ubuntu-upgrade-linux-image-gkeubuntu-upgrade-linux-image-gke-5-15ubuntu-upgrade-linux-image-gkeopubuntu-upgrade-linux-image-gkeop-5-15ubuntu-upgrade-linux-image-gkeop-5-4ubuntu-upgrade-linux-image-gkeop-6-8ubuntu-upgrade-linux-image-ibmubuntu-upgrade-linux-image-ibm-classicubuntu-upgrade-linux-image-ibm-lts-20-04ubuntu-upgrade-linux-image-ibm-lts-24-04ubuntu-upgrade-linux-image-intelubuntu-upgrade-linux-image-intel-iotgubuntu-upgrade-linux-image-kvmubuntu-upgrade-linux-image-lowlatencyubuntu-upgrade-linux-image-lowlatency-64kubuntu-upgrade-linux-image-lowlatency-64k-hwe-20-04ubuntu-upgrade-linux-image-lowlatency-64k-hwe-22-04ubuntu-upgrade-linux-image-lowlatency-64k-hwe-24-04ubuntu-upgrade-linux-image-lowlatency-hwe-18-04ubuntu-upgrade-linux-image-lowlatency-hwe-20-04ubuntu-upgrade-linux-image-lowlatency-hwe-22-04ubuntu-upgrade-linux-image-lowlatency-hwe-24-04ubuntu-upgrade-linux-image-nvidiaubuntu-upgrade-linux-image-nvidia-6-8ubuntu-upgrade-linux-image-nvidia-64kubuntu-upgrade-linux-image-nvidia-64k-6-8ubuntu-upgrade-linux-image-nvidia-64k-hwe-22-04ubuntu-upgrade-linux-image-nvidia-hwe-22-04ubuntu-upgrade-linux-image-nvidia-lowlatencyubuntu-upgrade-linux-image-nvidia-lowlatency-64kubuntu-upgrade-linux-image-oemubuntu-upgrade-linux-image-oem-20-04ubuntu-upgrade-linux-image-oem-20-04bubuntu-upgrade-linux-image-oem-20-04cubuntu-upgrade-linux-image-oem-20-04dubuntu-upgrade-linux-image-oem-22-04ubuntu-upgrade-linux-image-oem-22-04aubuntu-upgrade-linux-image-oem-22-04bubuntu-upgrade-linux-image-oem-22-04cubuntu-upgrade-linux-image-oem-22-04dubuntu-upgrade-linux-image-oem-24-04ubuntu-upgrade-linux-image-oem-24-04aubuntu-upgrade-linux-image-oem-osp1ubuntu-upgrade-linux-image-oracleubuntu-upgrade-linux-image-oracle-64kubuntu-upgrade-linux-image-oracle-lts-20-04ubuntu-upgrade-linux-image-oracle-lts-22-04ubuntu-upgrade-linux-image-raspiubuntu-upgrade-linux-image-raspi-hwe-18-04ubuntu-upgrade-linux-image-raspi-nolpaeubuntu-upgrade-linux-image-raspi2ubuntu-upgrade-linux-image-snapdragon-hwe-18-04ubuntu-upgrade-linux-image-virtualubuntu-upgrade-linux-image-virtual-hwe-18-04ubuntu-upgrade-linux-image-virtual-hwe-20-04ubuntu-upgrade-linux-image-virtual-hwe-22-04ubuntu-upgrade-linux-image-virtual-hwe-24-04ubuntu-upgrade-linux-image-xilinx-zynqmp

References

    Title
    NEW

    Explore Exposure Command

    Confidently identify and prioritize exposures from endpoint to cloud with full attack surface visibility and threat-aware risk context.