`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 <redacted>
Signed-off-by: Mathieu Malaterre <redacted>
---
arch/powerpc/kernel/ptrace.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)user_enter();}+void__initpt_regs_check(void);+/* dummy function, its purpose is to break the build if struct pt_regs and+*structuser_pt_regsdon'tmatch.+*/void__initpt_regs_check(void){BUILD_BUG_ON(offsetof(structpt_regs,gpr)!=
On Sat, Dec 8, 2018 at 4:46 PM Mathieu Malaterre [off-list ref] wrote:
quoted hunk
`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 <redacted>
Signed-off-by: Mathieu Malaterre <redacted>
---
arch/powerpc/kernel/ptrace.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)user_enter();}+void__initpt_regs_check(void);+/* dummy function, its purpose is to break the build if struct pt_regs and+*structuser_pt_regsdon'tmatch.+*/
Another trick which seems to work with GCC is:
-void __init pt_regs_check(void)
+static inline void __init pt_regs_check(void)
Le 15/02/2019 à 09:11, Mathieu Malaterre a écrit :
On Sat, Dec 8, 2018 at 4:46 PM Mathieu Malaterre [off-list ref] wrote:
quoted
`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 <redacted>
Signed-off-by: Mathieu Malaterre <redacted>
---
arch/powerpc/kernel/ptrace.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)user_enter();}+void__initpt_regs_check(void);+/* dummy function, its purpose is to break the build if struct pt_regs and+*structuser_pt_regsdon'tmatch.+*/
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
On Fri, Feb 15, 2019 at 9:21 AM Christophe Leroy
[off-list ref] wrote:
Le 15/02/2019 à 09:11, Mathieu Malaterre a écrit :
quoted
On Sat, Dec 8, 2018 at 4:46 PM Mathieu Malaterre [off-list ref] wrote:
quoted
`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 <redacted>
Signed-off-by: Mathieu Malaterre <redacted>
---
arch/powerpc/kernel/ptrace.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -3338,6 +3338,10 @@ void do_syscall_trace_leave(struct pt_regs *regs)user_enter();}+void__initpt_regs_check(void);+/* dummy function, its purpose is to break the build if struct pt_regs and+*structuser_pt_regsdon'tmatch.+*/
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.
From: Michael Ellerman <hidden> Date: 2019-11-07 03:45:39
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 <redacted>
Signed-off-by: Mathieu Malaterre <redacted>