arm64: fix SSBS sanitization
authorMark Rutland <mark.rutland@arm.com>
Fri, 15 Feb 2019 16:34:27 +0000 (16:34 +0000)
committerWill Deacon <will.deacon@arm.com>
Mon, 18 Feb 2019 10:54:47 +0000 (10:54 +0000)
commitf54dada8274643e3ff4436df0ea124aeedc43cae
treee961c2e2c6c983925f2508b3b8c07e0797c00cda
parenta3b22b9f11d9fbc48b0291ea92259a5a810e9438
arm64: fix SSBS sanitization

In valid_user_regs() we treat SSBS as a RES0 bit, and consequently it is
unexpectedly cleared when we restore a sigframe or fiddle with GPRs via
ptrace.

This patch fixes valid_user_regs() to account for this, updating the
function to refer to the latest ARM ARM (ARM DDI 0487D.a). For AArch32
tasks, SSBS appears in bit 23 of SPSR_EL1, matching its position in the
AArch32-native PSR format, and we don't need to translate it as we have
to for DIT.

There are no other bit assignments that we need to account for today.
As the recent documentation describes the DIT bit, we can drop our
comment regarding DIT.

While removing SSBS from the RES0 masks, existing inconsistent
whitespace is corrected.

Fixes: d71be2b6c0e19180 ("arm64: cpufeature: Detect SSBS and advertise to userspace")
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/ptrace.c