2020-05-05 14:16:30

by Thomas Gleixner

[permalink] [raw]
Subject: [patch V4 part 1 19/36] x86/entry: Exclude low level entry code from sanitizing

The sanitizers are not really applicable to the fragile low level entry
code. code. Entry code needs to carefully setup a normal 'runtime'
environment.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
---
arch/x86/entry/Makefile | 8 ++++++++
1 file changed, 8 insertions(+)

--- a/arch/x86/entry/Makefile
+++ b/arch/x86/entry/Makefile
@@ -3,6 +3,14 @@
# Makefile for the x86 low level entry code
#

+KASAN_SANITIZE := n
+UBSAN_SANITIZE := n
+KCOV_INSTRUMENT := n
+
+CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
+CFLAGS_REMOVE_syscall_32.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
+CFLAGS_REMOVE_syscall_64.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
+
OBJECT_FILES_NON_STANDARD_entry_64_compat.o := y

CFLAGS_syscall_64.o += $(call cc-option,-Wno-override-init,)


2020-05-05 20:41:56

by Brian Gerst

[permalink] [raw]
Subject: Re: [patch V4 part 1 19/36] x86/entry: Exclude low level entry code from sanitizing

On Tue, May 5, 2020 at 10:13 AM Thomas Gleixner <[email protected]> wrote:
>
> The sanitizers are not really applicable to the fragile low level entry
> code. code. Entry code needs to carefully setup a normal 'runtime'
> environment.
>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> arch/x86/entry/Makefile | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> --- a/arch/x86/entry/Makefile
> +++ b/arch/x86/entry/Makefile
> @@ -3,6 +3,14 @@
> # Makefile for the x86 low level entry code
> #
>
> +KASAN_SANITIZE := n
> +UBSAN_SANITIZE := n
> +KCOV_INSTRUMENT := n
> +
> +CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
> +CFLAGS_REMOVE_syscall_32.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
> +CFLAGS_REMOVE_syscall_64.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong

Is this necessary for syscall_*.o? They just contain the syscall
tables (ie. data).

--
Brian Gerst

2020-05-06 15:47:44

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [patch V4 part 1 19/36] x86/entry: Exclude low level entry code from sanitizing

On Tue, May 05, 2020 at 04:39:01PM -0400, Brian Gerst wrote:
> On Tue, May 5, 2020 at 10:13 AM Thomas Gleixner <[email protected]> wrote:
> >
> > The sanitizers are not really applicable to the fragile low level entry
> > code. code. Entry code needs to carefully setup a normal 'runtime'
> > environment.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> > Signed-off-by: Thomas Gleixner <[email protected]>
> > ---
> > arch/x86/entry/Makefile | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > --- a/arch/x86/entry/Makefile
> > +++ b/arch/x86/entry/Makefile
> > @@ -3,6 +3,14 @@
> > # Makefile for the x86 low level entry code
> > #
> >
> > +KASAN_SANITIZE := n
> > +UBSAN_SANITIZE := n
> > +KCOV_INSTRUMENT := n
> > +
> > +CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
> > +CFLAGS_REMOVE_syscall_32.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
> > +CFLAGS_REMOVE_syscall_64.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
>
> Is this necessary for syscall_*.o? They just contain the syscall
> tables (ie. data).

Proabaly not, but I just made sure to kill everything, less chance an
accident happens.

2020-05-06 19:30:18

by Alexandre Chartre

[permalink] [raw]
Subject: Re: [patch V4 part 1 19/36] x86/entry: Exclude low level entry code from sanitizing


On 5/5/20 3:16 PM, Thomas Gleixner wrote:
> The sanitizers are not really applicable to the fragile low level entry
> code. code. Entry code needs to carefully setup a normal 'runtime'

typo: code. code.

Reviewed-by: Alexandre Chartre <[email protected]>

alex.


> environment.
>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> Signed-off-by: Thomas Gleixner <[email protected]>
> ---
> arch/x86/entry/Makefile | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> --- a/arch/x86/entry/Makefile
> +++ b/arch/x86/entry/Makefile
> @@ -3,6 +3,14 @@
> # Makefile for the x86 low level entry code
> #
>
> +KASAN_SANITIZE := n
> +UBSAN_SANITIZE := n
> +KCOV_INSTRUMENT := n
> +
> +CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
> +CFLAGS_REMOVE_syscall_32.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
> +CFLAGS_REMOVE_syscall_64.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
> +
> OBJECT_FILES_NON_STANDARD_entry_64_compat.o := y
>
> CFLAGS_syscall_64.o += $(call cc-option,-Wno-override-init,)
>

2020-05-13 23:02:37

by Mathieu Desnoyers

[permalink] [raw]
Subject: Re: [patch V4 part 1 19/36] x86/entry: Exclude low level entry code from sanitizing

----- On May 6, 2020, at 12:03 PM, Alexandre Chartre [email protected] wrote:

> On 5/5/20 3:16 PM, Thomas Gleixner wrote:
>> The sanitizers are not really applicable to the fragile low level entry
>> code. code. Entry code needs to carefully setup a normal 'runtime'
>
> typo: code. code.

Looking at updated tree, the reviewed-by is there, but there is still
way too much "code". ;)

Thanks,

Mathieu

>
> Reviewed-by: Alexandre Chartre <[email protected]>
>
> alex.
>
>
>> environment.
>>
>> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
>> Signed-off-by: Thomas Gleixner <[email protected]>
>> ---
>> arch/x86/entry/Makefile | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> --- a/arch/x86/entry/Makefile
>> +++ b/arch/x86/entry/Makefile
>> @@ -3,6 +3,14 @@
>> # Makefile for the x86 low level entry code
>> #
>>
>> +KASAN_SANITIZE := n
>> +UBSAN_SANITIZE := n
>> +KCOV_INSTRUMENT := n
>> +
>> +CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) -fstack-protector
>> -fstack-protector-strong
>> +CFLAGS_REMOVE_syscall_32.o = $(CC_FLAGS_FTRACE) -fstack-protector
>> -fstack-protector-strong
>> +CFLAGS_REMOVE_syscall_64.o = $(CC_FLAGS_FTRACE) -fstack-protector
>> -fstack-protector-strong
>> +
>> OBJECT_FILES_NON_STANDARD_entry_64_compat.o := y
>>
>> CFLAGS_syscall_64.o += $(call cc-option,-Wno-override-init,)

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Subject: [tip: x86/entry] x86/entry: Exclude low level entry code from sanitizing

The following commit has been merged into the x86/entry branch of tip:

Commit-ID: d13c070160256152bbc5d2072d39a339846fa5b7
Gitweb: https://git.kernel.org/tip/d13c070160256152bbc5d2072d39a339846fa5b7
Author: Peter Zijlstra <[email protected]>
AuthorDate: Thu, 05 Mar 2020 14:01:25 +01:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Fri, 15 May 2020 20:03:05 +02:00

x86/entry: Exclude low level entry code from sanitizing

The sanitizers are not really applicable to the fragile low level entry
code. Entry code needs to carefully setup a normal 'runtime' environment.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Alexandre Chartre <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]

---
arch/x86/entry/Makefile | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile
index 85eb381..cdf45ff 100644
--- a/arch/x86/entry/Makefile
+++ b/arch/x86/entry/Makefile
@@ -3,6 +3,14 @@
# Makefile for the x86 low level entry code
#

+KASAN_SANITIZE := n
+UBSAN_SANITIZE := n
+KCOV_INSTRUMENT := n
+
+CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
+CFLAGS_REMOVE_syscall_32.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
+CFLAGS_REMOVE_syscall_64.o = $(CC_FLAGS_FTRACE) -fstack-protector -fstack-protector-strong
+
OBJECT_FILES_NON_STANDARD_entry_64_compat.o := y

CFLAGS_syscall_64.o += $(call cc-option,-Wno-override-init,)