# git rev-parse -q --verify d41a3effbb53b1bcea41e328d16a4d046a508381^{commit} d41a3effbb53b1bcea41e328d16a4d046a508381 already have revision, skipping fetch # git checkout -q -f -B kisskb d41a3effbb53b1bcea41e328d16a4d046a508381 # git clean -qxdf # < git log -1 # commit d41a3effbb53b1bcea41e328d16a4d046a508381 # Author: Hillf Danton # Date: Mon Sep 2 13:37:29 2019 +0100 # # keys: Fix missing null pointer check in request_key_auth_describe() # # If a request_key authentication token key gets revoked, there's a window in # which request_key_auth_describe() can see it with a NULL payload - but it # makes no check for this and something like the following oops may occur: # # BUG: Kernel NULL pointer dereference at 0x00000038 # Faulting instruction address: 0xc0000000004ddf30 # Oops: Kernel access of bad area, sig: 11 [#1] # ... # NIP [...] request_key_auth_describe+0x90/0xd0 # LR [...] request_key_auth_describe+0x54/0xd0 # Call Trace: # [...] request_key_auth_describe+0x54/0xd0 (unreliable) # [...] proc_keys_show+0x308/0x4c0 # [...] seq_read+0x3d0/0x540 # [...] proc_reg_read+0x90/0x110 # [...] __vfs_read+0x3c/0x70 # [...] vfs_read+0xb4/0x1b0 # [...] ksys_read+0x7c/0x130 # [...] system_call+0x5c/0x70 # # Fix this by checking for a NULL pointer when describing such a key. # # Also make the read routine check for a NULL pointer to be on the safe side. # # [DH: Modified to not take already-held rcu lock and modified to also check # in the read routine] # # Fixes: 04c567d9313e ("[PATCH] Keys: Fix race between two instantiators of a key") # Reported-by: Sachin Sant # Signed-off-by: Hillf Danton # Signed-off-by: David Howells # Tested-by: Sachin Sant # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/br-xtensa-full-2016.08-613-ge98b4dd/bin/xtensa-linux-gcc --version # < /opt/cross/kisskb/br-xtensa-full-2016.08-613-ge98b4dd/bin/xtensa-linux-ld --version # < git log --format=%s --max-count=1 d41a3effbb53b1bcea41e328d16a4d046a508381 # < make -s -j 32 ARCH=xtensa O=/kisskb/build/linus_xtensa-allmodconfig_xtensa CROSS_COMPILE=/opt/cross/kisskb/br-xtensa-full-2016.08-613-ge98b4dd/bin/xtensa-linux- allmodconfig # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_SAMPLES=n # yes \n | make -s -j 32 ARCH=xtensa O=/kisskb/build/linus_xtensa-allmodconfig_xtensa CROSS_COMPILE=/opt/cross/kisskb/br-xtensa-full-2016.08-613-ge98b4dd/bin/xtensa-linux- oldconfig yes: standard output: Broken pipe # make -s -j 32 ARCH=xtensa O=/kisskb/build/linus_xtensa-allmodconfig_xtensa CROSS_COMPILE=/opt/cross/kisskb/br-xtensa-full-2016.08-613-ge98b4dd/bin/xtensa-linux- usr/include/asm/setup.h:17: userspace cannot reference function or variable defined in the kernel /kisskb/src/drivers/char/tpm/tpm2-cmd.c: In function 'tpm2_unseal_trusted': /kisskb/src/drivers/char/tpm/tpm2-cmd.c:669:2: warning: 'blob_handle' may be used uninitialized in this function [-Wmaybe-uninitialized] tpm2_flush_context(chip, blob_handle); ^ In file included from /kisskb/src/include/linux/wait.h:9:0, from /kisskb/src/include/linux/net.h:19, from /kisskb/src/drivers/infiniband/sw/siw/siw_qp_rx.c:8: /kisskb/src/drivers/infiniband/sw/siw/siw_qp_rx.c: In function 'siw_proc_send': /kisskb/src/include/linux/spinlock.h:288:3: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized] _raw_spin_unlock_irqrestore(lock, flags); \ ^ /kisskb/src/drivers/infiniband/sw/siw/siw_qp_rx.c:335:16: note: 'flags' was declared here unsigned long flags; ^ /kisskb/src/drivers/i2c/busses/i2c-sh_mobile.c: In function 'sh_mobile_i2c_isr': /kisskb/src/drivers/i2c/busses/i2c-sh_mobile.c:399:26: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized] pd->msg->buf[real_pos] = data; ^ /kisskb/src/drivers/i2c/busses/i2c-sh_mobile.c:372:16: note: 'data' was declared here unsigned char data; ^ /kisskb/src/drivers/input/joystick/analog.c:160:2: warning: #warning Precise timer not defined for this architecture. [-Wcpp] #warning Precise timer not defined for this architecture. ^ In file included from /kisskb/src/arch/xtensa/include/asm/atomic.h:19:0, from /kisskb/src/include/linux/atomic.h:7, from /kisskb/src/include/asm-generic/bitops/atomic.h:5, from /kisskb/src/arch/xtensa/include/asm/bitops.h:339, from /kisskb/src/include/linux/bitops.h:19, from /kisskb/src/include/linux/kernel.h:12, from /kisskb/src/include/linux/list.h:9, from /kisskb/src/include/linux/wait.h:7, from /kisskb/src/include/linux/wait_bit.h:8, from /kisskb/src/include/linux/fs.h:6, from /kisskb/src/fs/ocfs2/file.c:13: /kisskb/src/fs/ocfs2/file.c: In function 'ocfs2_file_write_iter': /kisskb/src/arch/xtensa/include/asm/cmpxchg.h:172:3: warning: value computed is not used [-Wunused-value] ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) ^ /kisskb/src/fs/ocfs2/file.c:2372:3: note: in expansion of macro 'xchg' xchg(&iocb->ki_complete, saved_ki_complete); ^ /kisskb/src/drivers/soundwire/slave.c:16:12: warning: 'sdw_slave_add' defined but not used [-Wunused-function] static int sdw_slave_add(struct sdw_bus *bus, ^ In file included from /kisskb/src/include/linux/rwsem.h:16:0, from /kisskb/src/include/linux/notifier.h:15, from /kisskb/src/include/linux/clk.h:14, from /kisskb/src/drivers/tty/serial/sh-sci.c:24: /kisskb/src/drivers/tty/serial/sh-sci.c: In function 'sci_dma_rx_submit': /kisskb/src/include/linux/spinlock.h:288:3: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized] _raw_spin_unlock_irqrestore(lock, flags); \ ^ /kisskb/src/drivers/tty/serial/sh-sci.c:1353:16: note: 'flags' was declared here unsigned long flags; ^ /kisskb/src/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c: In function 'mlx5e_grp_sw_update_stats': /kisskb/src/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c:294:1: warning: the frame size of 1184 bytes is larger than 1024 bytes [-Wframe-larger-than=] } ^ /kisskb/src/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c: In function 'mlx5e_open_xsk': /kisskb/src/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:127:1: warning: the frame size of 1296 bytes is larger than 1024 bytes [-Wframe-larger-than=] } ^ In file included from /kisskb/src/arch/xtensa/include/asm/atomic.h:19:0, from /kisskb/src/include/linux/atomic.h:7, from /kisskb/src/include/asm-generic/bitops/atomic.h:5, from /kisskb/src/arch/xtensa/include/asm/bitops.h:339, from /kisskb/src/include/linux/bitops.h:19, from /kisskb/src/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:11: /kisskb/src/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c: In function 'ixgbevf_xdp_setup': /kisskb/src/arch/xtensa/include/asm/cmpxchg.h:172:3: warning: value computed is not used [-Wunused-value] ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) ^ /kisskb/src/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:4475:4: note: in expansion of macro 'xchg' xchg(&adapter->rx_ring[i]->xdp_prog, adapter->xdp_prog); ^ Completed OK # rm -rf /kisskb/build/linus_xtensa-allmodconfig_xtensa # Build took: 0:14:54.854682