# git rev-parse -q --verify 590ce02bd148cd35721560c140e3759e39a6e56a^{commit} 590ce02bd148cd35721560c140e3759e39a6e56a already have revision, skipping fetch # git checkout -q -f -B kisskb 590ce02bd148cd35721560c140e3759e39a6e56a # git clean -qxdf # < git log -1 # commit 590ce02bd148cd35721560c140e3759e39a6e56a # Author: Nicholas Piggin # Date: Wed Jul 22 17:34:37 2020 +1000 # # powerpc/64s: Fix irq tracing corruption in interrupt/syscall return caused by perf interrupts # # Alexey reports lockdep_assert_irqs_enabled() warnings when stress # testing perf, e.g., # # WARNING: CPU: 0 PID: 1556 at kernel/softirq.c:169 __local_bh_enable_ip+0x258/0x270 # CPU: 0 PID: 1556 Comm: syz-executor # NIP: c0000000001ec888 LR: c0000000001ec884 CTR: c000000000ef0610 # REGS: c000000022d4f8a0 TRAP: 0700 Not tainted (5.8.0-rc3-x) # MSR: 8000000000029033 CR: 28008844 XER: 20040000 # CFAR: c0000000001dc1d0 IRQMASK: 0 # # The interesting thing is MSR[EE] and IRQMASK shows interrupts are # enabled, suggesting the current->hardirqs_enabled irq tracing state is # going out of sync with the actual interrupt enable state. # # The cause is a window in interrupt/syscall return where irq tracing # state is being adjusted for an irqs-enabled return while MSR[EE] is # still enabled. A perf interrupt hits and ends up calling # trace_hardirqs_off() when restoring interrupt flags to a disable # state. # # Fix this by disabling perf interrupts as well while adjusting irq # tracing state. # # Add a debug check that catches the condition sooner. # # Fixes: 68b34588e202 ("powerpc/64/sycall: Implement syscall entry/exit logic in C") # Cc: stable@vger.kernel.org # v5.7+ # Reported-by: Alexey Kardashevskiy # Signed-off-by: Nicholas Piggin # Signed-off-by: Michael Ellerman # Link: https://lore.kernel.org/r/20200722073437.930521-1-npiggin@gmail.com # < /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/ia64-linux/bin/ia64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-4.9.4-nolibc/ia64-linux/bin/ia64-linux-ld --version # < git log --format=%s --max-count=1 590ce02bd148cd35721560c140e3759e39a6e56a # < make -s -j 24 ARCH=ia64 O=/kisskb/build/powerpc-fixes_ia64-defconfig_ia64-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/ia64-linux/bin/ia64-linux- defconfig # < make -s -j 24 ARCH=ia64 O=/kisskb/build/powerpc-fixes_ia64-defconfig_ia64-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/ia64-linux/bin/ia64-linux- help # make -s -j 24 ARCH=ia64 O=/kisskb/build/powerpc-fixes_ia64-defconfig_ia64-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/ia64-linux/bin/ia64-linux- olddefconfig # make -s -j 24 ARCH=ia64 O=/kisskb/build/powerpc-fixes_ia64-defconfig_ia64-gcc4.9 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-4.9.4-nolibc/ia64-linux/bin/ia64-linux- :1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] In file included from /kisskb/src/arch/ia64/include/uapi/asm/intrinsics.h:22:0, from /kisskb/src/arch/ia64/include/asm/intrinsics.h:11, from /kisskb/src/arch/ia64/include/asm/bitops.h:19, from /kisskb/src/include/linux/bitops.h:29, from /kisskb/src/include/linux/kernel.h:12, from /kisskb/src/include/linux/list.h:9, from /kisskb/src/include/linux/preempt.h:11, from /kisskb/src/include/linux/spinlock.h:51, from /kisskb/src/include/linux/seqlock.h:36, from /kisskb/src/include/linux/time.h:6, from /kisskb/src/fs/nfs/read.c:11: /kisskb/src/fs/nfs/read.c: In function 'nfs_read_completion': /kisskb/src/arch/ia64/include/uapi/asm/cmpxchg.h:57:2: warning: value computed is not used [-Wunused-value] ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr)))) ^ /kisskb/src/fs/nfs/read.c:196:5: note: in expansion of macro 'xchg' xchg(&nfs_req_openctx(req)->error, error); ^ /kisskb/src/fs/nfs/read.c: In function 'nfs_readpage': /kisskb/src/arch/ia64/include/uapi/asm/cmpxchg.h:57:2: warning: value computed is not used [-Wunused-value] ((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr)))) ^ /kisskb/src/fs/nfs/read.c:355:2: note: in expansion of macro 'xchg' xchg(&ctx->error, 0); ^ No errors detected in 22248 functions. Completed OK # rm -rf /kisskb/build/powerpc-fixes_ia64-defconfig_ia64-gcc4.9 # Build took: 0:02:54.883667