|
|
Log in / Subscribe / Register

Re: Re: [RFC v4 PATCH 00/13] HARDENED_ATOMIC

From:  Peter Zijlstra <peterz-AT-infradead.org>
To:  Kees Cook <keescook-AT-chromium.org>
Subject:  Re: Re: [RFC v4 PATCH 00/13] HARDENED_ATOMIC
Date:  Fri, 11 Nov 2016 21:17:04 +0100
Message-ID:  <20161111201704.GQ3117@twins.programming.kicks-ass.net>
Cc:  Will Deacon <will.deacon-AT-arm.com>, Greg KH <gregkh-AT-linuxfoundation.org>, David Windsor <dave-AT-progbits.org>, "kernel-hardening-AT-lists.openwall.com" <kernel-hardening-AT-lists.openwall.com>, Elena Reshetova <elena.reshetova-AT-intel.com>, Arnd Bergmann <arnd-AT-arndb.de>, Thomas Gleixner <tglx-AT-linutronix.de>, Ingo Molnar <mingo-AT-redhat.com>, "H. Peter Anvin" <h.peter.anvin-AT-intel.com>

On Fri, Nov 11, 2016 at 10:04:42AM -0800, Kees Cook wrote:

> I'm totally open about how to get there, but things can't just be opt-in.

There really is no alternative.

refcount_t; should only have: inc, inc_not_zero, dec_and_test

stats_t; should only have: add,sub

atomic_t; has:

	{add,inc,sub,dec} + {and,or,xor,notand}

	{add,inc,sub,dec}_return * {,relaxed,release,acquire}

	(fetch_{add,inc,sub,dec} + {and,or,xor,notand}) * {,relaxed,release,acquire}

	{sub,add,inc,dec}_and_test

	{cmpxchg,xchg}

	add_unless,inc_not_zero,{inc,dec}_unless_negative,dec_if_positive

That is so much more than either refcount_t or stats_t should have, and
the whole wrap/nowrap thing only matters to part of the ops.

Like said, atomic_cmpxchg_wrap() is utter crap, that's a function name
that doesn't make sense, and you guys should have realized that the
moment you typed it.

Its fantasy to think you can 'implement' atomic_t with refcount_t or
anything else. You're chasing unicorns.



to post comments


Copyright © 2016, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds