lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 26 May 2021 22:51:11 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
Cc:     mhiramat@...nel.org, Peter Zijlstra <peterz@...radead.org>,
        ananth@...ux.ibm.com, Christoph Hellwig <hch@....de>,
        linux-kernel@...r.kernel.org, mingo@...nel.org,
        rostedt@...dmis.org, x86@...nel.org
Subject: Re: [PATCH 1/2] kprobes: Remove kprobe::fault_handler

On Wed, 26 May 2021 16:20:25 +0530
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com> wrote:

> Peter Zijlstra wrote:
> > The reason for kprobe::fault_handler(), as given by their comment:
> > 
> >  * We come here because instructions in the pre/post
> >  * handler caused the page_fault, this could happen
> >  * if handler tries to access user space by
> >  * copy_from_user(), get_user() etc. Let the
> >  * user-specified handler try to fix it first.
> > 
> > Is just plain bad. Those other handlers are ran from non-preemptible
> > context and had better use _nofault() functions. Also, there is no
> > upstream usage of this.
> > 
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > Reviewed-by: Christoph Hellwig <hch@....de>
> > ---
> >  Documentation/trace/kprobes.rst    |   24 +++++-------------------
> >  arch/arc/kernel/kprobes.c          |   10 ----------
> >  arch/arm/probes/kprobes/core.c     |    9 ---------
> >  arch/arm64/kernel/probes/kprobes.c |   10 ----------
> >  arch/csky/kernel/probes/kprobes.c  |   10 ----------
> >  arch/ia64/kernel/kprobes.c         |    9 ---------
> >  arch/mips/kernel/kprobes.c         |    3 ---
> >  arch/powerpc/kernel/kprobes.c      |   10 ----------
> >  arch/riscv/kernel/probes/kprobes.c |   10 ----------
> >  arch/s390/kernel/kprobes.c         |   10 ----------
> >  arch/sh/kernel/kprobes.c           |   10 ----------
> >  arch/sparc/kernel/kprobes.c        |   10 ----------
> >  arch/x86/kernel/kprobes/core.c     |   10 ----------
> >  include/linux/kprobes.h            |    8 --------
> >  kernel/kprobes.c                   |   19 -------------------
> >  samples/kprobes/kprobe_example.c   |   15 ---------------
> >  16 files changed, 5 insertions(+), 172 deletions(-)
> > 
> 
> <snip>
> 
> > --- a/arch/x86/kernel/kprobes/core.c
> > +++ b/arch/x86/kernel/kprobes/core.c
> > @@ -947,16 +947,6 @@ int kprobe_fault_handler(struct pt_regs
> >  		 * these specific fault cases.
> >  		 */
> >  		kprobes_inc_nmissed_count(cur);
> 
> Not necessarily related, but I'm wondering why we're incrementing the 
> probe miss count here. Unlike what the comment above indicates, this is 
> not a 'fault' counter, but just a count of the number of times the probe 
> handler wasn't called.

Good catch! Indeed, we have no ned to count these fault because
it anyway gets back to the user handler. (so no user_handler is skipped)
Hmm, we need to clean up these countings too.

Thank you,

> 
> > -
> > -		/*
> > -		 * We come here because instructions in the pre/post
> > -		 * handler caused the page_fault, this could happen
> > -		 * if handler tries to access user space by
> > -		 * copy_from_user(), get_user() etc. Let the
> > -		 * user-specified handler try to fix it first.
> > -		 */
> > -		if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
> > -			return 1;
> >  	}
> 
> 
> - Naveen
> 


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ