From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751839AbcF3AMw (ORCPT ); Wed, 29 Jun 2016 20:12:52 -0400 Received: from smtprelay0140.hostedemail.com ([216.40.44.140]:39837 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751450AbcF3AMv (ORCPT ); Wed, 29 Jun 2016 20:12:51 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3874:4321:5007:6119:6742:7903:8660:10004:10400:10848:10967:11026:11232:11658:11914:12517:12519:12740:13069:13148:13230:13311:13357:13439:14096:14097:14181:14659:14721:21080:21434,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: show48_52913bb009e0c X-Filterd-Recvd-Size: 2667 Message-ID: <1467245565.24287.115.camel@perches.com> Subject: Re: [PATCH v1 2/2] Mark functions with the __nocapture attribute From: Joe Perches To: Emese Revfy Cc: kernel-hardening@lists.openwall.com, pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com, keescook@chromium.org, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org, minipli@ld-linux.so, linux@armlinux.org.uk, catalin.marinas@arm.com, linux@rasmusvillemoes.dk, david.brown@linaro.org, benh@kernel.crashing.org, tglx@linutronix.de, akpm@linux-foundation.org, jlayton@poochiereds.net, arnd@arndb.de Date: Wed, 29 Jun 2016 17:12:45 -0700 In-Reply-To: <20160629204204.859692ea2b7f570260ed18a0@gmail.com> References: <20160628133407.10c2ea1ecd194e8085e84c5a@gmail.com> <20160628133645.8f3cac0df4fc363e308426ac@gmail.com> <1467132211.24287.31.camel@perches.com> <20160628224043.c543b2b01e776e7757bbb3f4@gmail.com> <1467147657.24287.59.camel@perches.com> <20160629204204.859692ea2b7f570260ed18a0@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-06-29 at 20:42 +0200, Emese Revfy wrote: > On Tue, 28 Jun 2016 14:00:57 -0700 Joe Perches wrote: > > On Tue, 2016-06-28 at 22:40 +0200, Emese Revfy wrote: > > > On Tue, 28 Jun 2016 09:43:31 -0700 Joe Perches 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 * > > > 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? From mboxrd@z Thu Jan 1 00:00:00 1970 Reply-To: kernel-hardening@lists.openwall.com Message-ID: <1467245565.24287.115.camel@perches.com> From: Joe Perches Date: Wed, 29 Jun 2016 17:12:45 -0700 In-Reply-To: <20160629204204.859692ea2b7f570260ed18a0@gmail.com> References: <20160628133407.10c2ea1ecd194e8085e84c5a@gmail.com> <20160628133645.8f3cac0df4fc363e308426ac@gmail.com> <1467132211.24287.31.camel@perches.com> <20160628224043.c543b2b01e776e7757bbb3f4@gmail.com> <1467147657.24287.59.camel@perches.com> <20160629204204.859692ea2b7f570260ed18a0@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [kernel-hardening] Re: [PATCH v1 2/2] Mark functions with the __nocapture attribute To: Emese Revfy Cc: kernel-hardening@lists.openwall.com, pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com, keescook@chromium.org, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org, minipli@ld-linux.so, linux@armlinux.org.uk, catalin.marinas@arm.com, linux@rasmusvillemoes.dk, david.brown@linaro.org, benh@kernel.crashing.org, tglx@linutronix.de, akpm@linux-foundation.org, jlayton@poochiereds.net, arnd@arndb.de List-ID: On Wed, 2016-06-29 at 20:42 +0200, Emese Revfy wrote: > On Tue, 28 Jun 2016 14:00:57 -0700 Joe Perches wrote: > > On Tue, 2016-06-28 at 22:40 +0200, Emese Revfy wrote: > > > On Tue, 28 Jun 2016 09:43:31 -0700 Joe Perches 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 * > > > 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?