]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: mm: Set PSTATE.PAN from the cpu_enable_pan() call
authorJames Morse <james.morse@arm.com>
Tue, 18 Oct 2016 10:27:47 +0000 (11:27 +0100)
committerWill Deacon <will.deacon@arm.com>
Thu, 20 Oct 2016 08:50:53 +0000 (09:50 +0100)
commit7209c868600bd8926e37c10b9aae83124ccc1dd8
tree39995a8ef78a77bd77b9897da57c5b81aeba27f4
parent2a6dcb2b5f3e21592ca8dfa198dcce7bec09b020
arm64: mm: Set PSTATE.PAN from the cpu_enable_pan() call

Commit 338d4f49d6f7 ("arm64: kernel: Add support for Privileged Access
Never") enabled PAN by enabling the 'SPAN' feature-bit in SCTLR_EL1.
This means the PSTATE.PAN bit won't be set until the next return to the
kernel from userspace. On a preemptible kernel we may schedule work that
accesses userspace on a CPU before it has done this.

Now that cpufeature enable() calls are scheduled via stop_machine(), we
can set PSTATE.PAN from the cpu_enable_pan() call.

Add WARN_ON_ONCE(in_interrupt()) to check the PSTATE value we updated
is not immediately discarded.

Reported-by: Tony Thompson <anthony.thompson@arm.com>
Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
[will: fixed typo in comment]
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/mm/fault.c