Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 1 Jul 2016 16:03:30 +0200
From: Emese Revfy <re.emese@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: kernel-hardening@...ts.openwall.com, pageexec@...email.hu,
 spender@...ecurity.net, mmarek@...e.com, keescook@...omium.org,
 linux-kernel@...r.kernel.org, yamada.masahiro@...ionext.com,
 linux-kbuild@...r.kernel.org, minipli@...linux.so, linux@...linux.org.uk,
 catalin.marinas@....com, linux@...musvillemoes.dk, david.brown@...aro.org,
 benh@...nel.crashing.org, tglx@...utronix.de, akpm@...ux-foundation.org,
 jlayton@...chiereds.net, arnd@...db.de
Subject: Re: [PATCH v1 2/2] Mark functions with the __nocapture attribute

On Wed, 29 Jun 2016 17:12:45 -0700
Joe Perches <joe@...ches.com> wrote:

> On Wed, 2016-06-29 at 20:42 +0200, Emese Revfy wrote:
> > On Tue, 28 Jun 2016 14:00:57 -0700 Joe Perches <joe@...ches.com> wrote:
> > > On Tue, 2016-06-28 at 22:40 +0200, Emese Revfy wrote:
> > > > On Tue, 28 Jun 2016 09:43:31 -0700 Joe Perches <joe@...ches.com> wrote:
> > > > > On Tue, 2016-06-28 at 13:36 +0200, Emese Revfy wrote:
> > > > > > The nocapture gcc attribute can be on functions only.
> > > > > > The attribute takes one or more unsigned integer constants as parameters
> > > > > > that specify the function argument(s) of const char* type to initify.
> > > > > Perhaps this should be const <void>*
> > > > For me function arguments are the values passed to a function call so
> > > > the const char* type is good because this is the only one that the plugin handles
> > > > (for now at least).
> > > OK, but this function prototype specified takes a const void *
> > > 
> > > +extern void * memcpy(void *, const void *, __kernel_size_t) __nocapture(2);
> > What matters for the plugin is the type of the passed arguments (which can be const char*
> > in the current implementation), not that of the parameters.
> 
> And how does this work when the prototype requires the compiler to
> implicit cast to const void * before calling the function?


The plugin searches for the nocapture attribute that does not depend on the type.
If the function argument is not a string constant just a pointer then
the plugin walks the data flow (use-def chain) and tries to find a string constant.
If there is a cast to void * then the use-def chain will walk across it.

-- 
Emese

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.