Skip to content

Commit 0783339

Browse files
Alexey Dobriyansfrothwell
authored andcommitted
afs: fix tracepoint string placement with built-in AFS
I was adding custom tracepoint to the kernel, grabbed full F34 kernel .config, disabled modules and booted whole shebang as VM kernel. Then did perf record -a -e ... It crashed: general protection fault, probably for non-canonical address 0x435f5346592e4243: 0000 [#1] SMP PTI CPU: 1 PID: 842 Comm: cat Not tainted 5.12.6+ #26 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014 RIP: 0010:t_show+0x22/0xd0 Then reproducer was narrowed to # cat /sys/kernel/tracing/printk_formats Original F34 kernel with modules didn't crash. So I started to disable options and after disabling AFS everything started working again. The root cause is that AFS was placing char arrays content into a section full of _pointers_ to strings with predictable consequences. Non canonical address 435f5346592e4243 is "CB.YFS_" which came from CM_NAME macro. The fix is to create char array and pointer to it separatedly. Steps to reproduce: CONFIG_AFS=y CONFIG_TRACING=y # cat /sys/kernel/tracing/printk_formats Link: https://lkml.kernel.org/r/YLAXfvZ+rObEOdc/@localhost.localdomain Fixes: 8e8d7f1 ("afs: Add some tracepoints") Signed-off-by: Alexey Dobriyan (SK hynix) <[email protected]> Cc: Andi Kleen <[email protected]> Cc: David Howells <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Stephen Rothwell <[email protected]>
1 parent 0707045 commit 0783339

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/afs/cmservice.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *);
3030
static int afs_deliver_yfs_cb_callback(struct afs_call *);
3131

3232
#define CM_NAME(name) \
33-
char afs_SRXCB##name##_name[] __tracepoint_string = \
34-
"CB." #name
33+
const char afs_SRXCB##name##_name[] = "CB." #name; \
34+
static const char *_afs_SRXCB##name##_name __tracepoint_string =\
35+
afs_SRXCB##name##_name
3536

3637
/*
3738
* CB.CallBack operation type

0 commit comments

Comments
 (0)