Skip to content

Commit

Permalink
dyndbg: properly unwind on ddebug_add_module failure
Browse files Browse the repository at this point in the history
A recent change to ddebug_add_module() allowed it to fail when
multiple classmaps didnt properly share the 0..62 class-id space (per
module).  This error flowed to the notify-handler, which avoided the
WARN, and thought all was good. But testing hit a page-fault:

[    2.159815] dyndbg: Overlapping range: [0..9] on D2_CORE
modprobe: ERROR: could not insert 'test_dynamic_debug_submod': Invalid argument
[    2.160133] dyndbg: bad class reservations
[    2.192181] BUG: unable to handle page fault for address: ffffffffc038b53b
[    2.192872] #PF: supervisor read access in kernel mode
[    2.193179] #PF: error_code(0x0000) - not-present page
[    2.193489] PGD 3ca43067 P4D 3ca43067 PUD 3ca45067 PMD 1aa4067 PTE 0
[    2.193885] Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI
[    2.194182] CPU: 1 UID: 0 PID: 414 Comm: grep Not tainted 6.11.0-dd-00062-g27917198ef23 torvalds#17
[    2.194678] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[    2.195036] RIP: 0010:ddebug_proc_show+0x38/0x220

Fix this (apparently) by removing the just-added module, which takes
it of the ddebug-tables list, so proc-show doesn't traverse it.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
  • Loading branch information
jimc committed Sep 20, 2024
1 parent 44a139b commit 30affdc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/dynamic_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@ static int ddebug_module_notify(struct notifier_block *self, unsigned long val,
ret = ddebug_add_module(&mod->dyndbg_info, mod->name);
if (ret == -EINVAL) {
pr_err("bad class reservations");
ddebug_remove_module(mod->name);
break;
}
if (ret)
Expand Down

0 comments on commit 30affdc

Please sign in to comment.