diff options
Diffstat (limited to 'arch/x86/kernel/hw_breakpoint.c')
-rw-r--r-- | arch/x86/kernel/hw_breakpoint.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index 05d5fec64a94..dca2802c666f 100644 --- a/arch/x86/kernel/hw_breakpoint.c +++ b/arch/x86/kernel/hw_breakpoint.c | |||
@@ -212,25 +212,6 @@ static int arch_check_va_in_kernelspace(unsigned long va, u8 hbp_len) | |||
212 | return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE); | 212 | return (va >= TASK_SIZE) && ((va + len - 1) >= TASK_SIZE); |
213 | } | 213 | } |
214 | 214 | ||
215 | /* | ||
216 | * Store a breakpoint's encoded address, length, and type. | ||
217 | */ | ||
218 | static int arch_store_info(struct perf_event *bp) | ||
219 | { | ||
220 | struct arch_hw_breakpoint *info = counter_arch_bp(bp); | ||
221 | /* | ||
222 | * For kernel-addresses, either the address or symbol name can be | ||
223 | * specified. | ||
224 | */ | ||
225 | if (info->name) | ||
226 | info->address = (unsigned long) | ||
227 | kallsyms_lookup_name(info->name); | ||
228 | if (info->address) | ||
229 | return 0; | ||
230 | |||
231 | return -EINVAL; | ||
232 | } | ||
233 | |||
234 | int arch_bp_generic_fields(int x86_len, int x86_type, | 215 | int arch_bp_generic_fields(int x86_len, int x86_type, |
235 | int *gen_len, int *gen_type) | 216 | int *gen_len, int *gen_type) |
236 | { | 217 | { |
@@ -362,10 +343,13 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp, | |||
362 | return ret; | 343 | return ret; |
363 | } | 344 | } |
364 | 345 | ||
365 | ret = arch_store_info(bp); | 346 | /* |
366 | 347 | * For kernel-addresses, either the address or symbol name can be | |
367 | if (ret < 0) | 348 | * specified. |
368 | return ret; | 349 | */ |
350 | if (info->name) | ||
351 | info->address = (unsigned long) | ||
352 | kallsyms_lookup_name(info->name); | ||
369 | /* | 353 | /* |
370 | * Check that the low-order bits of the address are appropriate | 354 | * Check that the low-order bits of the address are appropriate |
371 | * for the alignment implied by len. | 355 | * for the alignment implied by len. |
@@ -502,8 +486,6 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args) | |||
502 | rcu_read_lock(); | 486 | rcu_read_lock(); |
503 | 487 | ||
504 | bp = per_cpu(bp_per_reg[i], cpu); | 488 | bp = per_cpu(bp_per_reg[i], cpu); |
505 | if (bp) | ||
506 | rc = NOTIFY_DONE; | ||
507 | /* | 489 | /* |
508 | * Reset the 'i'th TRAP bit in dr6 to denote completion of | 490 | * Reset the 'i'th TRAP bit in dr6 to denote completion of |
509 | * exception handling | 491 | * exception handling |
@@ -522,7 +504,13 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args) | |||
522 | 504 | ||
523 | rcu_read_unlock(); | 505 | rcu_read_unlock(); |
524 | } | 506 | } |
525 | if (dr6 & (~DR_TRAP_BITS)) | 507 | /* |
508 | * Further processing in do_debug() is needed for a) user-space | ||
509 | * breakpoints (to generate signals) and b) when the system has | ||
510 | * taken exception due to multiple causes | ||
511 | */ | ||
512 | if ((current->thread.debugreg6 & DR_TRAP_BITS) || | ||
513 | (dr6 & (~DR_TRAP_BITS))) | ||
526 | rc = NOTIFY_DONE; | 514 | rc = NOTIFY_DONE; |
527 | 515 | ||
528 | set_debugreg(dr7, 7); | 516 | set_debugreg(dr7, 7); |