um: Fix check for _xstate for older hosts
Subsystems (2)
PATCH 1/1 um: Fix check for _xstate for older hosts
Commit 0a987645672e ("um: Allow building and running on older hosts") attempted to check for PTRACE_{GET,SET}REGSET under the premise that these ptrace(2) parameters were directly linked with the presence of the _xstate structure.
After Richard's commit 61e8d462457f ("um: Correctly check for PTRACE_GETRESET/SETREGSET") which properly included linux/ptrace.h instead of asm/ptrace.h, we could get into the original build failure that I reported:
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'
On this particular host, we do have PTRACE_GETREGSET and PTRACE_SETREGSET defined in linux/ptrace.h, but not the structure _xstate that should be pulled from the following include chain: signal.h -> bits/sigcontext.h.
Correctly fix this by checking for FP_XSTATE_MAGIC1 which is the correct way to see if struct _xstate is available or not on the host.
--- arch/x86/um/user-offsets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/um/user-offsets.c +1 -1
@@ -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 ));
Signature · 1 line
2.9.3
Richard Weinberger
AppliedQuoted 43 lines · Florian Fainelli
Commit
0a987645672e("um: Allow building and running on older hosts") attempted to check for PTRACE_{GET,SET}REGSET under the premise that these ptrace(2) parameters were directly linked with the presence of the_xstatestructure.After Richard's commit
61e8d462457f("um: Correctly check for PTRACE_GETRESET/SETREGSET") which properly includedlinux/ptrace.hinstead ofasm/ptrace.h, we could get into the original build failure that I reported:
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'On this particular host, we do have
PTRACE_GETREGSETandPTRACE_SETREGSETdefined inlinux/ptrace.h, but not the structure_xstatethat should be pulled from the following include chain:signal.h->bits/sigcontext.h.Correctly fix this by checking for
FP_XSTATE_MAGIC1which is the correct way to see if struct_xstateis available or not on the host.Fixes 61e8d462457f ("um: Correctly check for PTRACE_GETRESET/SETREGSET")Fixes 0a987645672e ("um: Allow building and running on older hosts")Signed-off-by Florian Fainelli <[email protected]>--- arch/x86/um/user-offsets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/um/user-offsets.c +1
-2@@ -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 )); --
Quoted 2 lines
2.9.3
Applied, thanks for fixing!
Signature · 2 lines
Thanks, //richard
Quoted 40 lines · Richard Weinberger
Quoted 39 lines · Florian Fainelli
Commit
0a987645672e("um: Allow building and running on older hosts") attempted to check for PTRACE_{GET,SET}REGSET under the premise that these ptrace(2) parameters were directly linked with the presence of the_xstatestructure.After Richard's commit
61e8d462457f("um: Correctly check for PTRACE_GETRESET/SETREGSET") which properly includedlinux/ptrace.hinstead ofasm/ptrace.h, we could get into the original build failure that I reported:
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'On this particular host, we do have
PTRACE_GETREGSETandPTRACE_SETREGSETdefined inlinux/ptrace.h, but not the structure_xstatethat should be pulled from the following include chain:signal.h->bits/sigcontext.h.Correctly fix this by checking for
FP_XSTATE_MAGIC1which is the correct way to see if struct_xstateis available or not on the host.Fixes 61e8d462457f ("um: Correctly check for PTRACE_GETRESET/SETREGSET")Fixes 0a987645672e ("um: Allow building and running on older hosts")Signed-off-by Florian Fainelli <[email protected]>--- arch/x86/um/user-offsets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/um/user-offsets.c +1
-1@@ -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
Quoted 8 lines
Quoted 6 lines
arch/x86/um/user-offsets.c +0
-1DEFINE (HOST_FP_SIZE ,sizeof (struct _xstate ) /sizeof (unsigned long ));#else DEFINE (HOST_FP_SIZE ,sizeof (struct _fpstate ) /sizeof (unsigned long )); --2.9.3
Applied, thanks for fixing!
Can you submit this to Linus before v4.13 is released? Thank you!
Signature · 1 line
Florian
Am Freitag, 18. August 2017, 23:40:36 CEST schrieb Florian Fainelli:
Quoted 2 lines · Richard Weinberger
Quoted 1 line
On Wed, Jul 19, 2017 at 1:43 AM, Florian Fainelli <[email protected]>
Quoted 52 lines · wrote:
Quoted 52 lines
Quoted 52 lines
Commit
0a987645672e("um: Allow building and running on older hosts") attempted to check for PTRACE_{GET,SET}REGSET under the premise that these ptrace(2) parameters were directly linked with the presence of the_xstatestructure.After Richard's commit
61e8d462457f("um: Correctly check for PTRACE_GETRESET/SETREGSET") which properly includedlinux/ptrace.hinstead ofasm/ptrace.h, we could get into the original build failure that I reported:
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'On this particular host, we do have
PTRACE_GETREGSETandPTRACE_SETREGSETdefined inlinux/ptrace.h, but not the structure_xstatethat should be pulled from the following include chain:signal.h->bits/sigcontext.h.Correctly fix this by checking for
FP_XSTATE_MAGIC1which is the correct way to see if struct_xstateis available or not on the host.Fixes 61e8d462457f ("um: Correctly check for PTRACE_GETRESET/SETREGSET")Fixes 0a987645672e ("um: Allow building and running on older hosts")Signed-off-by Florian Fainelli <[email protected]>---
arch/x86/um/user-offsets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/um/user-offsets.c +1
-1@@ -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));
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
--
2.9.3Applied, thanks for fixing!
Can you submit this to Linus before v4.13 is released? Thank you!
Sure. The UML queue is just a bit slow, sorry for that.
Thanks,
//richard
Signature · 2 lines
sigma star gmbh - Eduard-Bodem-Gasse 6 - 6020 Innsbruck - Austria ATU66964118 - FN 374287y