# git rev-parse -q --verify a4d63c3732f1a0c91abcf5b7f32b4ef7dcd82025^{commit} a4d63c3732f1a0c91abcf5b7f32b4ef7dcd82025 already have revision, skipping fetch # git checkout -q -f -B kisskb a4d63c3732f1a0c91abcf5b7f32b4ef7dcd82025 # git clean -qxdf # < git log -1 # commit a4d63c3732f1a0c91abcf5b7f32b4ef7dcd82025 # Author: Jason A. Donenfeld # Date: Mon Sep 28 12:35:07 2020 +0200 # # mm: do not rely on mm == current->mm in __get_user_pages_locked # # It seems likely this block was pasted from internal_get_user_pages_fast, # which is not passed an mm struct and therefore uses current's. But # __get_user_pages_locked is passed an explicit mm, and current->mm is not # always valid. This was hit when being called from i915, which uses: # # pin_user_pages_remote-> # __get_user_pages_remote-> # __gup_longterm_locked-> # __get_user_pages_locked # # Before, this would lead to an OOPS: # # BUG: kernel NULL pointer dereference, address: 0000000000000064 # #PF: supervisor write access in kernel mode # #PF: error_code(0x0002) - not-present page # CPU: 10 PID: 1431 Comm: kworker/u33:1 Tainted: P S U O 5.9.0-rc7+ #140 # Hardware name: LENOVO 20QTCTO1WW/20QTCTO1WW, BIOS N2OET47W (1.34 ) 08/06/2020 # Workqueue: i915-userptr-acquire __i915_gem_userptr_get_pages_worker [i915] # RIP: 0010:__get_user_pages_remote+0xd7/0x310 # Call Trace: # __i915_gem_userptr_get_pages_worker+0xc8/0x260 [i915] # process_one_work+0x1ca/0x390 # worker_thread+0x48/0x3c0 # kthread+0x114/0x130 # ret_from_fork+0x1f/0x30 # CR2: 0000000000000064 # # This commit fixes the problem by using the mm pointer passed to the # function rather than the bogus one in current. # # Fixes: 008cfe4418b3 ("mm: Introduce mm_struct.has_pinned") # Tested-by: Chris Wilson # Reported-by: Harald Arnesen # Reviewed-by: Jason Gunthorpe # Reviewed-by: Peter Xu # Signed-off-by: Jason A. Donenfeld # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 a4d63c3732f1a0c91abcf5b7f32b4ef7dcd82025 # < make -s -j 24 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- randconfig KCONFIG_SEED=0x48A9A308 # Added to kconfig CONFIG_STANDALONE=y # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_CPU_BIG_ENDIAN=y # Added to kconfig CONFIG_PPC64=y # Added to kconfig CONFIG_PPC_DISABLE_WERROR=y # Added to kconfig CONFIG_SECTION_MISMATCH_WARN_ONLY=y # Added to kconfig CONFIG_PREVENT_FIRMWARE_BUILD=y # Added to kconfig CONFIG_CC_STACKPROTECTOR_STRONG=n # Added to kconfig CONFIG_GCC_PLUGINS=n # Added to kconfig CONFIG_LD_HEAD_STUB_CATCH=y # Added to kconfig CONFIG_TRIM_UNUSED_KSYMS=n # Added to kconfig CONFIG_UBSAN=n # < make -s -j 24 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- help # make -s -j 24 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- olddefconfig .config:4472:warning: override: reassigning to symbol STANDALONE .config:4475:warning: override: reassigning to symbol CPU_BIG_ENDIAN .config:4475:warning: override: CPU_BIG_ENDIAN changes choice state .config:4477:warning: override: reassigning to symbol PPC_DISABLE_WERROR .config:4478:warning: override: reassigning to symbol SECTION_MISMATCH_WARN_ONLY .config:4479:warning: override: reassigning to symbol PREVENT_FIRMWARE_BUILD .config:4484:warning: override: reassigning to symbol UBSAN # make -s -j 24 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- /kisskb/src/arch/powerpc/kernel/watchdog.c: In function 'watchdog_smp_panic': /kisskb/src/arch/powerpc/kernel/watchdog.c:175:4: error: implicit declaration of function 'smp_send_nmi_ipi'; did you mean 'smp_send_stop'? [-Werror=implicit-function-declaration] 175 | smp_send_nmi_ipi(c, wd_lockup_ipi, 1000000); | ^~~~~~~~~~~~~~~~ | smp_send_stop cc1: some warnings being treated as errors make[3]: *** [/kisskb/src/scripts/Makefile.build:283: arch/powerpc/kernel/watchdog.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/kisskb/src/scripts/Makefile.build:500: arch/powerpc/kernel] Error 2 make[1]: *** [/kisskb/src/Makefile:1784: arch/powerpc] Error 2 make[1]: *** Waiting for unfinished jobs.... /kisskb/src/kernel/watchdog.c:47:23: warning: 'watchdog_allowed_mask' defined but not used [-Wunused-variable] 47 | static struct cpumask watchdog_allowed_mask __read_mostly; | ^~~~~~~~~~~~~~~~~~~~~ make: *** [Makefile:185: __sub-make] Error 2 Command 'make -s -j 24 ARCH=powerpc O=/kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-9.2.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ' returned non-zero exit status 2 # rm -rf /kisskb/build/linus-rand_powerpc-randconfig_powerpc-gcc9 # Build took: 0:02:45.024280