Skip to content

Commit

Permalink
powerpc/watchpoint: Disable pagefaults when getting user instruction
Browse files Browse the repository at this point in the history
This is called in an atomic context, so is not allowed to sleep if a
user page needs to be faulted in and has nowhere it can be deferred to.
The pagefault_disabled() function is documented as preventing user
access methods from sleeping.

In practice the page will be mapped in nearly always because we are
reading the instruction that just triggered the watchpoint trap.

Signed-off-by: Benjamin Gray <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
  • Loading branch information
BenjaminGrayNp1 authored and mpe committed Sep 18, 2023
1 parent cc879ab commit 3241f26
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/powerpc/kernel/hw_breakpoint_constraints.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ void wp_get_instr_detail(struct pt_regs *regs, ppc_inst_t *instr,
int *type, int *size, unsigned long *ea)
{
struct instruction_op op;
int err;

if (__get_user_instr(*instr, (void __user *)regs->nip))
pagefault_disable();
err = __get_user_instr(*instr, (void __user *)regs->nip);
pagefault_enable();

if (err)
return;

analyse_instr(&op, regs, *instr);
Expand Down

0 comments on commit 3241f26

Please sign in to comment.