Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1651062 > unrolled thread

Re: [PATCH v3] add the option of fortified string.h functions

Started byKees Cook <keescook@chromium.org>
First post2017-05-26 05:50 +0200
Last post2017-05-26 10:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3] add the option of fortified string.h functions Kees Cook <keescook@chromium.org> - 2017-05-26 05:50 +0200
    Re: [PATCH v3] add the option of fortified string.h functions Daniel Micay <danielmicay@gmail.com> - 2017-05-26 10:40 +0200

#1651062 — Re: [PATCH v3] add the option of fortified string.h functions

FromKees Cook <keescook@chromium.org>
Date2017-05-26 05:50 +0200
SubjectRe: [PATCH v3] add the option of fortified string.h functions
Message-ID<tLeqd-Ek-9@gated-at.bofh.it>
On Mon, May 22, 2017 at 4:10 PM, Daniel Micay <danielmicay@gmail.com> 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

-- 
Kees Cook
Pixel Security

[toc] | [next] | [standalone]


#1651192

FromDaniel Micay <danielmicay@gmail.com>
Date2017-05-26 10:40 +0200
Message-ID<tLiWR-3x5-5@gated-at.bofh.it>
In reply to#1651062
On Thu, 2017-05-25 at 20:40 -0700, Kees Cook wrote:
> On Mon, May 22, 2017 at 4:10 PM, Daniel Micay <danielmicay@gmail.com>
> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web