Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-23 Thread Sami Tolvanen
On Tue, Oct 22, 2019 at 9:28 AM Mark Rutland wrote: > I think it would be preferable to follow the example of CC_FLAGS_FTRACE > so that this can be filtered out, e.g. > > ifdef CONFIG_SHADOW_CALL_STACK > CFLAGS_SCS := -fsanitize=shadow-call-stack > KBUILD_CFLAGS += $(CFLAGS_SCS) > export

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-22 Thread Sami Tolvanen
On Tue, Oct 22, 2019 at 9:28 AM Mark Rutland wrote: > I think it would be preferable to follow the example of CC_FLAGS_FTRACE > so that this can be filtered out, e.g. > > ifdef CONFIG_SHADOW_CALL_STACK > CFLAGS_SCS := -fsanitize=shadow-call-stack > KBUILD_CFLAGS += $(CFLAGS_SCS) > export

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-22 Thread Mark Rutland
On Tue, Oct 22, 2019 at 09:30:53AM -0700, Kees Cook wrote: > On Tue, Oct 22, 2019 at 05:28:27PM +0100, Mark Rutland wrote: > > On Fri, Oct 18, 2019 at 09:10:21AM -0700, Sami Tolvanen wrote: > > > +ifdef CONFIG_SHADOW_CALL_STACK > > > +KBUILD_CFLAGS+= -fsanitize=shadow-call-stack > > >

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-22 Thread Kees Cook
On Tue, Oct 22, 2019 at 05:28:27PM +0100, Mark Rutland wrote: > On Fri, Oct 18, 2019 at 09:10:21AM -0700, Sami Tolvanen wrote: > > This change adds generic support for Clang's Shadow Call Stack, which > > uses a shadow stack to protect return addresses from being overwritten > > by an attacker.

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-22 Thread Mark Rutland
On Fri, Oct 18, 2019 at 09:10:21AM -0700, Sami Tolvanen wrote: > This change adds generic support for Clang's Shadow Call Stack, which > uses a shadow stack to protect return addresses from being overwritten > by an attacker. Details are available here: > >

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Miguel Ojeda
On Fri, Oct 18, 2019 at 10:33 PM Nick Desaulniers wrote: > > Sami pointed out to me off thread that __has_attribute would only > check `no_sanitize`, not `shadow-call-stack`. So maybe best to keep > the definition here (include/linux/compiler-clang.h), but wrapped in a > `__has_feature` check so

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Nick Desaulniers
On Fri, Oct 18, 2019 at 11:33 AM Miguel Ojeda wrote: > > On Fri, Oct 18, 2019 at 7:11 PM Sami Tolvanen wrote: > > > > On Fri, Oct 18, 2019 at 10:08 AM 'Nick Desaulniers' via Clang Built > > Linux wrote: > > > > diff --git a/include/linux/compiler-clang.h > > > >

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Miguel Ojeda
On Fri, Oct 18, 2019 at 7:11 PM Sami Tolvanen wrote: > > On Fri, Oct 18, 2019 at 10:08 AM 'Nick Desaulniers' via Clang Built > Linux wrote: > > > diff --git a/include/linux/compiler-clang.h > > > b/include/linux/compiler-clang.h > > > index 333a6695a918..9af08391f205 100644 > > > ---

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Sami Tolvanen
On Fri, Oct 18, 2019 at 10:42 AM Jann Horn wrote: > (As I mentioned in the other thread, the security documentation there > doesn't fit the kernel usecase.) True. I'll add a note about it here too. > Without CONFIG_SHADOW_CALL_STACK_VMAP, after 128 small stack frames, > you overflow into random

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Jann Horn
On Fri, Oct 18, 2019 at 6:14 PM Sami Tolvanen wrote: > This change adds generic support for Clang's Shadow Call Stack, which > uses a shadow stack to protect return addresses from being overwritten > by an attacker. Details are available here: > >

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Sami Tolvanen
On Fri, Oct 18, 2019 at 10:08 AM 'Nick Desaulniers' via Clang Built Linux wrote: > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > > index 333a6695a918..9af08391f205 100644 > > --- a/include/linux/compiler-clang.h > > +++ b/include/linux/compiler-clang.h > > @@

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Nick Desaulniers
On Fri, Oct 18, 2019 at 9:11 AM Sami Tolvanen wrote: > > This change adds generic support for Clang's Shadow Call Stack, which > uses a shadow stack to protect return addresses from being overwritten > by an attacker. Details are available here: > >

Re: [PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Joe Perches
On Fri, 2019-10-18 at 09:10 -0700, Sami Tolvanen wrote: > This change adds generic support for Clang's Shadow Call Stack, which > uses a shadow stack to protect return addresses from being overwritten > by an attacker [] > .diff --git a/include/linux/compiler-clang.h

[PATCH 06/18] add support for Clang's Shadow Call Stack (SCS)

2019-10-18 Thread Sami Tolvanen
This change adds generic support for Clang's Shadow Call Stack, which uses a shadow stack to protect return addresses from being overwritten by an attacker. Details are available here: https://clang.llvm.org/docs/ShadowCallStack.html Signed-off-by: Sami Tolvanen --- Makefile