Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kgdbts: switch to kernel_clone()

The old _do_fork() helper is removed in favor of the new kernel_clone() helper.
The latter adheres to naming conventions for kernel internal syscall helpers.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: kgdb-bugreport@lists.sourceforge.net
Link: https://lore.kernel.org/r/20200819104655.436656-10-christian.brauner@ubuntu.com

+24 -24
+24 -24
drivers/misc/kgdbts.c
··· 33 33 * You can also specify optional tests: 34 34 * N## = Go to sleep with interrupts of for ## seconds 35 35 * to test the HW NMI watchdog 36 - * F## = Break at do_fork for ## iterations 36 + * F## = Break at kernel_clone for ## iterations 37 37 * S## = Break at sys_open for ## iterations 38 38 * I## = Run the single step test ## iterations 39 39 * 40 - * NOTE: that the do_fork and sys_open tests are mutually exclusive. 40 + * NOTE: that the kernel_clone and sys_open tests are mutually exclusive. 41 41 * 42 42 * To invoke the kgdb test suite from boot you use a kernel start 43 43 * argument as follows: 44 44 * kgdbts=V1 kgdbwait 45 - * Or if you wanted to perform the NMI test for 6 seconds and do_fork 45 + * Or if you wanted to perform the NMI test for 6 seconds and kernel_clone 46 46 * test for 100 forks, you could use: 47 47 * kgdbts=V1N6F100 kgdbwait 48 48 * ··· 74 74 * echo kgdbts=V1S10000 > /sys/module/kgdbts/parameters/kgdbts 75 75 * fg # and hit control-c 76 76 * fg # and hit control-c 77 - * ## This tests break points on do_fork 77 + * ## This tests break points on kernel_clone 78 78 * while [ 1 ] ; do date > /dev/null ; done & 79 79 * while [ 1 ] ; do date > /dev/null ; done & 80 80 * echo kgdbts=V1F1000 > /sys/module/kgdbts/parameters/kgdbts ··· 209 209 addr = (unsigned long)kgdbts_break_test; 210 210 else if (!strcmp(arg, "sys_open")) 211 211 addr = (unsigned long)do_sys_open; 212 - else if (!strcmp(arg, "do_fork")) 213 - addr = (unsigned long)_do_fork; 212 + else if (!strcmp(arg, "kernel_clone")) 213 + addr = (unsigned long)kernel_clone; 214 214 else if (!strcmp(arg, "hw_break_val")) 215 215 addr = (unsigned long)&hw_break_val; 216 216 addr = (unsigned long) dereference_function_descriptor((void *)addr); ··· 310 310 311 311 if (arch_needs_sstep_emulation && sstep_addr && 312 312 ip + offset == sstep_addr && 313 - ((!strcmp(arg, "sys_open") || !strcmp(arg, "do_fork")))) { 313 + ((!strcmp(arg, "sys_open") || !strcmp(arg, "kernel_clone")))) { 314 314 /* This is special case for emulated single step */ 315 315 v2printk("Emul: rewind hit single step bp\n"); 316 316 restart_from_top_after_write = 1; ··· 596 596 }; 597 597 598 598 /* 599 - * Test for hitting a breakpoint at do_fork for what ever the number 599 + * Test for hitting a breakpoint at kernel_clone for what ever the number 600 600 * of iterations required by the variable repeat_test. 601 601 */ 602 - static struct test_struct do_fork_test[] = { 602 + static struct test_struct do_kernel_clone_test[] = { 603 603 { "?", "S0*" }, /* Clear break points */ 604 - { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ 604 + { "kernel_clone", "OK", sw_break, }, /* set sw breakpoint */ 605 605 { "c", "T0*", NULL, get_thread_id_continue }, /* Continue */ 606 - { "do_fork", "OK", sw_rem_break }, /*remove breakpoint */ 607 - { "g", "do_fork", NULL, check_and_rewind_pc }, /* check location */ 606 + { "kernel_clone", "OK", sw_rem_break }, /*remove breakpoint */ 607 + { "g", "kernel_clone", NULL, check_and_rewind_pc }, /* check location */ 608 608 { "write", "OK", write_regs, emul_reset }, /* Write registers */ 609 609 { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ 610 - { "g", "do_fork", NULL, check_single_step }, 611 - { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ 610 + { "g", "kernel_clone", NULL, check_single_step }, 611 + { "kernel_clone", "OK", sw_break, }, /* set sw breakpoint */ 612 612 { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ 613 613 { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ 614 614 { "", "", get_cont_catch, put_cont_catch }, ··· 935 935 kgdb_breakpoint(); 936 936 } 937 937 938 - static void run_do_fork_test(void) 938 + static void run_kernel_clone_test(void) 939 939 { 940 940 init_simple_test(); 941 - ts.tst = do_fork_test; 942 - ts.name = "do_fork_test"; 941 + ts.tst = do_kernel_clone_test; 942 + ts.name = "do_kernel_clone_test"; 943 943 /* Activate test with initial breakpoint */ 944 944 kgdb_breakpoint(); 945 945 } ··· 967 967 static void kgdbts_run_tests(void) 968 968 { 969 969 char *ptr; 970 - int fork_test = 0; 970 + int clone_test = 0; 971 971 int do_sys_open_test = 0; 972 972 int sstep_test = 1000; 973 973 int nmi_sleep = 0; ··· 981 981 982 982 ptr = strchr(config, 'F'); 983 983 if (ptr) 984 - fork_test = simple_strtol(ptr + 1, NULL, 10); 984 + clone_test = simple_strtol(ptr + 1, NULL, 10); 985 985 ptr = strchr(config, 'S'); 986 986 if (ptr) 987 987 do_sys_open_test = simple_strtol(ptr + 1, NULL, 10); ··· 1025 1025 run_nmi_sleep_test(nmi_sleep); 1026 1026 } 1027 1027 1028 - /* If the do_fork test is run it will be the last test that is 1028 + /* If the kernel_clone test is run it will be the last test that is 1029 1029 * executed because a kernel thread will be spawned at the very 1030 1030 * end to unregister the debug hooks. 1031 1031 */ 1032 - if (fork_test) { 1033 - repeat_test = fork_test; 1034 - printk(KERN_INFO "kgdbts:RUN do_fork for %i breakpoints\n", 1032 + if (clone_test) { 1033 + repeat_test = clone_test; 1034 + printk(KERN_INFO "kgdbts:RUN kernel_clone for %i breakpoints\n", 1035 1035 repeat_test); 1036 1036 kthread_run(kgdbts_unreg_thread, NULL, "kgdbts_unreg"); 1037 - run_do_fork_test(); 1037 + run_kernel_clone_test(); 1038 1038 return; 1039 1039 } 1040 1040