linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] um: Correctly check for PTRACE_GETRESET/SETREGSET
@ 2017-07-06  7:35 Richard Weinberger
  2017-07-07  9:34 ` Richard Weinberger
  2017-07-18 22:46 ` Florian Fainelli
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Weinberger @ 2017-07-06  7:35 UTC (permalink / raw)
  To: user-mode-linux-devel
  Cc: Richard Weinberger, Florian Fainelli, Jeff Dike, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, user-mode-linux-user,
	linux-kernel

When checking for PTRACE_GETRESET/SETREGSET, make sure that
the correct header file is included. We need linux/ptrace.h
which contains all ptrace UAPI related defines.
Otherwise #if defined(PTRACE_GETRESET) is always false.

Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 arch/x86/um/user-offsets.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c
index 8af0fb5d2780..ae4cd58c0c7a 100644
--- a/arch/x86/um/user-offsets.c
+++ b/arch/x86/um/user-offsets.c
@@ -5,7 +5,7 @@
 #include <sys/mman.h>
 #include <sys/user.h>
 #define __FRAME_OFFSETS
-#include <asm/ptrace.h>
+#include <linux/ptrace.h>
 #include <asm/types.h>
 
 #ifdef __i386__
-- 
2.12.3

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

* Re: [PATCH] um: Correctly check for PTRACE_GETRESET/SETREGSET
  2017-07-06  7:35 [PATCH] um: Correctly check for PTRACE_GETRESET/SETREGSET Richard Weinberger
@ 2017-07-07  9:34 ` Richard Weinberger
  2017-07-18 22:46 ` Florian Fainelli
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2017-07-07  9:34 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: user-mode-linux-devel@lists.sourceforge.net, Florian Fainelli,
	Jeff Dike, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	x86@kernel.org, user-mode-linux-user@lists.sourceforge.net, LKML

On Thu, Jul 6, 2017 at 9:35 AM, Richard Weinberger <richard@nod.at> wrote:
> When checking for PTRACE_GETRESET/SETREGSET, make sure that
> the correct header file is included. We need linux/ptrace.h
> which contains all ptrace UAPI related defines.
> Otherwise #if defined(PTRACE_GETRESET) is always false.
>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Richard Weinberger <richard@nod.at>

Applied.

-- 
Thanks,
//richard

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

* Re: [PATCH] um: Correctly check for PTRACE_GETRESET/SETREGSET
  2017-07-06  7:35 [PATCH] um: Correctly check for PTRACE_GETRESET/SETREGSET Richard Weinberger
  2017-07-07  9:34 ` Richard Weinberger
@ 2017-07-18 22:46 ` Florian Fainelli
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2017-07-18 22:46 UTC (permalink / raw)
  To: Richard Weinberger, user-mode-linux-devel
  Cc: Jeff Dike, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	user-mode-linux-user, linux-kernel

On 07/06/2017 12:35 AM, Richard Weinberger wrote:
> When checking for PTRACE_GETRESET/SETREGSET, make sure that
> the correct header file is included. We need linux/ptrace.h
> which contains all ptrace UAPI related defines.
> Otherwise #if defined(PTRACE_GETRESET) is always false.
> 
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Richard Weinberger <richard@nod.at>

Ah ah, I see what happened now, because of this invalid include, I was
indeed getting PTRACE_GETREGSET not to be defined, which happened to
solve the build failure I was seeing against 2.6.32. Your fix is
correct, but we actually need a better way to determine whether struct
_xstate is defined or not.

Now that we have this change in place, I can hit the following build
failure (again):

arch/x86/um/user-offsets.c: In function 'foo':
arch/x86/um/user-offsets.c:54: error: invalid application of 'sizeof' to
incomplete type 'struct _xstate'

This is because we have included signal.h which includes
bits/sigcontext.h which does not have a _xstate structure definition.

A possible fix would be:

diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c
index ae4cd58c0c7a..02250b2633b8 100644
--- a/arch/x86/um/user-offsets.c
+++ b/arch/x86/um/user-offsets.c
@@ -50,7 +50,7 @@ void foo(void)
        DEFINE(HOST_GS, GS);
        DEFINE(HOST_ORIG_AX, ORIG_EAX);
 #else
-#if defined(PTRACE_GETREGSET) && defined(PTRACE_SETREGSET)
+#ifdef FP_XSTATE_MAGIC1
        DEFINE(HOST_FP_SIZE, sizeof(struct _xstate) / sizeof(unsigned
long));
 #else
        DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned
long));

I incorrectly linked PTRACE_GETREGSET and PTRACE_SETREGSET with the
introduce of the _xstate...


> ---
>  arch/x86/um/user-offsets.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/um/user-offsets.c b/arch/x86/um/user-offsets.c
> index 8af0fb5d2780..ae4cd58c0c7a 100644
> --- a/arch/x86/um/user-offsets.c
> +++ b/arch/x86/um/user-offsets.c
> @@ -5,7 +5,7 @@
>  #include <sys/mman.h>
>  #include <sys/user.h>
>  #define __FRAME_OFFSETS
> -#include <asm/ptrace.h>
> +#include <linux/ptrace.h>
>  #include <asm/types.h>
>  
>  #ifdef __i386__
> 


-- 
Florian

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

end of thread, other threads:[~2017-07-18 22:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06  7:35 [PATCH] um: Correctly check for PTRACE_GETRESET/SETREGSET Richard Weinberger
2017-07-07  9:34 ` Richard Weinberger
2017-07-18 22:46 ` Florian Fainelli

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).