@@ -80,7 +80,7 @@ static int exception_level;
8080struct kgdb_io * dbg_io_ops ;
8181static DEFINE_SPINLOCK (kgdb_registration_lock );
8282
83- /* Action for the reboot notifiter , a global allow kdb to change it */
83+ /* Action for the reboot notifier , a global allow kdb to change it */
8484static int kgdbreboot ;
8585/* kgdb console driver is loaded */
8686static int kgdb_con_registered ;
@@ -94,14 +94,6 @@ int dbg_switch_cpu;
9494/* Use kdb or gdbserver mode */
9595int dbg_kdb_mode = 1 ;
9696
97- static int __init opt_kgdb_con (char * str )
98- {
99- kgdb_use_con = 1 ;
100- return 0 ;
101- }
102-
103- early_param ("kgdbcon" , opt_kgdb_con );
104-
10597module_param (kgdb_use_con , int , 0644 );
10698module_param (kgdbreboot , int , 0644 );
10799
@@ -163,7 +155,7 @@ early_param("nokgdbroundup", opt_nokgdbroundup);
163155
164156/*
165157 * Weak aliases for breakpoint management,
166- * can be overriden by architectures when needed:
158+ * can be overridden by architectures when needed:
167159 */
168160int __weak kgdb_arch_set_breakpoint (struct kgdb_bkpt * bpt )
169161{
@@ -177,17 +169,23 @@ int __weak kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
177169 arch_kgdb_ops .gdb_bpt_instr , BREAK_INSTR_SIZE );
178170 return err ;
179171}
172+ NOKPROBE_SYMBOL (kgdb_arch_set_breakpoint );
180173
181174int __weak kgdb_arch_remove_breakpoint (struct kgdb_bkpt * bpt )
182175{
183176 return copy_to_kernel_nofault ((char * )bpt -> bpt_addr ,
184177 (char * )bpt -> saved_instr , BREAK_INSTR_SIZE );
185178}
179+ NOKPROBE_SYMBOL (kgdb_arch_remove_breakpoint );
186180
187181int __weak kgdb_validate_break_address (unsigned long addr )
188182{
189183 struct kgdb_bkpt tmp ;
190184 int err ;
185+
186+ if (kgdb_within_blocklist (addr ))
187+ return - EINVAL ;
188+
191189 /* Validate setting the breakpoint and then removing it. If the
192190 * remove fails, the kernel needs to emit a bad message because we
193191 * are deep trouble not being able to put things back the way we
@@ -208,6 +206,7 @@ unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs)
208206{
209207 return instruction_pointer (regs );
210208}
209+ NOKPROBE_SYMBOL (kgdb_arch_pc );
211210
212211int __weak kgdb_arch_init (void )
213212{
@@ -218,6 +217,7 @@ int __weak kgdb_skipexception(int exception, struct pt_regs *regs)
218217{
219218 return 0 ;
220219}
220+ NOKPROBE_SYMBOL (kgdb_skipexception );
221221
222222#ifdef CONFIG_SMP
223223
@@ -239,6 +239,7 @@ void __weak kgdb_call_nmi_hook(void *ignored)
239239 */
240240 kgdb_nmicallback (raw_smp_processor_id (), get_irq_regs ());
241241}
242+ NOKPROBE_SYMBOL (kgdb_call_nmi_hook );
242243
243244void __weak kgdb_roundup_cpus (void )
244245{
@@ -272,6 +273,7 @@ void __weak kgdb_roundup_cpus(void)
272273 kgdb_info [cpu ].rounding_up = false;
273274 }
274275}
276+ NOKPROBE_SYMBOL (kgdb_roundup_cpus );
275277
276278#endif
277279
@@ -298,6 +300,7 @@ static void kgdb_flush_swbreak_addr(unsigned long addr)
298300 /* Force flush instruction cache if it was outside the mm */
299301 flush_icache_range (addr , addr + BREAK_INSTR_SIZE );
300302}
303+ NOKPROBE_SYMBOL (kgdb_flush_swbreak_addr );
301304
302305/*
303306 * SW breakpoint management:
@@ -325,6 +328,7 @@ int dbg_activate_sw_breakpoints(void)
325328 }
326329 return ret ;
327330}
331+ NOKPROBE_SYMBOL (dbg_activate_sw_breakpoints );
328332
329333int dbg_set_sw_break (unsigned long addr )
330334{
@@ -388,6 +392,7 @@ int dbg_deactivate_sw_breakpoints(void)
388392 }
389393 return ret ;
390394}
395+ NOKPROBE_SYMBOL (dbg_deactivate_sw_breakpoints );
391396
392397int dbg_remove_sw_break (unsigned long addr )
393398{
@@ -509,6 +514,7 @@ static int kgdb_io_ready(int print_wait)
509514 }
510515 return 1 ;
511516}
517+ NOKPROBE_SYMBOL (kgdb_io_ready );
512518
513519static int kgdb_reenter_check (struct kgdb_state * ks )
514520{
@@ -556,13 +562,15 @@ static int kgdb_reenter_check(struct kgdb_state *ks)
556562
557563 return 1 ;
558564}
565+ NOKPROBE_SYMBOL (kgdb_reenter_check );
559566
560567static void dbg_touch_watchdogs (void )
561568{
562569 touch_softlockup_watchdog_sync ();
563570 clocksource_touch_watchdog ();
564571 rcu_cpu_stall_reset ();
565572}
573+ NOKPROBE_SYMBOL (dbg_touch_watchdogs );
566574
567575static int kgdb_cpu_enter (struct kgdb_state * ks , struct pt_regs * regs ,
568576 int exception_state )
@@ -752,6 +760,8 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
752760 }
753761 }
754762
763+ dbg_activate_sw_breakpoints ();
764+
755765 /* Call the I/O driver's post_exception routine */
756766 if (dbg_io_ops -> post_exception )
757767 dbg_io_ops -> post_exception ();
@@ -794,6 +804,7 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs,
794804
795805 return kgdb_info [cpu ].ret_state ;
796806}
807+ NOKPROBE_SYMBOL (kgdb_cpu_enter );
797808
798809/*
799810 * kgdb_handle_exception() - main entry point from a kernel exception
@@ -838,6 +849,7 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs)
838849 arch_kgdb_ops .enable_nmi (1 );
839850 return ret ;
840851}
852+ NOKPROBE_SYMBOL (kgdb_handle_exception );
841853
842854/*
843855 * GDB places a breakpoint at this function to know dynamically loaded objects.
@@ -872,6 +884,7 @@ int kgdb_nmicallback(int cpu, void *regs)
872884#endif
873885 return 1 ;
874886}
887+ NOKPROBE_SYMBOL (kgdb_nmicallback );
875888
876889int kgdb_nmicallin (int cpu , int trapnr , void * regs , int err_code ,
877890 atomic_t * send_ready )
@@ -897,6 +910,7 @@ int kgdb_nmicallin(int cpu, int trapnr, void *regs, int err_code,
897910#endif
898911 return 1 ;
899912}
913+ NOKPROBE_SYMBOL (kgdb_nmicallin );
900914
901915static void kgdb_console_write (struct console * co , const char * s ,
902916 unsigned count )
@@ -920,6 +934,20 @@ static struct console kgdbcons = {
920934 .index = -1 ,
921935};
922936
937+ static int __init opt_kgdb_con (char * str )
938+ {
939+ kgdb_use_con = 1 ;
940+
941+ if (kgdb_io_module_registered && !kgdb_con_registered ) {
942+ register_console (& kgdbcons );
943+ kgdb_con_registered = 1 ;
944+ }
945+
946+ return 0 ;
947+ }
948+
949+ early_param ("kgdbcon" , opt_kgdb_con );
950+
923951#ifdef CONFIG_MAGIC_SYSRQ
924952static void sysrq_handle_dbg (int key )
925953{
0 commit comments