* [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check
@ 2018-12-08 15:46 Mathieu Malaterre
2019-02-15 8:11 ` Mathieu Malaterre
2019-11-07 3:45 ` Michael Ellerman
0 siblings, 2 replies; 5+ messages in thread
From: Mathieu Malaterre @ 2018-12-08 15:46 UTC (permalink / raw)
To: Michael Ellerman
Cc: Mathieu Malaterre, Oleg Nesterov, linux-kernel, Paul Mackerras,
linuxppc-dev
`pt_regs_check` is a dummy function, its purpose is to break the build
if struct pt_regs and struct user_pt_regs don't match.
This function has no functionnal purpose, and will get eliminated at
link time or after init depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
This commit adds a prototype to fix warning at W=1:
arch/powerpc/kernel/ptrace.c:3339:13: error: no previous prototype for ‘pt_regs_check’ [-Werror=missing-prototypes]
Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Mathieu Malaterre <malat@debian.org>
---
arch/powerpc/kernel/ptrace.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index a398999d0770..341c0060b4c8 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)
user_enter();
}
+void __init pt_regs_check(void);
+/* dummy function, its purpose is to break the build if struct pt_regs and
+ * struct user_pt_regs don't match.
+ */
void __init pt_regs_check(void)
{
BUILD_BUG_ON(offsetof(struct pt_regs, gpr) !=
--
2.19.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check
2018-12-08 15:46 [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check Mathieu Malaterre
@ 2019-02-15 8:11 ` Mathieu Malaterre
2019-02-15 8:21 ` Christophe Leroy
2019-11-07 3:45 ` Michael Ellerman
1 sibling, 1 reply; 5+ messages in thread
From: Mathieu Malaterre @ 2019-02-15 8:11 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras, Oleg Nesterov, LKML
On Sat, Dec 8, 2018 at 4:46 PM Mathieu Malaterre <malat@debian.org> wrote:
>
> `pt_regs_check` is a dummy function, its purpose is to break the build
> if struct pt_regs and struct user_pt_regs don't match.
>
> This function has no functionnal purpose, and will get eliminated at
> link time or after init depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
>
> This commit adds a prototype to fix warning at W=1:
>
> arch/powerpc/kernel/ptrace.c:3339:13: error: no previous prototype for ‘pt_regs_check’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> ---
> arch/powerpc/kernel/ptrace.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> index a398999d0770..341c0060b4c8 100644
> --- a/arch/powerpc/kernel/ptrace.c
> +++ b/arch/powerpc/kernel/ptrace.c
> @@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)
> user_enter();
> }
>
> +void __init pt_regs_check(void);
> +/* dummy function, its purpose is to break the build if struct pt_regs and
> + * struct user_pt_regs don't match.
> + */
Another trick which seems to work with GCC is:
-void __init pt_regs_check(void)
+static inline void __init pt_regs_check(void)
> void __init pt_regs_check(void)
> {
> BUILD_BUG_ON(offsetof(struct pt_regs, gpr) !=
> --
> 2.19.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check
2019-02-15 8:11 ` Mathieu Malaterre
@ 2019-02-15 8:21 ` Christophe Leroy
2019-02-15 8:46 ` Mathieu Malaterre
0 siblings, 1 reply; 5+ messages in thread
From: Christophe Leroy @ 2019-02-15 8:21 UTC (permalink / raw)
To: Mathieu Malaterre, Michael Ellerman
Cc: Paul Mackerras, linuxppc-dev, Oleg Nesterov, LKML
Le 15/02/2019 à 09:11, Mathieu Malaterre a écrit :
> On Sat, Dec 8, 2018 at 4:46 PM Mathieu Malaterre <malat@debian.org> wrote:
>>
>> `pt_regs_check` is a dummy function, its purpose is to break the build
>> if struct pt_regs and struct user_pt_regs don't match.
>>
>> This function has no functionnal purpose, and will get eliminated at
>> link time or after init depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
>>
>> This commit adds a prototype to fix warning at W=1:
>>
>> arch/powerpc/kernel/ptrace.c:3339:13: error: no previous prototype for ‘pt_regs_check’ [-Werror=missing-prototypes]
>>
>> Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
>> Signed-off-by: Mathieu Malaterre <malat@debian.org>
>> ---
>> arch/powerpc/kernel/ptrace.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
>> index a398999d0770..341c0060b4c8 100644
>> --- a/arch/powerpc/kernel/ptrace.c
>> +++ b/arch/powerpc/kernel/ptrace.c
>> @@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)
>> user_enter();
>> }
>>
>> +void __init pt_regs_check(void);
>> +/* dummy function, its purpose is to break the build if struct pt_regs and
>> + * struct user_pt_regs don't match.
>> + */
>
> Another trick which seems to work with GCC is:
>
> -void __init pt_regs_check(void)
> +static inline void __init pt_regs_check(void)
Does this really work ? Did you test to ensure that the BUILD_BUG_ON
still detect mismatch between struct pt_regs and struct user_pt_regs ?
Christophe
>
>> void __init pt_regs_check(void)
>> {
>> BUILD_BUG_ON(offsetof(struct pt_regs, gpr) !=
>> --
>> 2.19.2
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check
2019-02-15 8:21 ` Christophe Leroy
@ 2019-02-15 8:46 ` Mathieu Malaterre
0 siblings, 0 replies; 5+ messages in thread
From: Mathieu Malaterre @ 2019-02-15 8:46 UTC (permalink / raw)
To: Christophe Leroy; +Cc: linuxppc-dev, Oleg Nesterov, Paul Mackerras, LKML
On Fri, Feb 15, 2019 at 9:21 AM Christophe Leroy
<christophe.leroy@c-s.fr> wrote:
>
>
>
> Le 15/02/2019 à 09:11, Mathieu Malaterre a écrit :
> > On Sat, Dec 8, 2018 at 4:46 PM Mathieu Malaterre <malat@debian.org> wrote:
> >>
> >> `pt_regs_check` is a dummy function, its purpose is to break the build
> >> if struct pt_regs and struct user_pt_regs don't match.
> >>
> >> This function has no functionnal purpose, and will get eliminated at
> >> link time or after init depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
> >>
> >> This commit adds a prototype to fix warning at W=1:
> >>
> >> arch/powerpc/kernel/ptrace.c:3339:13: error: no previous prototype for ‘pt_regs_check’ [-Werror=missing-prototypes]
> >>
> >> Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> >> Signed-off-by: Mathieu Malaterre <malat@debian.org>
> >> ---
> >> arch/powerpc/kernel/ptrace.c | 4 ++++
> >> 1 file changed, 4 insertions(+)
> >>
> >> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> >> index a398999d0770..341c0060b4c8 100644
> >> --- a/arch/powerpc/kernel/ptrace.c
> >> +++ b/arch/powerpc/kernel/ptrace.c
> >> @@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)
> >> user_enter();
> >> }
> >>
> >> +void __init pt_regs_check(void);
> >> +/* dummy function, its purpose is to break the build if struct pt_regs and
> >> + * struct user_pt_regs don't match.
> >> + */
> >
> > Another trick which seems to work with GCC is:
> >
> > -void __init pt_regs_check(void)
> > +static inline void __init pt_regs_check(void)
>
> Does this really work ? Did you test to ensure that the BUILD_BUG_ON
> still detect mismatch between struct pt_regs and struct user_pt_regs ?
>
My bad, I was unaware of GCC behavior for static inline in this case.
Sorry for the noise.
Original ugly patch does work though.
>
> >
> >> void __init pt_regs_check(void)
> >> {
> >> BUILD_BUG_ON(offsetof(struct pt_regs, gpr) !=
> >> --
> >> 2.19.2
> >>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check
2018-12-08 15:46 [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check Mathieu Malaterre
2019-02-15 8:11 ` Mathieu Malaterre
@ 2019-11-07 3:45 ` Michael Ellerman
1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2019-11-07 3:45 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Mathieu Malaterre, linuxppc-dev, Paul Mackerras, Oleg Nesterov,
linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 758 bytes --]
On Sat, 2018-12-08 at 15:46:23 UTC, Mathieu Malaterre wrote:
> `pt_regs_check` is a dummy function, its purpose is to break the build
> if struct pt_regs and struct user_pt_regs don't match.
>
> This function has no functionnal purpose, and will get eliminated at
> link time or after init depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
>
> This commit adds a prototype to fix warning at W=1:
>
> arch/powerpc/kernel/ptrace.c:3339:13: error: no previous prototype for ‘pt_regs_check’ [-Werror=missing-prototypes]
>
> Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/5c74f79958682fccd82a6029c53859d1dab3b239
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-11-07 3:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-08 15:46 [PATCH] powerpc/ptrace: Add prototype for function pt_regs_check Mathieu Malaterre
2019-02-15 8:11 ` Mathieu Malaterre
2019-02-15 8:21 ` Christophe Leroy
2019-02-15 8:46 ` Mathieu Malaterre
2019-11-07 3:45 ` 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).