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:	Fri, 21 Feb 2014 13:05:38 +0100
From:	Mateusz Guzik <mguzik@...hat.com>
To:	Dave Jones <davej@...hat.com>, linux-kernel@...r.kernel.org,
	Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH] kref: oops on zero or negative refcount

On Thu, Feb 20, 2014 at 01:14:40PM -0500, Dave Jones wrote:
> On Thu, Feb 20, 2014 at 06:44:59PM +0100, Mateusz Guzik wrote:
>  > In use after free situations, it is possible for one thread to write to
>  > memory that has just been reallocated to a new user. This could open up
>  > potential security issues.
>  > 
>  > diff --git a/include/linux/kref.h b/include/linux/kref.h
>  > index 484604d..c3f8a0a 100644
>  > --- a/include/linux/kref.h
>  > +++ b/include/linux/kref.h
>  > @@ -43,8 +43,10 @@ static inline void kref_get(struct kref *kref)
>  >  	/* If refcount was 0 before incrementing then we have a race
>  >  	 * condition when this kref is freeing by some other thread right now.
>  >  	 * In this case one should use kref_get_unless_zero()
>  > +	 *
>  > +	 * Terminate the current thread to stop potential security exploits.
>  >  	 */
>  > -	WARN_ON_ONCE(atomic_inc_return(&kref->refcount) < 2);
>  > +	BUG_ON(atomic_inc_return(&kref->refcount) < 2);
> 
> This isn't "terminating the thread", this is "lock up the box".
> 

Well, extent of damage caused by non-panicking BUG_ON (if any) depends
on the state when kref_get was executed.

However, since this condition is already a sign of big trouble (and a
potential exploitation attempt), I think a WARN_ON_ONCE is not
sufficient.

That said, can you elaborate on your concers? You just don't like that
comment, don't want that BUG_ON (want a panic instead) or maybe you
don't like the change at all (or something else)?

Thanks,
-- 
Mateusz Guzik
--
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