Messages in this thread | | | From | Doug Anderson <> | Date | Sat, 16 May 2020 09:17:21 -0700 | Subject | Re: [PATCH 2/4] arm64: Extract kprobes_save_local_irqflag() and kprobes_restore_local_irqflag() |
| |
Hi,
On Sat, May 16, 2020 at 1:47 AM liwei (GF) <liwei391@huawei.com> wrote: > > >> - kprobes_save_local_irqflag(kcb, regs); > >> + kernel_prepare_single_step(&kcb->saved_irqflag, regs); > > > > Is there some reason to have two functions? It seems like every time > > you call kernel_enable_single_step() you'd want to call > > kernel_prepare_single_step(). ...and every time you call > > kernel_disable_single_step() you'd want to call > > kernel_cleanup_single_step(). > > > > Maybe you can just add the flags parameter to > > kernel_enable_single_step() / kernel_disable_single_step() and put the > > code in there? > > > > As kernel_enable_single_step() / kernel_disable_single_step() are also called in > breakpoint_handler() and watchpoint_handler(), i am not sure it's a right thing > to put the daif flag prepare/cleanup into them, especially we don't have a context > to save the flags.
I think you misunderstood what I was suggesting. Maybe better with examples? I was suggesting doing this:
kcb->saved_irqflag = kernel_enable_single_step(regs); ... kernel_disable_single_step(kcb->saved_irqflag, regs);
To me that seems better than what you have now:
kcb->saved_irqflag = kernel_prepare_single_step(regs); kernel_enable_single_step(regs); ... kernel_cleanup_single_step(kcb->saved_irqflag, regs); kernel_disable_single_step();
...or am I confused?
-Doug
| |