Skip to content

Commit

Permalink
static_call: fix page fault caused by static_call_del_module
Browse files Browse the repository at this point in the history
[  133.276160] Failed to allocate memory for static calls
[  133.276210] WARNING: CPU: 0 PID: 5124 at kernel/static_call_inline.c:434 static_call_module_notify+0x2df/0x370

...

[  133.313765] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI
[  133.315013] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
[  133.315852] CPU: 0 PID: 5124 Comm: insmod Tainted: G        W          6.1.0-rc3-00003-gda00e3b3bb13 torvalds#71
[  133.316900] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
[  133.317909] RIP: 0010:static_call_del_module+0x132/0x1f0
[  133.318518] Code: 8b 78 08 4d 85 ff 75 12 eb 5d e8 e9 d7 f2 ff 48 85 ed 74 53 4d 89 fc 49 89 ef e8 d9 d7 f2 ff 49 8d 7f 08 48 89 f8 48 c1 e8 03 <80> 3c 18 00 75 63 4c 89 f8 49 8b 57 08 48 c1 e8 03 80 3c 18 00 75
[  133.320572] RSP: 0018:ffff888111dc79d0 EFLAGS: 00010202
[  133.321171] RAX: 0000000000000001 RBX: dffffc0000000000 RCX: ffffffff814f4c17
[  133.321970] RDX: ffff88810b3f1ac0 RSI: 0000000000000000 RDI: 0000000000000009
[  133.322775] RBP: ffffffffc0084d40 R08: 0000000000000001 R09: ffffed10235c4efa
[  133.323572] R10: ffff88811ae277cb R11: ffffed10235c4ef9 R12: ffffffffc0084d48
[  133.324368] R13: ffffffffc008d2e4 R14: ffffffffc008da00 R15: 0000000000000001
[  133.325165] FS:  00007ff1f1e63540(0000) GS:ffff88811ae00000(0000) knlGS:0000000000000000
[  133.326059] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  133.326714] CR2: 00007ff1f19d8510 CR3: 000000010ad60006 CR4: 0000000000170ef0
[  133.327505] Call Trace:
[  133.327796]  <TASK>
[  133.328057]  static_call_module_notify+0x2ef/0x370
[  133.328608]  notifier_call_chain_robust+0xca/0x1e0
[  133.329159]  blocking_notifier_call_chain_robust+0x66/0xa0
[  133.329782]  load_module+0x4e51/0x6bf0
[  133.330220]  ? ext4_file_read_iter+0x15c/0x3a0
[  133.330746]  ? module_frob_arch_sections+0x20/0x20
[  133.331295]  ? security_file_permission+0x3fb/0x600
[  133.331851]  ? security_file_permission+0x403/0x600
[  133.332411]  ? kernel_read_file+0x3d7/0x650
[  133.332900]  ? __do_sys_finit_module+0x135/0x1d0
[  133.333430]  __do_sys_finit_module+0x135/0x1d0
[  133.333941]  ? __ia32_sys_init_module+0xa0/0xa0
[  133.334466]  ? _raw_spin_unlock_irq+0x1f/0x50
[  133.334973]  ? lockdep_hardirqs_on+0x79/0x100
[  133.335472]  ? _raw_spin_unlock_irq+0x2a/0x50
[  133.335974]  ? ptrace_notify+0xe9/0x130
[  133.336420]  do_syscall_64+0x3b/0x90
[  133.336838]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
[  133.337412] RIP: 0033:0x7ff1f196e839
[  133.337826] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48
[  133.339871] RSP: 002b:00007ffe1c47dae8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[  133.340720] RAX: ffffffffffffffda RBX: 000055cc6e239810 RCX: 00007ff1f196e839
[  133.341515] RDX: 0000000000000000 RSI: 000055cc6d01bc2e RDI: 0000000000000003
[  133.342314] RBP: 000055cc6d01bc2e R08: 0000000000000000 R09: 00007ff1f1c41000
[  133.343130] R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
[  133.343926] R13: 000055cc6e2397f0 R14: 0000000000000000 R15: 0000000000000000
[  133.344723]  </TASK>
[  133.344985] Modules linked in: dlm(+) [last unloaded: dlm]

Signed-off-by: Zeng Heng <[email protected]>
  • Loading branch information
henryZe committed Dec 7, 2022
1 parent 64bd1a8 commit 5b305f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/static_call_inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ static void static_call_del_module(struct module *mod)

prev_key = key;

for (prev = &key->mods, site_mod = key->mods;
for (prev = &key->mods, site_mod = static_call_key_next(key);
site_mod && site_mod->mod != mod;
prev = &site_mod->next, site_mod = site_mod->next)
;
Expand Down

0 comments on commit 5b305f6

Please sign in to comment.