# git rev-parse -q --verify 467f8165a2b0e6accf3d0dd9c8089b1dbde29f7f^{commit} 467f8165a2b0e6accf3d0dd9c8089b1dbde29f7f already have revision, skipping fetch # git checkout -q -f -B kisskb 467f8165a2b0e6accf3d0dd9c8089b1dbde29f7f # git clean -qxdf # < git log -1 # commit 467f8165a2b0e6accf3d0dd9c8089b1dbde29f7f # Merge: 3872f516aab3 6abc20f8f879 # Author: Linus Torvalds # Date: Sat Dec 19 13:03:12 2020 -0800 # # Merge tag 'close-range-cloexec-unshare-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux # # Pull close_range fix from Christian Brauner: # "syzbot reported a bug when asking close_range() to unshare the file # descriptor table and making all fds close-on-exec. # # If CLOSE_RANGE_UNSHARE the caller will receive a private file # descriptor table in case their file descriptor table is currently # shared before operating on the requested file descriptor range. # # For the case where the caller has requested all file descriptors to be # actually closed via e.g. close_range(3, ~0U, CLOSE_RANGE_UNSHARE) the # kernel knows that the caller does not need any of the file descriptors # anymore and will optimize the close operation by only copying all # files in the range from 0 to 3 and no others. # # However, if the caller requested CLOSE_RANGE_CLOEXEC together with # CLOSE_RANGE_UNSHARE the caller wants to still make use of the file # descriptors so the kernel needs to copy all of them and can't # optimize. # # The original patch didn't account for this and thus could cause oopses # as evidenced by the syzbot report because it assumed that all fds had # been copied. Fix this by handling the CLOSE_RANGE_CLOEXEC case and # copying all fds if the two flags are specified together. # # This should've been caught in the selftests but the original patch # didn't cover this case and I didn't catch it during review. So in # addition to the bugfix I'm also adding selftests. They will reliably # reproduce the bug on a non-fixed kernel and allows us to catch # regressions and verify correct behavior. # # Note, the kernel selftest tree contained a bunch of changes that made # the original selftest fail to compile so there are small fixups in # here make them compile without warnings" # # * tag 'close-range-cloexec-unshare-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux: # selftests/core: add regression test for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC # selftests/core: add test for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC # selftests/core: handle missing syscall number for close_range # selftests/core: fix close_range_test build after XFAIL removal # close_range: unshare all fds for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-gcc --version # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-ld --version # < git log --format=%s --max-count=1 467f8165a2b0e6accf3d0dd9c8089b1dbde29f7f # < make -s -j 120 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- defconfig # make -s -j 120 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- FIT description: Linux 5.10.0-g467f8165a2b0 Created: Sun Dec 20 08:55:27 2020 Image 0 (kernel@0) Description: Linux 5.10.0-g467f8165a2b0 Created: Sun Dec 20 08:55:27 2020 Type: Kernel Image Compression: gzip compressed Data Size: 5212877 Bytes = 5090.70 KiB = 4.97 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x80994e28 Hash algo: sha1 Hash value: d585ba3eb1d5252a6618f811e25ee0250f3c4d2e Image 1 (fdt@boston) Description: img,boston Device Tree Created: Sun Dec 20 08:55:27 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 3793 Bytes = 3.70 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 4799f50d688573234da6e9d7701234d394759ef4 Image 2 (fdt@ni169445) Description: NI 169445 device tree Created: Sun Dec 20 08:55:27 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 1871 Bytes = 1.83 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 51b89b31605ee62038c8468c429af091dfc75ec7 Image 3 (fdt@ocelot_pcb123) Description: MSCC Ocelot PCB123 Device Tree Created: Sun Dec 20 08:55:27 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 4659 Bytes = 4.55 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 5bcb6e4f21e8e5372544aa130b3bd097355a9050 Image 4 (fdt@ocelot_pcb120) Description: MSCC Ocelot PCB120 Device Tree Created: Sun Dec 20 08:55:27 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 5418 Bytes = 5.29 KiB = 0.01 MiB Architecture: MIPS Hash algo: sha1 Hash value: 93d882f2009a217e0fa9dab94788535ed2be8476 Image 5 (fdt@xilfpga) Description: MIPSfpga (xilfpga) Device Tree Created: Sun Dec 20 08:55:27 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 2708 Bytes = 2.64 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 63d058b780f65e22da30f0a183433765f1807f1d Default Configuration: 'conf@default' Configuration 0 (conf@default) Description: Generic Linux kernel Kernel: kernel@0 Configuration 1 (conf@boston) Description: Boston Linux kernel Kernel: kernel@0 FDT: fdt@boston Configuration 2 (conf@ni169445) Description: NI 169445 Linux Kernel Kernel: kernel@0 FDT: fdt@ni169445 Configuration 3 (conf@ocelot_pcb123) Description: Ocelot Linux kernel Kernel: kernel@0 FDT: fdt@ocelot_pcb123 Configuration 4 (conf@ocelot_pcb120) Description: Ocelot Linux kernel Kernel: kernel@0 FDT: fdt@ocelot_pcb120 Configuration 5 (conf@xilfpga) Description: MIPSfpga Linux kernel Kernel: kernel@0 FDT: fdt@xilfpga Completed OK # rm -rf /kisskb/build/linus_mips-defconfig_mipsel # Build took: 0:01:10.238542