Just test sent by misstake, please ignore it (sorry for the disturb) //答复: [PATCH] afs: fix tracepoint string placement with built-in AFS
Hi guys:
Very for the sorry for disturbs, this is a test for local git send email setup and sent by mistake. Please ignore this.
Regards
Zengtao
Quoted 82 lines
-----邮件原件-----
发件人: Zengtao (B)
发送时间: 2021年6月22日 14:52
收件人: Zengtao (B) <[email protected]>
抄送: Alexey Dobriyan <[email protected]>; Andi Kleen <[email protected]>; David Howells <[email protected]>; [email protected]; Andrew Morton <[email protected]>; Stephen Rothwell <[email protected]> 主题: [PATCH] afs: fix tracepoint string placement with built-in AFSFrom: Alexey Dobriyan <[email protected]>
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/0xd0Then reproducer was narrowed to
# cat /sys/kernel/tracing/printk_formatsOriginal 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
435f5346592e4243is "CB.YFS_" which came fromCM_NAMEmacro.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_formatsFixes 8e8d7f13b6d5a9 ("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]>--- fs/afs/cmservice.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)fs/afs/cmservice.c +3
-2@@ -30,8 +30,9 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *);static int afs_deliver_yfs_cb_callback (struct afs_call *);#define CM_NAME (name) \ - char afs_SRXCB##name##_name[] __tracepoint_string = \ - "CB." #name + const char afs_SRXCB##name##_name[] = "CB." #name; \ + static const char *_afs_SRXCB##name##_name __tracepoint_string =\ + afs_SRXCB##name##_name/* * CB.CallBack operation type
--
2.30.0