Skip to content

Commit 3241f26

Browse files
BenjaminGrayNp1mpe
authored andcommitted
powerpc/watchpoint: Disable pagefaults when getting user instruction
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 <bgray@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230829063457.54157-3-bgray@linux.ibm.com
1 parent cc879ab commit 3241f26

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/powerpc/kernel/hw_breakpoint_constraints.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,13 @@ void wp_get_instr_detail(struct pt_regs *regs, ppc_inst_t *instr,
131131
int *type, int *size, unsigned long *ea)
132132
{
133133
struct instruction_op op;
134+
int err;
134135

135-
if (__get_user_instr(*instr, (void __user *)regs->nip))
136+
pagefault_disable();
137+
err = __get_user_instr(*instr, (void __user *)regs->nip);
138+
pagefault_enable();
139+
140+
if (err)
136141
return;
137142

138143
analyse_instr(&op, regs, *instr);

0 commit comments

Comments
 (0)