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

kprobes: rename kprobe_enabled to kprobes_all_disarmed

Rename kprobe_enabled to kprobes_all_disarmed and invert logic due to
avoiding naming confusion from per-probe disabling.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Masami Hiramatsu and committed by
Linus Torvalds
e579abeb cc00e9cf

+17 -17
+17 -17
kernel/kprobes.c
··· 68 68 static struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE]; 69 69 70 70 /* NOTE: change this value only with kprobe_mutex held */ 71 - static bool kprobe_enabled; 71 + static bool kprobes_all_disarmed; 72 72 73 73 static DEFINE_MUTEX(kprobe_mutex); /* Protects kprobe_table */ 74 74 static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL; ··· 598 598 * If the old_p has gone, its breakpoint has been disarmed. 599 599 * We have to arm it again after preparing real kprobes. 600 600 */ 601 - if (kprobe_enabled) 601 + if (!kprobes_all_disarmed) 602 602 arch_arm_kprobe(ap); 603 603 } 604 604 ··· 709 709 hlist_add_head_rcu(&p->hlist, 710 710 &kprobe_table[hash_ptr(p->addr, KPROBE_HASH_BITS)]); 711 711 712 - if (kprobe_enabled) 712 + if (!kprobes_all_disarmed) 713 713 arch_arm_kprobe(p); 714 714 715 715 out_unlock_text: ··· 751 751 * enabled and not gone - otherwise, the breakpoint would 752 752 * already have been removed. We save on flushing icache. 753 753 */ 754 - if (kprobe_enabled && !kprobe_gone(old_p)) { 754 + if (!kprobes_all_disarmed && !kprobe_gone(old_p)) { 755 755 mutex_lock(&text_mutex); 756 756 arch_disarm_kprobe(p); 757 757 mutex_unlock(&text_mutex); ··· 1190 1190 } 1191 1191 } 1192 1192 1193 - /* By default, kprobes are enabled */ 1194 - kprobe_enabled = true; 1193 + /* By default, kprobes are armed */ 1194 + kprobes_all_disarmed = false; 1195 1195 1196 1196 err = arch_init_kprobes(); 1197 1197 if (!err) ··· 1289 1289 .release = seq_release, 1290 1290 }; 1291 1291 1292 - static void __kprobes enable_all_kprobes(void) 1292 + static void __kprobes arm_all_kprobes(void) 1293 1293 { 1294 1294 struct hlist_head *head; 1295 1295 struct hlist_node *node; ··· 1298 1298 1299 1299 mutex_lock(&kprobe_mutex); 1300 1300 1301 - /* If kprobes are already enabled, just return */ 1302 - if (kprobe_enabled) 1301 + /* If kprobes are armed, just return */ 1302 + if (!kprobes_all_disarmed) 1303 1303 goto already_enabled; 1304 1304 1305 1305 mutex_lock(&text_mutex); ··· 1311 1311 } 1312 1312 mutex_unlock(&text_mutex); 1313 1313 1314 - kprobe_enabled = true; 1314 + kprobes_all_disarmed = false; 1315 1315 printk(KERN_INFO "Kprobes globally enabled\n"); 1316 1316 1317 1317 already_enabled: ··· 1319 1319 return; 1320 1320 } 1321 1321 1322 - static void __kprobes disable_all_kprobes(void) 1322 + static void __kprobes disarm_all_kprobes(void) 1323 1323 { 1324 1324 struct hlist_head *head; 1325 1325 struct hlist_node *node; ··· 1328 1328 1329 1329 mutex_lock(&kprobe_mutex); 1330 1330 1331 - /* If kprobes are already disabled, just return */ 1332 - if (!kprobe_enabled) 1331 + /* If kprobes are already disarmed, just return */ 1332 + if (kprobes_all_disarmed) 1333 1333 goto already_disabled; 1334 1334 1335 - kprobe_enabled = false; 1335 + kprobes_all_disarmed = true; 1336 1336 printk(KERN_INFO "Kprobes globally disabled\n"); 1337 1337 mutex_lock(&text_mutex); 1338 1338 for (i = 0; i < KPROBE_TABLE_SIZE; i++) { ··· 1364 1364 { 1365 1365 char buf[3]; 1366 1366 1367 - if (kprobe_enabled) 1367 + if (!kprobes_all_disarmed) 1368 1368 buf[0] = '1'; 1369 1369 else 1370 1370 buf[0] = '0'; ··· 1387 1387 case 'y': 1388 1388 case 'Y': 1389 1389 case '1': 1390 - enable_all_kprobes(); 1390 + arm_all_kprobes(); 1391 1391 break; 1392 1392 case 'n': 1393 1393 case 'N': 1394 1394 case '0': 1395 - disable_all_kprobes(); 1395 + disarm_all_kprobes(); 1396 1396 break; 1397 1397 } 1398 1398