linux/arch/powerpc/include/asm
Christophe Leroy d93f9e2374 powerpc/32s: Fix kuap_kernel_restore()
At interrupt exit, kuap_kernel_restore() calls kuap_unlock() with the
value contained in regs->kuap. However, when regs->kuap contains
0xffffffff it means that KUAP was not unlocked so calling kuap_unlock()
is unrelevant and results in jeopardising the contents of kernel space
segment registers.

So check that regs->kuap doesn't contain KUAP_NONE before calling
kuap_unlock(). In the meantime it also means that if KUAP has not
been correcly locked back at interrupt exit, it must be locked
before continuing. This is done by checking the content of
current->thread.kuap which was returned by kuap_get_and_assert_locked()

Fixes: 16132529ce ("powerpc/32s: Rework Kernel Userspace Access Protection")
Reported-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/0d0c4d0f050a637052287c09ba521bad960a2790.1631715131.git.christophe.leroy@csgroup.eu
2021-10-07 23:34:00 +11:00
..
book3s powerpc/32s: Fix kuap_kernel_restore() 2021-10-07 23:34:00 +11:00
nohash
vdso powerpc: Redefine HMT_xxx macros as empty on PPC32 2021-08-27 00:56:52 +10:00
8xx_immap.h
Kbuild
accounting.h
agp.h
archrandom.h
asm-compat.h powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros 2021-08-25 13:35:49 +10:00
asm-const.h powerpc: remove GCC version check for UPD_CONSTR 2021-09-13 10:18:28 -07:00
asm-offsets.h
asm-prototypes.h
async_tx.h
atomic.h powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros 2021-08-25 13:35:49 +10:00
backlight.h
barrier.h
bitops.h powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros 2021-08-25 13:35:49 +10:00
bootx.h
btext.h
bug.h powerpc/bug: Cast to unsigned long before passing to inline asm 2021-09-01 21:25:43 +10:00
bugs.h
cache.h
cacheflush.h
cell-pmu.h
cell-regs.h
checksum.h
clocksource.h
cmpxchg.h
code-patching-asm.h
code-patching.h powerpc/lib: Add helper to check if offset is within conditional branch range 2021-10-07 18:52:33 +11:00
compat.h arch: remove compat_alloc_user_space 2021-09-08 15:32:35 -07:00
context_tracking.h
copro.h
cpm.h
cpm1.h
cpm2.h
cpu_has_feature.h
cpu_setup_power.h
cpufeature.h
cpuidle.h
cputable.h
cputhreads.h
cputime.h
crashdump-ppc64.h
current.h
dbdma.h
dbell.h
dcr-generic.h
dcr-mmio.h
dcr-native.h
dcr-regs.h
dcr.h
debug.h
delay.h
device.h
disassemble.h
dma-direct.h
dma.h
drmem.h pseries/drmem: update LMBs after LPM 2021-08-10 23:14:55 +10:00
dt_cpu_ftrs.h
dtl.h
edac.h
eeh.h
eeh_event.h
ehv_pic.h
elf.h
elfnote.h
emergency-restart.h
emulated_ops.h
epapr_hcalls.h
exception-64e.h
exception-64s.h
exec.h
extable.h powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto 2021-08-15 13:49:24 +10:00
fadump-internal.h
fadump.h
fb.h
feature-fixups.h
firmware.h powerpc/pseries: Add support for FORM2 associativity 2021-08-13 22:04:27 +10:00
fixmap.h
floppy.h
fs_pd.h
fsl_85xx_cache_sram.h
fsl_gtm.h
fsl_hcalls.h
fsl_lbc.h
fsl_pamu_stash.h
fsl_pm.h
ftrace.h
futex.h
grackle.h
hardirq.h
head-64.h
heathrow.h
highmem.h
hmi.h
hugetlb.h
hvcall.h
hvconsole.h
hvcserver.h
hvsi.h
hw_breakpoint.h
hw_irq.h
hydra.h
i8259.h
ibmebus.h
icswx.h
ide.h
idle.h
imc-pmu.h
immap_cpm2.h
inst.h
interrupt.h powerpc/64s: Fix unrecoverable MCE calling async handler from NMI 2021-10-07 19:54:55 +11:00
io-defs.h
io-workarounds.h
io.h
io_event_irq.h
iommu.h powerpc/kernel/iommu: Add new iommu_table_in_use() helper 2021-08-27 00:56:54 +10:00
ipic.h
irq.h powerpc/interrupt: Fix OOPS by not calling do_IRQ() from timer_interrupt() 2021-08-12 22:21:57 +10:00
irq_work.h
irqflags.h
isa-bridge.h
jump_label.h
kasan.h
kdebug.h
kdump.h
kexec.h
kexec_ranges.h
keylargo.h
kfence.h
kgdb.h
kprobes.h
kup.h
kvm_asm.h
kvm_book3s.h
kvm_book3s_32.h
kvm_book3s_64.h KVM: PPC: Book3S HV Nested: Make nested HFSCR state accessible 2021-08-25 16:37:18 +10:00
kvm_book3s_asm.h
kvm_book3s_uvmem.h
kvm_booke.h
kvm_booke_hv_asm.h
kvm_fpu.h
kvm_guest.h
kvm_host.h ARM: 2021-09-07 13:40:51 -07:00
kvm_para.h
kvm_ppc.h KVM: PPC: Book3S HV: XIVE: Change interface of passthrough interrupt routines 2021-08-10 23:14:59 +10:00
libata-portmap.h
linkage.h
livepatch.h
local.h
lppaca.h
lv1call.h
machdep.h
macio.h
mc146818rtc.h
mce.h
mediabay.h
mem_encrypt.h
membarrier.h powerpc/non-smp: Unconditionaly call smp_mb() on switch_mm 2021-08-10 23:14:55 +10:00
mman.h
mmiowb.h
mmu.h powerpc: Always inline radix_enabled() to fix build failure 2021-08-10 23:14:56 +10:00
mmu_context.h
mmzone.h
module.h
module.lds.h
mpc5xxx.h
mpc6xx.h
mpc52xx.h
mpc52xx_psc.h
mpc85xx.h
mpc5121.h
mpc8260.h
mpic.h
mpic_msgr.h
mpic_timer.h
msi_bitmap.h
nmi.h
nvram.h
ohare.h
opal-api.h
opal.h
paca.h
page.h
page_32.h
page_64.h
paravirt.h
parport.h
pasemi_dma.h
pci-bridge.h powerpc/pseries/pci: Add MSI domains 2021-08-10 23:14:57 +10:00
pci.h
percpu.h
perf_event.h
perf_event_fsl_emb.h
perf_event_server.h
pgalloc.h
pgtable-be-types.h
pgtable-types.h
pgtable.h
pkeys.h
plpar_wrappers.h
pmac_feature.h
pmac_low_i2c.h
pmac_pfunc.h
pmc.h KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live 2021-08-25 16:37:18 +10:00
pmi.h
pnv-ocxl.h
pnv-pci.h powerpc/powernv/pci: Rework pnv_opal_pci_msi_eoi() 2021-08-10 23:15:01 +10:00
powernv.h
ppc-opcode.h powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros 2021-08-25 13:35:49 +10:00
ppc-pci.h
ppc4xx.h
ppc_asm.h powerpc/booke: Avoid link stack corruption in several places 2021-08-25 13:35:47 +10:00
probes.h
processor.h
prom.h powerpc/pseries: Add support for FORM2 associativity 2021-08-13 22:04:27 +10:00
ps3.h
ps3av.h
ps3gpu.h
ps3stor.h
pte-walk.h
ptrace.h Merge branch 'fixes' into next 2021-09-03 22:54:12 +10:00
qspinlock.h
qspinlock_paravirt.h
reg.h KVM: PPC: Book3S HV Nested: Fix TM softpatch HFAC interrupt emulation 2021-08-25 16:37:17 +10:00
reg_8xx.h
reg_a2.h
reg_booke.h
reg_fsl_emb.h
rheap.h
rio.h
rtas-types.h
rtas.h
runlatch.h
seccomp.h
sections.h powerpc: Remove in_kernel_text() 2021-08-10 23:14:55 +10:00
secure_boot.h
security_features.h powerpc/security: Add a helper to query stf_barrier type 2021-10-07 19:52:58 +11:00
secvar.h
serial.h
set_memory.h
setjmp.h
setup.h
sfp-machine.h
shmparam.h
signal.h
simple_spinlock.h powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros 2021-08-25 13:35:49 +10:00
simple_spinlock_types.h
slice.h
smp.h powerpc/smp: Use existing L2 cache_map cpumask to find L3 cache siblings 2021-08-04 10:53:39 +10:00
smu.h
sparsemem.h
spinlock.h
spinlock_types.h
spu.h
spu_csa.h
spu_info.h
spu_priv1.h
sstep.h
stackprotector.h
stacktrace.h
string.h
svm.h
swab.h
swiotlb.h
switch_to.h
synch.h
syscall.h powerpc/audit: Simplify syscall_get_arch() 2021-08-20 22:38:13 +10:00
syscalls.h powerpc/compat_sys: Declare syscalls 2021-08-23 19:28:21 +10:00
task_size_32.h
task_size_64.h
tce.h powerpc/pseries/iommu: Replace hard-coded page shift 2021-08-27 00:56:54 +10:00
termios.h
thread_info.h
time.h
timex.h
tlb.h mm/mremap: allow arch runtime override 2021-07-08 11:48:23 -07:00
tlbflush.h
tm.h
topology.h powerpc/numa: Update cpu_cpu_map on CPU online/offline 2021-08-27 00:56:54 +10:00
trace.h
trace_clock.h
tsi108.h
tsi108_irq.h
tsi108_pci.h
types.h
uaccess.h
udbg.h
uic.h
ultravisor-api.h
ultravisor.h
uninorth.h
unistd.h powerpc/syscalls: Remove __NR__exit 2021-08-23 19:28:20 +10:00
uprobes.h
user.h
vas.h
vdso.h
vdso_datapage.h
vermagic.h
vga.h
vio.h
vmalloc.h
word-at-a-time.h
xics.h powerpc/xics: Rename the map handler in a check handler 2021-08-10 23:14:59 +10:00
xive-regs.h KVM: PPC: Book3S HV: XIVE: Add support for automatic save-restore 2021-08-10 23:15:02 +10:00
xive.h KVM: PPC: Book3S HV: XIVE: Add support for automatic save-restore 2021-08-10 23:15:02 +10:00
xmon.h
xor.h
xor_altivec.h