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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 20 Feb 2015 21:52:50 -0600
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Jiri Kosina <jkosina@...e.cz>
Cc:	Petr Mladek <pmladek@...e.cz>, sjenning@...hat.com,
	vojtech@...e.cz, masami.hiramatsu.pt@...achi.com, mbenes@...e.cz,
	live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] livepatch: RCU protect struct klp_func all the time when
 used in klp_ftrace_handler()

On Sat, Feb 21, 2015 at 12:29:30AM +0100, Jiri Kosina wrote:
> On Wed, 18 Feb 2015, Petr Mladek wrote:
> 
> > func->new_func has been accessed after rcu_read_unlock() in klp_ftrace_handler()
> > and therefore the access was not protected.
> > 
> > Signed-off-by: Petr Mladek <pmladek@...e.cz>
> > ---
> >  kernel/livepatch/core.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> > index ff7f47d026ac..cde66192e20e 100644
> > --- a/kernel/livepatch/core.c
> > +++ b/kernel/livepatch/core.c
> > @@ -314,12 +314,12 @@ static void notrace klp_ftrace_handler(unsigned long ip,
> >  	rcu_read_lock();
> >  	func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
> >  				      stack_node);
> > -	rcu_read_unlock();
> > -
> >  	if (WARN_ON_ONCE(!func))
> > -		return;
> > +		goto unlock;
> >  
> >  	klp_arch_set_pc(regs, (unsigned long)func->new_func);
> > +unlock:
> > +	rcu_read_unlock();
> 
> This can't hurt, even though the only scenario where this could in theory 
> trigger as a bug (module removal) is non-issue now.
> 
> But I'd like to take it nevertheless ... Seth, Josh?

Acked-by: Josh Poimboeuf <jpoimboe@...hat.com>

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ