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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200304161823.afe5ed2b47029e55531329ea@kernel.org>
Date:   Wed, 4 Mar 2020 16:18:23 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Anders Roxell <anders.roxell@...aro.org>, paulmck@...nel.org,
        joel@...lfernandes.org,
        "Naveen N . Rao" <naveen.n.rao@...ux.ibm.com>,
        Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
        David Miller <davem@...emloft.net>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -tip V4 3/4] kprobes: Fix to protect
 kick_kprobe_optimizer() by kprobe_mutex

On Tue, 3 Mar 2020 18:52:36 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Wed, 26 Feb 2020 17:59:51 +0900
> Masami Hiramatsu <mhiramat@...nel.org> wrote:
> 
> > In kprobe_optimizer() kick_kprobe_optimizer() is called
> > without kprobe_mutex, but this can race with other caller
> > which is protected by kprobe_mutex.
> > 
> > To fix that, expand kprobe_mutex protected area to protect
> > kick_kprobe_optimizer() call.
> > 
> 
> Should we add
> 
>  Cc: stable@...r.kernel.org
>  Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing")
> 
> tags?

Good catch! Yes, it is correct commit to be fixed.

Thank you!

> 
> -- Steve
> 
> > Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> > ---
> >  kernel/kprobes.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 38d9a5d7c8a4..6d76a6e3e1a5 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -592,11 +592,12 @@ static void kprobe_optimizer(struct work_struct *work)
> >  	mutex_unlock(&module_mutex);
> >  	mutex_unlock(&text_mutex);
> >  	cpus_read_unlock();
> > -	mutex_unlock(&kprobe_mutex);
> >  
> >  	/* Step 5: Kick optimizer again if needed */
> >  	if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list))
> >  		kick_kprobe_optimizer();
> > +
> > +	mutex_unlock(&kprobe_mutex);
> >  }
> >  
> >  /* Wait for completing optimization and unoptimization */
> 


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ