From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751441AbdIJKzS (ORCPT ); Sun, 10 Sep 2017 06:55:18 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:37245 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbdIJKzQ (ORCPT ); Sun, 10 Sep 2017 06:55:16 -0400 X-Google-Smtp-Source: ADKCNb7WSHb0byODvwEiq9w08u/n4gIBUMHpZvIyTo3QspjcW5hZXimcuHYve1vXbC7kWwMqsfn1ZFB+Vl7H3P+3k/E= MIME-Version: 1.0 In-Reply-To: <1497903987-21002-8-git-send-email-keescook@chromium.org> References: <1497903987-21002-1-git-send-email-keescook@chromium.org> <1497903987-21002-8-git-send-email-keescook@chromium.org> From: Geert Uytterhoeven Date: Sun, 10 Sep 2017 12:55:15 +0200 X-Google-Sender-Auth: RrwjLLol8pfbguFzgmrY1QHr5o4 Message-ID: Subject: Re: [PATCH 7/7] include/linux/string.h: add the option of fortified string.h functions To: Kees Cook , Daniel Micay Cc: Andrew Morton , Mark Rutland , Daniel Axtens , Rasmus Villemoes , Andy Shevchenko , Chris Metcalf , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , "linux-kernel@vger.kernel.org" , Stephen Rothwell , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8AAtUEP018045 Hi Kees, Daniel, On Mon, Jun 19, 2017 at 10:26 PM, Kees Cook wrote: > From: Daniel Micay > > This adds support for compiling with a rough equivalent to the glibc > _FORTIFY_SOURCE=1 feature, providing compile-time and runtime buffer > overflow checks for string.h functions when the compiler determines the > size of the source or destination buffer at compile-time. Unlike glibc, > it covers buffer reads in addition to writes. [...] > Link: http://lkml.kernel.org/r/20170526095404.20439-1-danielmicay@gmail.com > Signed-off-by: Daniel Micay > Acked-by: Kees Cook > Cc: Mark Rutland > Cc: Daniel Axtens > Cc: Rasmus Villemoes > Cc: Andy Shevchenko > Cc: Chris Metcalf > Cc: Thomas Gleixner > Cc: "H. Peter Anvin" > Cc: Ingo Molnar > Signed-off-by: Andrew Morton > [kees: move from -mm, add ARCH_HAS_FORTIFY_SOURCE, tweak Kconfig help] > Signed-off-by: Kees Cook This is now commit 6974f0c4555e285a upstream. > --- a/include/linux/string.h > +++ b/include/linux/string.h > @@ -187,4 +187,204 @@ static inline const char *kbasename(const char *path) > return tail ? tail + 1 : path; > } > > +#define __FORTIFY_INLINE extern __always_inline __attribute__((gnu_inline)) With gcc-4.1.2, I now get zillions of: include/linux/string.h:439: warning: ‘gnu_inline’ attribute directive ignored This attribute seems to be supported as of gcc 4.2? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds