powerpc/64s/kuap: Add missing isync to KUAP restore paths
authorNicholas Piggin <npiggin@gmail.com>
Wed, 29 Apr 2020 06:56:50 +0000 (16:56 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:49:00 +0000 (17:49 +0200)
commite993b8a59cc284caebf8dc281182dc6b642315ba
tree286bd5e09c4f8fd728100b05fead52a50ccd64ac
parent295c688d4f4adb624ad3dde731e9f135aaa55f18
powerpc/64s/kuap: Add missing isync to KUAP restore paths

[ Upstream commit cb2b53cbffe3c388cd676b63f34e54ceb2643ae2 ]

Writing the AMR register is documented to require context
synchronizing operations before and after, for it to take effect as
expected. The KUAP restore at interrupt exit time deliberately avoids
the isync after the AMR update because it only needs to take effect
after the context synchronizing RFID that soon follows. Add a comment
for this.

The missing isync before the update doesn't have an obvious
justification, and seems it could theoretically allow a rogue user
access to leak past the AMR update. Add isyncs for these.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200429065654.1677541-3-npiggin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/include/asm/book3s/64/kup-radix.h