From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943526AbdEZIha (ORCPT ); Fri, 26 May 2017 04:37:30 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:33588 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934620AbdEZIfJ (ORCPT ); Fri, 26 May 2017 04:35:09 -0400 Message-ID: <1495787706.2392.3.camel@gmail.com> Subject: Re: [PATCH v3] add the option of fortified string.h functions From: Daniel Micay To: Kees Cook , Andrew Morton Cc: "kernel-hardening@lists.openwall.com" , linux-kernel , Mark Rutland , Daniel Axtens Date: Fri, 26 May 2017 04:35:06 -0400 In-Reply-To: References: <20170522231025.30463-1-danielmicay@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.2 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 Thu, 2017-05-25 at 20:40 -0700, Kees Cook wrote: > On Mon, May 22, 2017 at 4:10 PM, Daniel Micay > wrote: > > diff --git a/arch/x86/include/asm/string_64.h > > b/arch/x86/include/asm/string_64.h > > index 733bae07fb29..3c5b26e07b85 100644 > > --- a/arch/x86/include/asm/string_64.h > > +++ b/arch/x86/include/asm/string_64.h > > @@ -77,6 +77,11 @@ int strcmp(const char *cs, const char *ct); > > #define memcpy(dst, src, len) __memcpy(dst, src, len) > > #define memmove(dst, src, len) __memmove(dst, src, len) > > #define memset(s, c, n) __memset(s, c, n) > > + > > +#ifndef __NO_FORTIFY > > +#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. > > */ > > +#endif > > + > > #endif > > > > #define __HAVE_ARCH_MEMCPY_MCSAFE 1 > > Ah-ha, this same KASAN exclusion is missing for string_32.h, which is > what I think akpm tripped over in build tests. > > -Kees It's not KASAN-related but rather some cruft that's still around in the 32-bit x86 header. It unnecessarily defines memcpy as __builtin_memcpy even though the built-in is already used on modern GCC, while the 64-bit header only does a similar define for GCC < 4.3. I'll just make it stop doing that with fortify enabled.