Skip to content

Commit

Permalink
pkg/report: fix parsing of syscall entry points
Browse files Browse the repository at this point in the history
gcc and clang somehow print different frames around syscall entry.
sys_-prefixed names is what currently produced for gcc (more common)
and we have lots of existing reports with sys_ prefix.
So make the clang frames parsed the same way as gcc frames are currently parsed.
  • Loading branch information
dvyukov committed Oct 25, 2021
1 parent 78e5f70 commit c8823b7
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/report/linux.go
Expand Up @@ -1160,7 +1160,7 @@ var linuxStackParams = &stackParams{
"____sys_",
"___sys_",
"__sys_",
"__se_sys_",
"__se_",
"__do_sys_",
"compat_SYSC_",
"compat_SyS_",
Expand Down
33 changes: 33 additions & 0 deletions pkg/report/testdata/linux/report/622
@@ -0,0 +1,33 @@
TITLE: WARNING: refcount bug in sys_memfd_secret

[ 54.834944][ T6519] ------------[ cut here ]------------
[ 54.840416][ T6519] refcount_t: addition on 0; use-after-free.
[ 54.847066][ T6519] WARNING: CPU: 1 PID: 6519 at lib/refcount.c:25 refcount_warn_saturate+0x13d/0x1a0
[ 54.856557][ T6519] Modules linked in:
[ 54.860452][ T6519] CPU: 1 PID: 6519 Comm: syz-executor570 Not tainted 5.15.0-rc6-syzkaller #0
[ 54.869354][ T6519] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
[ 54.879537][ T6519] RIP: 0010:refcount_warn_saturate+0x13d/0x1a0
[ 54.885812][ T6519] Code: c7 80 e1 b3 8a 31 c0 e8 31 8e 3b fd 0f 0b eb a3 e8 b8 79 71 fd c6 05 43 86 b6 09 01 48 c7 c7 e0 e1 b3 8a 31 c0 e8 13 8e 3b fd <0f> 0b eb 85 e8 9a 79 71 fd c6 05 26 86 b6 09 01 48 c7 c7 40 e2 b3
[ 54.905519][ T6519] RSP: 0018:ffffc900014dfed0 EFLAGS: 00010246
[ 54.911623][ T6519] RAX: f1edd9615e736100 RBX: 0000000000000002 RCX: ffff88801a6f1c80
[ 54.919693][ T6519] RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
[ 54.927759][ T6519] RBP: 0000000000000002 R08: ffffffff81695fe2 R09: ffffed10173a57a8
[ 54.935856][ T6519] R10: ffffed10173a57a8 R11: 0000000000000000 R12: ffff8880258c9900
[ 54.943926][ T6519] R13: ffff888071dbedc0 R14: 0000000000000003 R15: dffffc0000000000
[ 54.951923][ T6519] FS: 0000555556b16300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
[ 54.960942][ T6519] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 54.967656][ T6519] CR2: 00007f0a2b914330 CR3: 0000000073408000 CR4: 00000000003506e0
[ 54.976027][ T6519] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 54.984096][ T6519] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 54.992283][ T6519] Call Trace:
[ 54.995579][ T6519] __se_sys_memfd_secret+0x2ea/0x350
[ 55.000962][ T6519] do_syscall_64+0x44/0xd0
[ 55.005460][ T6519] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 55.011356][ T6519] RIP: 0033:0x7f0a2b902f89
[ 55.015959][ T6519] Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
[ 55.035666][ T6519] RSP: 002b:00007fff8e742228 EFLAGS: 00000246 ORIG_RAX: 00000000000001bf
[ 55.044185][ T6519] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f0a2b902f89
[ 55.052291][ T6519] RDX: 00007f0a2b8c5e93 RSI: 0000000000000012 RDI: 0000000000080000
[ 55.060271][ T6519] RBP: 00007f0a2b8c6f70 R08: 0000000000000000 R09: 0000000000000000
[ 55.068335][ T6519] R10: 00000000ffffffff R11: 0000000000000246 R12: 00007f0a2b8c7000
[ 55.076381][ T6519] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
33 changes: 33 additions & 0 deletions pkg/report/testdata/linux/report/623
@@ -0,0 +1,33 @@
TITLE: WARNING: refcount bug in sys_memfd_secret

[ 90.146573][ T6540] ------------[ cut here ]------------
[ 90.172091][ T6540] refcount_t: addition on 0; use-after-free.
[ 90.178798][ T6540] WARNING: CPU: 0 PID: 6540 at lib/refcount.c:25 refcount_warn_saturate+0x169/0x1e0
[ 90.188343][ T6540] Modules linked in:
[ 90.192280][ T6540] CPU: 0 PID: 6540 Comm: syz-executor161 Not tainted 5.15.0-rc6-syzkaller #0
[ 90.201168][ T6540] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
[ 90.211469][ T6540] RIP: 0010:refcount_warn_saturate+0x169/0x1e0
[ 90.217710][ T6540] Code: 09 31 ff 89 de e8 87 b4 9b fd 84 db 0f 85 36 ff ff ff e8 ca ac 9b fd 48 c7 c7 c0 65 e3 89 c6 05 ff 56 7f 09 01 e8 0d 45 19 05 <0f> 0b e9 17 ff ff ff e8 ab ac 9b fd 0f b6 1d e4 56 7f 09 31 ff 89
[ 90.237430][ T6540] RSP: 0018:ffffc9000c7a7f10 EFLAGS: 00010286
[ 90.243496][ T6540] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ 90.251513][ T6540] RDX: ffff888073be0300 RSI: ffffffff815dcf58 RDI: fffff520018f4fd4
[ 90.259570][ T6540] RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
[ 90.267606][ T6540] R10: ffffffff815d6cce R11: 0000000000000000 R12: 0000000000000000
[ 90.275595][ T6540] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 90.283632][ T6540] FS: 0000555556a3f300(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
[ 90.292659][ T6540] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 90.299342][ T6540] CR2: 00007f1bacc3b6c0 CR3: 00000000214ae000 CR4: 00000000003506f0
[ 90.307462][ T6540] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 90.315443][ T6540] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 90.323509][ T6540] Call Trace:
[ 90.326862][ T6540] __x64_sys_memfd_secret+0x182/0x1e0
[ 90.332246][ T6540] do_syscall_64+0x35/0xb0
[ 90.336736][ T6540] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 90.342641][ T6540] RIP: 0033:0x7fc28a0a4f79
[ 90.347123][ T6540] Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
[ 90.366874][ T6540] RSP: 002b:00007ffd689c4668 EFLAGS: 00000246 ORIG_RAX: 00000000000001bf
[ 90.375307][ T6540] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc28a0a4f79
[ 90.383323][ T6540] RDX: 00007fc28a067e83 RSI: 0000000000000012 RDI: 0000000000000000
[ 90.391384][ T6540] RBP: 00007fc28a068f60 R08: 0000000000000000 R09: 0000000000000000
[ 90.399422][ T6540] R10: 00000000ffffffff R11: 0000000000000246 R12: 00007fc28a068ff0
[ 90.407488][ T6540] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

0 comments on commit c8823b7

Please sign in to comment.