linux-stable/arch/powerpc/kernel
Kees Cook f72ecfe93a pstore: Convert buf_lock to semaphore
commit ea84b580b9 upstream.

Instead of running with interrupts disabled, use a semaphore. This should
make it easier for backends that may need to sleep (e.g. EFI) when
performing a write:

|BUG: sleeping function called from invalid context at kernel/sched/completion.c:99
|in_atomic(): 1, irqs_disabled(): 1, pid: 2236, name: sig-xstate-bum
|Preemption disabled at:
|[<ffffffff99d60512>] pstore_dump+0x72/0x330
|CPU: 26 PID: 2236 Comm: sig-xstate-bum Tainted: G      D           4.20.0-rc3 #45
|Call Trace:
| dump_stack+0x4f/0x6a
| ___might_sleep.cold.91+0xd3/0xe4
| __might_sleep+0x50/0x90
| wait_for_completion+0x32/0x130
| virt_efi_query_variable_info+0x14e/0x160
| efi_query_variable_store+0x51/0x1a0
| efivar_entry_set_safe+0xa3/0x1b0
| efi_pstore_write+0x109/0x140
| pstore_dump+0x11c/0x330
| kmsg_dump+0xa4/0xd0
| oops_exit+0x22/0x30
...

Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Fixes: 21b3ddd39f ("efi: Don't use spinlocks for efi vars")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-11 12:21:48 +02:00
..
trace License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vdso32 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vdso64 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
.gitignore
align.c powerpc: Fix check for copy/paste instructions in alignment handler 2017-10-25 12:42:35 +02:00
asm-offsets.c powerpc/64s: Improve RFI L1-D cache flush fallback 2018-05-30 07:51:50 +02:00
audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
btext.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cacheinfo.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
cacheinfo.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
cpu_setup_6xx.S
cpu_setup_44x.S
cpu_setup_fsl_booke.S
cpu_setup_pa6t.S
cpu_setup_power.S powerpc/64s: Clear PCR on boot 2018-05-30 07:51:49 +02:00
cpu_setup_ppc970.S
cputable.c powerpc/8xx: Use symbolic PVR value 2017-08-10 23:32:18 +10:00
crash.c powerpc/fadump: remove dependency with CONFIG_KEXEC 2017-05-08 17:15:11 -07:00
crash_dump.c
dbell.c powerpc: Introduce msgsnd/doorbell barrier primitives 2017-04-13 23:34:33 +10:00
dma-iommu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dma-swiotlb.c
dma.c powerpc: merge __dma_set_mask into dma_set_mask 2017-06-28 06:54:55 -07:00
dt_cpu_ftrs.c powerpc/64s: Clear PCR on boot 2018-05-30 07:51:49 +02:00
eeh.c powerpc/eeh: Fix possible null deref in eeh_dump_dev_log() 2018-11-21 09:24:03 +01:00
eeh_cache.c
eeh_dev.c powerpc/eeh: Create PHB PEs after EEH is initialized 2017-09-21 14:56:00 +10:00
eeh_driver.c powerpc/eeh: Fix use-after-release of EEH driver 2018-08-03 07:50:24 +02:00
eeh_event.c
eeh_pe.c powerpc/eeh: Fix enabling bridge MMIO windows 2018-04-24 09:36:37 +02:00
eeh_sysfs.c powerpc/eeh: Remove unnecessary config_addr from eeh_dev 2017-08-31 14:26:09 +10:00
entry_32.S powerpc/fsl: Sanitize the syscall table for NXP PowerPC 32 bit platforms 2019-04-03 06:25:13 +02:00
entry_64.S powerpc/fsl: Flush the branch predictor at each kernel entry (64bit) 2019-04-03 06:25:14 +02:00
epapr_hcalls.S
epapr_paravirt.c
exceptions-64e.S powerpc/fsl: Fix the flush of branch predictor. 2019-04-03 06:25:15 +02:00
exceptions-64s.S powerpc/64s: Make rfi_flush_fallback a little more robust 2018-09-15 09:45:32 +02:00
fadump.c powerpc/fadump: Do not allow hot-remove memory from fadump reserved area. 2019-02-12 19:46:07 +01:00
firmware.c
fpu.S
fsl_booke_entry_mapping.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_8xx.S powerpc/8xx: fix invalid register expression in head_8xx.S 2018-08-03 07:50:31 +02:00
head_32.S powerpc: Fix DABR match on hash based systems 2018-02-22 15:42:17 +01:00
head_40x.S
head_44x.S
head_64.S powerpc/64: Fix booting large kernels with STRICT_KERNEL_RWX 2019-05-31 06:47:25 -07:00
head_booke.h powerpc/fsl: Fixed warning: orphan section `__btb_flush_fixup' 2019-04-03 06:25:15 +02:00
head_fsl_booke.S powerpc/fsl: Flush the branch predictor at each kernel entry (32 bit) 2019-04-03 06:25:14 +02:00
hw_breakpoint.c powerpc/ptrace: Fix enforcement of DAWR constraints 2018-07-03 11:24:50 +02:00
idle.c
idle_6xx.S
idle_book3e.S
idle_book3s.S powerpc/powernv/idle: Restore IAMR after idle 2019-05-16 19:42:35 +02:00
idle_e500.S
idle_power4.S
ima_kexec.c
io-workarounds.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
io.c
iomap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iommu.c powerpc/iommu: Use permission-specific DEVICE_ATTR variants 2017-09-01 16:42:54 +10:00
irq.c powerpc/64s: Fix lost pending interrupt due to race causing lost update to irq_happened 2018-04-08 14:26:27 +02:00
isa-bridge.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
jump_label.c
kexec_elf_64.c
kgdb.c powerpc/8xx: Getting rid of remaining use of CONFIG_8xx 2017-08-10 23:32:12 +10:00
kprobes-ftrace.c powerpc/jprobes: Disable preemption when triggered through ftrace 2017-12-10 13:40:43 +01:00
kprobes.c powerpc/kprobes: Fix call trace due to incorrect preempt count 2018-04-24 09:36:28 +02:00
kvm.c kmemleak: powerpc: skip scanning holes in the .bss section 2019-05-08 07:20:50 +02:00
kvm_emul.S
l2cr_6xx.S powerpc/l2cr_6xx: Fix invalid use of register expressions 2017-08-15 21:04:32 +10:00
legacy_serial.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
machine_kexec.c powerpc/kdump: Handle crashkernel memory reservation failure 2018-10-03 17:00:48 -07:00
machine_kexec_32.c
machine_kexec_64.c
machine_kexec_file_64.c powerpc/kexec_file: Fix error code when trying to load kdump kernel 2018-04-24 09:36:28 +02:00
Makefile powerpc/64: Add CONFIG_PPC_BARRIER_NOSPEC 2019-04-03 06:25:12 +02:00
mce.c powerpc/mce: Move 64-bit machine check code into mce.c 2017-08-10 23:31:31 +10:00
mce_power.c powerpc: Fix workaround for spurious MCE on POWER9 2017-09-29 14:19:44 +10:00
misc.S
misc_32.S powerpc/40x: Clear MSR_DR in one insn instead of two 2017-06-02 19:20:43 +10:00
misc_64.S powerpc/kexec: Fix kexec/kdump in P9 guest kernels 2017-12-05 11:26:31 +01:00
module.c powerpc/64: Add CONFIG_PPC_BARRIER_NOSPEC 2019-04-03 06:25:12 +02:00
module_32.c
module_64.c powerpc/64/module: REL32 relocation range check 2018-11-21 09:24:02 +01:00
msi.c powerpc/msi: Fix NULL pointer access in teardown code 2018-12-21 14:13:06 +01:00
nvram_64.c pstore: Convert buf_lock to semaphore 2019-06-11 12:21:48 +02:00
of_platform.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
optprobes.c powerpc/kprobes: Disable preemption before invoking probe handler for optprobes 2017-12-10 13:40:43 +01:00
optprobes_head.S powerpc/kprobes: Don't save/restore DAR/DSISR to/from pt_regs for optprobes 2017-08-24 16:19:01 +10:00
paca.c treewide: make "nr_cpu_ids" unsigned 2017-09-08 18:26:48 -07:00
pci-common.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
pci-hotplug.c
pci_32.c powerpc/32: Add a missing include header 2018-08-03 07:50:30 +02:00
pci_64.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
pci_dn.c powerpc/pci: Remove OF node back pointer from pci_dn 2017-08-31 14:26:12 +10:00
pci_of_scan.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
pmc.c
ppc32.h
ppc_save_regs.S
proc_powerpc.c
process.c powerpc: Fix 32-bit KVM-PR lockup and host crash with MacOS guest 2019-03-23 14:35:27 +01:00
prom.c powerpc: Fix booting P9 hash with CONFIG_PPC_RADIX_MMU=N 2017-05-25 23:07:44 +10:00
prom_init.c powerpc: Add __printf verification to prom_printf 2018-08-03 07:50:30 +02:00
prom_init_check.sh
prom_parse.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ptrace.c powerpc/ptrace: Simplify vr_get/set() to avoid GCC warning 2019-03-23 14:35:27 +01:00
ptrace32.c
reloc_32.S
reloc_64.S powerpc/asm: Convert .llong directives to .8byte 2017-08-31 14:26:47 +10:00
rtas-proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rtas-rtc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rtas.c mm: treewide: remove GFP_TEMPORARY allocation flag 2017-09-13 18:53:16 -07:00
rtas_flash.c
rtas_pci.c powerpc/kernel: Change retrieval of pci_dn 2017-08-31 14:26:40 +10:00
rtasd.c powerpc/pseries: Remove prrn_work workqueue 2019-04-20 09:15:04 +02:00
security.c powerpc/64s: Include cpu header 2019-05-16 19:42:33 +02:00
setup-common.c powerpc/fsl: Enable runtime patching if nospectre_v2 boot arg is used 2019-04-03 06:25:14 +02:00
setup.h
setup_32.c powerpc/32: remove a NOP from memset() 2017-09-01 16:42:46 +10:00
setup_64.c powerpc/speculation: Support 'mitigations=' cmdline option 2019-05-14 19:18:46 +02:00
signal.c powerpc/signal: Properly handle return value from uprobe_deny_signal() 2017-11-30 08:40:56 +00:00
signal.h
signal_32.c powerpc/tm: Set MSR[TS] just prior to recheckpoint 2019-01-13 10:01:06 +01:00
signal_64.c powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM 2019-04-17 08:37:43 +02:00
smp-tbsync.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
smp.c powerpc/smp: Add Power9 scheduler topology 2017-08-31 18:16:08 +10:00
stacktrace.c powerpc: Make /proc/self/stack always print the current stack 2017-03-28 14:43:59 +11:00
suspend.c
swsusp.c powerpc/swsusp: Include suspend.h to silence sparse warnings 2017-03-20 19:02:49 +11:00
swsusp_32.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
swsusp_64.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/nmi.h> 2017-03-02 08:42:30 +01:00
swsusp_asm64.S powerpc: Fix invalid use of register expressions 2017-08-10 22:29:41 +10:00
swsusp_booke.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sys_ppc32.c
syscalls.c powerpc/tracing: Allow tracing of mmap syscalls 2017-04-12 22:32:43 +10:00
sysfs.c powerpc/sysfs: Move #ifdef CONFIG_HOTPLUG_CPU out of the function body 2017-05-03 14:45:38 +10:00
systbl.S powerpc/asm: Convert .llong directives to .8byte 2017-08-31 14:26:47 +10:00
systbl_chk.c
systbl_chk.sh
tau_6xx.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
time.c powerpc: use spin loop primitives in some functions 2017-07-02 20:40:24 +10:00
tm.S powerpc/tm: Avoid possible userspace r1 corruption on reclaim 2018-10-20 09:48:52 +02:00
traps.c powerpc/traps: Fix the message printed when stack overflows 2019-03-23 14:35:27 +01:00
udbg.c
udbg_16550.c
uprobes.c powerpc/uprobes: Implement arch_uretprobe_is_alive() 2017-08-24 16:19:21 +10:00
vdso.c
vecemu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vector.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmlinux.lds.S powerpc/fsl: Add infrastructure to fixup branch predictor flush 2019-04-03 06:25:13 +02:00
watchdog.c powerpc/watchdog: Do not trigger SMP crash from touch_nmi_watchdog 2017-12-25 14:26:28 +01:00