Commit d10f60ae authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman
Browse files

powerpc/32s: fix allow/prevent_user_access() when crossing segment boundaries.



Make sure starting addr is aligned to segment boundary so that when
incrementing the segment, the starting address of the new segment is
below the end address. Otherwise the last segment might get  missed.

Fixes: a68c31fc ("powerpc/32s: Implement Kernel Userspace Access Protection")
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/067a1b09f15f421d40797c2d04c22d4049a1cee8.1571071875.git.christophe.leroy@c-s.fr
parent 2272905a
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -91,6 +91,7 @@


static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)
static inline void kuap_update_sr(u32 sr, u32 addr, u32 end)
{
{
	addr &= 0xf0000000;	/* align addr to start of segment */
	barrier();	/* make sure thread.kuap is updated before playing with SRs */
	barrier();	/* make sure thread.kuap is updated before playing with SRs */
	while (addr < end) {
	while (addr < end) {
		mtsrin(sr, addr);
		mtsrin(sr, addr);