| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2014-2016 Pratyush Anand <panand@redhat.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | 4 | */ |
|---|
| 8 | 5 | #include <linux/highmem.h> |
|---|
| 9 | 6 | #include <linux/ptrace.h> |
|---|
| .. | .. |
|---|
| 171 | 168 | static int uprobe_breakpoint_handler(struct pt_regs *regs, |
|---|
| 172 | 169 | unsigned int esr) |
|---|
| 173 | 170 | { |
|---|
| 174 | | - if (user_mode(regs) && uprobe_pre_sstep_notifier(regs)) |
|---|
| 171 | + if (uprobe_pre_sstep_notifier(regs)) |
|---|
| 175 | 172 | return DBG_HOOK_HANDLED; |
|---|
| 176 | 173 | |
|---|
| 177 | 174 | return DBG_HOOK_ERROR; |
|---|
| .. | .. |
|---|
| 182 | 179 | { |
|---|
| 183 | 180 | struct uprobe_task *utask = current->utask; |
|---|
| 184 | 181 | |
|---|
| 185 | | - if (user_mode(regs)) { |
|---|
| 186 | | - WARN_ON(utask && |
|---|
| 187 | | - (instruction_pointer(regs) != utask->xol_vaddr + 4)); |
|---|
| 188 | | - |
|---|
| 189 | | - if (uprobe_post_sstep_notifier(regs)) |
|---|
| 190 | | - return DBG_HOOK_HANDLED; |
|---|
| 191 | | - } |
|---|
| 182 | + WARN_ON(utask && (instruction_pointer(regs) != utask->xol_vaddr + 4)); |
|---|
| 183 | + if (uprobe_post_sstep_notifier(regs)) |
|---|
| 184 | + return DBG_HOOK_HANDLED; |
|---|
| 192 | 185 | |
|---|
| 193 | 186 | return DBG_HOOK_ERROR; |
|---|
| 194 | 187 | } |
|---|
| 195 | 188 | |
|---|
| 196 | 189 | /* uprobe breakpoint handler hook */ |
|---|
| 197 | 190 | static struct break_hook uprobes_break_hook = { |
|---|
| 198 | | - .esr_mask = BRK64_ESR_MASK, |
|---|
| 199 | | - .esr_val = BRK64_ESR_UPROBES, |
|---|
| 191 | + .imm = UPROBES_BRK_IMM, |
|---|
| 200 | 192 | .fn = uprobe_breakpoint_handler, |
|---|
| 201 | 193 | }; |
|---|
| 202 | 194 | |
|---|
| .. | .. |
|---|
| 207 | 199 | |
|---|
| 208 | 200 | static int __init arch_init_uprobes(void) |
|---|
| 209 | 201 | { |
|---|
| 210 | | - register_break_hook(&uprobes_break_hook); |
|---|
| 211 | | - register_step_hook(&uprobes_step_hook); |
|---|
| 202 | + register_user_break_hook(&uprobes_break_hook); |
|---|
| 203 | + register_user_step_hook(&uprobes_step_hook); |
|---|
| 212 | 204 | |
|---|
| 213 | 205 | return 0; |
|---|
| 214 | 206 | } |
|---|