powerpc/ptrace: Add prototype for function pt_regs_check
Subsystems (2)
PATCH 1/1 powerpc/ptrace: Add prototype for function pt_regs_check
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]
--- arch/powerpc/kernel/ptrace.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/kernel/ptrace.c +4 -0
@@ -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) !=
Signature · 1 line
2.19.2
Quoted 22 lines · Mathieu Malaterre
pt_regs_checkis a dummy function, its purpose is to break the build if structpt_regsand structuser_pt_regsdon'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_ELIMINATIONThis 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 <[email protected]>Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/kernel/ptrace.c | 4 ++++ 1 file changed, 4 insertions(+)arch/powerpc/kernel/ptrace.c +0
-0
arch/powerpc/kernel/ptrace.c void do_syscall_trace_leave(struct pt_regs *regs) · line 3344
Quoted 7 lines
arch/powerpc/kernel/ptrace.c +4
-0@@ -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)
Quoted 6 lines
arch/powerpc/kernel/ptrace.c +0
-1void __init pt_regs_check (void ) { BUILD_BUG_ON(offsetof(struct pt_regs, gpr) != --2.19.2
Le 15/02/2019 à 09:11, Mathieu Malaterre a écrit :
Quoted 33 lines · Mathieu Malaterre
Quoted 22 lines
pt_regs_checkis a dummy function, its purpose is to break the build if structpt_regsand structuser_pt_regsdon'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_ELIMINATIONThis 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 <[email protected]>Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/kernel/ptrace.c | 4 ++++ 1 file changed, 4 insertions(+)arch/powerpc/kernel/ptrace.c +0
-0arch/powerpc/kernel/ptrace.c void do_syscall_trace_leave(struct pt_regs *regs) · line 3344
Quoted 7 lines
arch/powerpc/kernel/ptrace.c +4
-0@@ -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:
Review
Quoted 2 lines
(quoted diff) +1
-1-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
Quoted 7 lines
Quoted 7 lines
arch/powerpc/kernel/ptrace.c +0
-1void __init pt_regs_check (void ) { BUILD_BUG_ON(offsetof(struct pt_regs, gpr) != --2.19.2
Quoted 37 lines · Christophe Leroy
Quoted 33 lines · Mathieu Malaterre
Quoted 22 lines · Mathieu Malaterre
pt_regs_checkis a dummy function, its purpose is to break the build if structpt_regsand structuser_pt_regsdon'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_ELIMINATIONThis 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 <[email protected]>Signed-off-by Mathieu Malaterre <[email protected]>--- arch/powerpc/kernel/ptrace.c | 4 ++++ 1 file changed, 4 insertions(+)arch/powerpc/kernel/ptrace.c +0
-0arch/powerpc/kernel/ptrace.c void do_syscall_trace_leave(struct pt_regs *regs) · line 3344
Quoted 7 lines
arch/powerpc/kernel/ptrace.c +4
-0@@ -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:
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-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_ONstill detect mismatch between structpt_regsand structuser_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.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/powerpc/kernel/ptrace.c +0
-1void __init pt_regs_check (void ) { BUILD_BUG_ON(offsetof(struct pt_regs, gpr) != --2.19.2
Michael Ellerman
AppliedQuoted 6 lines · Mathieu Malaterre
pt_regs_checkis a dummy function, its purpose is to break the build if structpt_regsand structuser_pt_regsdon'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
Quoted 6 lines
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 <[email protected]>Signed-off-by Mathieu Malaterre <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/5c74f79958682fccd82a6029c53859d1dab3b239
cheers