From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752691AbdGRWq7 (ORCPT ); Tue, 18 Jul 2017 18:46:59 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:33109 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752328AbdGRWq6 (ORCPT ); Tue, 18 Jul 2017 18:46:58 -0400 Subject: Re: [PATCH] um: Correctly check for PTRACE_GETRESET/SETREGSET To: Richard Weinberger , user-mode-linux-devel@lists.sourceforge.net Cc: Jeff Dike , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, user-mode-linux-user@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20170706073527.12006-1-richard@nod.at> From: Florian Fainelli Message-ID: <32e2ec7f-3a3b-c53c-6bba-66ead72b0e78@gmail.com> Date: Tue, 18 Jul 2017 15:46:54 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170706073527.12006-1-richard@nod.at> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Richard Weinberger 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 > #include > #define __FRAME_OFFSETS > -#include > +#include > #include > > #ifdef __i386__ > -- Florian