linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/32s: fix allow/prevent_user_access() when crossing segment boundaries.
@ 2019-10-14 16:51 Christophe Leroy
  2019-10-20  9:09 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2019-10-14 16:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

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: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/book3s/32/kup.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/include/asm/book3s/32/kup.h b/arch/powerpc/include/asm/book3s/32/kup.h
index 677e9babef80..f9dc597b0b86 100644
--- a/arch/powerpc/include/asm/book3s/32/kup.h
+++ b/arch/powerpc/include/asm/book3s/32/kup.h
@@ -91,6 +91,7 @@
 
 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 */
 	while (addr < end) {
 		mtsrin(sr, addr);
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/32s: fix allow/prevent_user_access() when crossing segment boundaries.
  2019-10-14 16:51 [PATCH] powerpc/32s: fix allow/prevent_user_access() when crossing segment boundaries Christophe Leroy
@ 2019-10-20  9:09 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2019-10-20  9:09 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

On Mon, 2019-10-14 at 16:51:28 UTC, Christophe Leroy wrote:
> 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: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/d10f60ae27d26d811e2a1bb39ded47df96d7499f

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-20  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 16:51 [PATCH] powerpc/32s: fix allow/prevent_user_access() when crossing segment boundaries Christophe Leroy
2019-10-20  9:09 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).