All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/uapi: Fix sigcontext definition to use user_pt_regs
@ 2018-10-15 12:01 Michael Ellerman
  2018-10-15 12:01 ` [PATCH 2/2] powerpc/aout: Fix struct user " Michael Ellerman
  2018-10-22  9:38 ` [1/2] powerpc/uapi: Fix sigcontext " Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-10-15 12:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: maddy

My recent patch to split pt_regs between user and kernel missed
the usage in struct sigcontext.

Because this is a user visible struct it should be using the user
visible definition, which when we're building for the kernel is called
struct user_pt_regs.

As far as I can see this hasn't actually caused a bug (yet), because
we don't use the sizeof() the sigcontext->regs anywhere. But we should
still fix it to avoid confusion and future bugs.

Fixes: 002af9391bfb ("powerpc: Split user/kernel definitions of struct pt_regs")
Reported-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/uapi/asm/sigcontext.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/uapi/asm/sigcontext.h b/arch/powerpc/include/uapi/asm/sigcontext.h
index 2fbe485acdb4..630aeda56d59 100644
--- a/arch/powerpc/include/uapi/asm/sigcontext.h
+++ b/arch/powerpc/include/uapi/asm/sigcontext.h
@@ -22,7 +22,11 @@ struct sigcontext {
 #endif
 	unsigned long	handler;
 	unsigned long	oldmask;
-	struct pt_regs	__user *regs;
+#ifdef __KERNEL__
+	struct user_pt_regs __user *regs;
+#else
+	struct pt_regs	*regs;
+#endif
 #ifdef __powerpc64__
 	elf_gregset_t	gp_regs;
 	elf_fpregset_t	fp_regs;
-- 
2.17.1


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

* [PATCH 2/2] powerpc/aout: Fix struct user definition to use user_pt_regs
  2018-10-15 12:01 [PATCH 1/2] powerpc/uapi: Fix sigcontext definition to use user_pt_regs Michael Ellerman
@ 2018-10-15 12:01 ` Michael Ellerman
  2018-10-22  9:38 ` [1/2] powerpc/uapi: Fix sigcontext " Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-10-15 12:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: maddy

I'm pretty sure this is dead code, it's only used by the a.out core
dump code, and we don't support a.out. We should remove it.

But while it's in the tree it should be using the ABI version of
pt_regs which is called user_pt_regs in the kernel, because the whole
struct is written to the core dump and so its size shouldn't change.

Note this isn't a uapi header so we don't need an ifdef.

Fixes: 002af9391bfb ("powerpc: Split user/kernel definitions of struct pt_regs")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/user.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/user.h b/arch/powerpc/include/asm/user.h
index 5c0e082eae7b..99443b8594e7 100644
--- a/arch/powerpc/include/asm/user.h
+++ b/arch/powerpc/include/asm/user.h
@@ -31,7 +31,7 @@
  *	to write an integer number of pages.
  */
 struct user {
-	struct pt_regs	regs;			/* entire machine state */
+	struct user_pt_regs regs;		/* entire machine state */
 	size_t		u_tsize;		/* text size (pages) */
 	size_t		u_dsize;		/* data size (pages) */
 	size_t		u_ssize;		/* stack size (pages) */
-- 
2.17.1


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

* Re: [1/2] powerpc/uapi: Fix sigcontext definition to use user_pt_regs
  2018-10-15 12:01 [PATCH 1/2] powerpc/uapi: Fix sigcontext definition to use user_pt_regs Michael Ellerman
  2018-10-15 12:01 ` [PATCH 2/2] powerpc/aout: Fix struct user " Michael Ellerman
@ 2018-10-22  9:38 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2018-10-22  9:38 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: maddy

On Mon, 2018-10-15 at 12:01:42 UTC, Michael Ellerman wrote:
> My recent patch to split pt_regs between user and kernel missed
> the usage in struct sigcontext.
> 
> Because this is a user visible struct it should be using the user
> visible definition, which when we're building for the kernel is called
> struct user_pt_regs.
> 
> As far as I can see this hasn't actually caused a bug (yet), because
> we don't use the sizeof() the sigcontext->regs anywhere. But we should
> still fix it to avoid confusion and future bugs.
> 
> Fixes: 002af9391bfb ("powerpc: Split user/kernel definitions of struct pt_regs")
> Reported-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Series applied to powerpc next.

https://git.kernel.org/powerpc/c/22a3d03d69dfd3bfc606d199696982

cheers

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

end of thread, other threads:[~2018-10-22 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 12:01 [PATCH 1/2] powerpc/uapi: Fix sigcontext definition to use user_pt_regs Michael Ellerman
2018-10-15 12:01 ` [PATCH 2/2] powerpc/aout: Fix struct user " Michael Ellerman
2018-10-22  9:38 ` [1/2] powerpc/uapi: Fix sigcontext " Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.