[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG_fn=WSw0Wt=mJs5Vm_133g0--i0yMOTsuEQ-9YbmLo77+w_A@mail.gmail.com>
Date: Thu, 5 Mar 2020 09:33:07 +0100
From: Alexander Potapenko <glider@...gle.com>
To: Kees Cook <keescook@...omium.org>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
"open list:ANDROID DRIVERS" <devel@...verdev.osuosl.org>,
Jann Horn <jannh@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Arve Hjønnevåg <arve@...roid.com>,
Ingo Molnar <mingo@...hat.com>, Joe Perches <joe@...ches.com>,
Dmitriy Vyukov <dvyukov@...gle.com>,
Todd Kjos <tkjos@...gle.com>
Subject: Re: [PATCH v2 2/3] binder: do not initialize locals passed to copy_from_user()
On Thu, Mar 5, 2020 at 9:26 AM Kees Cook <keescook@...omium.org> wrote:
>
> On Thu, Mar 05, 2020 at 11:07:56AM +0300, Dan Carpenter wrote:
> > On Wed, Mar 04, 2020 at 10:13:40AM -0800, Kees Cook wrote:
> > > On Tue, Mar 03, 2020 at 12:38:32PM +0300, Dan Carpenter wrote:
> > > > The real fix is to initialize everything manually, the automated
> > > > initialization is a hardenning feature which many people will disable.
> > >
> > > I cannot disagree more with this sentiment. Linus has specifically said he
> > > wants this initialization on by default[1],
> >
> > Fine, but as long as it's a configurable thing then we need to manually
> > initialize as well or it's still a CVE etc. It will take a while before
> > we drop support for old versions of GCC as well.
>
> Yes, I agree; that's totally true. We need to continue to fix all the
> uninitialized flaws we encounter unless this is on by default for all
> supported compiler versions (which will be a looong time). (But it's
> not relevant to this patch because copy_from_user() does already do
> the initialization.)
>
> This set of patches was about dealing with the pathological cases of
> auto-init colliding with functions that do, in fact, fully init. Though
> I must say, I remain concerned about inventing such markings for fear
> they'll be used in places where the "trust me, it's fully initialized"
> state does not actually hold[1] but the author thinks it does.
>
> -Kees
Right now I'm trying to make Clang understand that output arguments of
inline assembly initialize the memory.
Then it would be possible to write something like:
struct binder_transaction_data tr;
asm("": "=m"(tr));
if (copy_from_user(&tr, ptr, sizeof(tr))) ...
, and the asm directive can be hidden into copy_from_user().
Powered by blists - more mailing lists