# git rev-parse -q --verify 8c1684bb81f173543599f1848c29a2a3b1ee5907^{commit} 8c1684bb81f173543599f1848c29a2a3b1ee5907 already have revision, skipping fetch # git checkout -q -f -B kisskb 8c1684bb81f173543599f1848c29a2a3b1ee5907 # git clean -qxdf # < git log -1 # commit 8c1684bb81f173543599f1848c29a2a3b1ee5907 # Merge: f44d5c489051 3f2c788a1314 # Author: Linus Torvalds # Date: Thu May 14 11:52:28 2020 -0700 # # Merge tag 'for-linus-2020-05-13' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux # # Pull thread fix from Christian Brauner: # "This contains a single fix for all exported legacy fork helpers to # block accidental access to clone3() features in the upper 32 bits of # their respective flags arguments. # # I got Cced on a glibc issue where someone reported consistent failures # for the legacy clone() syscall on ppc64le when sign extension was # performed (since the clone() syscall in glibc exposes the flags # argument as an int whereas the kernel uses unsigned long). # # The legacy clone() syscall is odd in a bunch of ways and here two # things interact: # # - First, legacy clone's flag argument is word-size dependent, i.e. # it's an unsigned long whereas most system calls with flag arguments # use int or unsigned int. # # - Second, legacy clone() ignores unknown and deprecated flags. # # The two of them taken together means that users on 64bit systems can # pass garbage for the upper 32bit of the clone() syscall since forever # and things would just work fine. # # The following program compiled on a 64bit kernel prior to v5.7-rc1 # will succeed and will fail post v5.7-rc1 with EBADF: # # int main(int argc, char *argv[]) # { # pid_t pid; # # /* Note that legacy clone() has different argument ordering on # * different architectures so this won't work everywhere. # * # * Only set the upper 32 bits. # */ # pid = syscall(__NR_clone, 0xffffffff00000000 | SIGCHLD, # NULL, NULL, NULL, NULL); # if (pid < 0) # exit(EXIT_FAILURE); # if (pid == 0) # exit(EXIT_SUCCESS); # if (wait(NULL) != pid) # exit(EXIT_FAILURE); # # exit(EXIT_SUCCESS); # } # # Since legacy clone() couldn't be extended this was not a problem so # far and nobody really noticed or cared since nothing in the kernel # ever bothered to look at the upper 32 bits. # # But once we introduced clone3() and expanded the flag argument in # struct clone_args to 64 bit we opened this can of worms. With the # first flag-based extension to clone3() making use of the upper 32 bits # of the flag argument we've effectively made it possible for the legacy # clone() syscall to reach clone3() only flags on accident. The sign # extension scenario is just the odd corner-case that we needed to # figure this out. # # The reason we just realized this now and not already when we # introduced CLONE_CLEAR_SIGHAND was that CLONE_INTO_CGROUP assumes that # a valid cgroup file descriptor has been given - whereas # CLONE_CLEAR_SIGHAND doesn't need to verify anything. It just silently # resets the signal handlers to SIG_DFL. # # So the sign extension (or the user accidently passing garbage for the # upper 32 bits) caused the CLONE_INTO_CGROUP bit to be raised and the # kernel to error out when it didn't find a valid cgroup file # descriptor. # # Note, I'm also capping kernel_thread()'s flag argument mainly because # none of the new features make sense for kernel_thread() and we # shouldn't risk them being accidently activated however unlikely. If we # wanted to, we could even make kernel_thread() yell when an unknown # flag has been set which it doesn't do right now. But it's not worth # risking this in a bugfix imho" # # * tag 'for-linus-2020-05-13' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux: # fork: prevent accidental access to clone3 features # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux-ld --version # < git log --format=%s --max-count=1 8c1684bb81f173543599f1848c29a2a3b1ee5907 # < make -s -j 48 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mips-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux- defconfig # < make -s -j 48 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mips-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux- help # make -s -j 48 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mips-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux- olddefconfig # make -s -j 48 ARCH=mips O=/kisskb/build/linus_mips-defconfig_mips-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.1.0-nolibc/mips-linux/bin/mips-linux- FIT description: Linux 5.7.0-rc5-g8c1684bb81f1 Created: Fri May 15 07:10:50 2020 Image 0 (kernel@0) Description: Linux 5.7.0-rc5-g8c1684bb81f1 Created: Fri May 15 07:10:50 2020 Type: Kernel Image Compression: gzip compressed Data Size: 4923039 Bytes = 4807.66 KiB = 4.69 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x80918db0 Hash algo: sha1 Hash value: 746e5eb49645e99dce5fd2cadde85cea48795f98 Image 1 (fdt@boston) Description: img,boston Device Tree Created: Fri May 15 07:10:50 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: Fri May 15 07:10:50 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: Fri May 15 07:10:50 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 4639 Bytes = 4.53 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 018897896b42c41c943aca35a20e4300dba250c8 Image 4 (fdt@ocelot_pcb120) Description: MSCC Ocelot PCB120 Device Tree Created: Fri May 15 07:10:50 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 5198 Bytes = 5.08 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 36c7bd0bd79cfc2f7dd6acda6c7996294f4967e6 Image 5 (fdt@xilfpga) Description: MIPSfpga (xilfpga) Device Tree Created: Fri May 15 07:10:50 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_mips-gcc8 # Build took: 0:02:08.223776