public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
@ 2018-11-12 12:03 Martin Liška
  2018-11-12 12:07 ` Jakub Jelinek
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Liška @ 2018-11-12 12:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

Hi.

The patch reject usage of the mentioned options.

Ready for trunk?
Thanks,
Martin

gcc/ChangeLog:

2018-11-12  Martin Liska  <mliska@suse.cz>

	PR sanitizer/87930
	* config/i386/i386.c (ix86_option_override_internal): Error
	about usage -mabi=ms and -fsanitize={,kernel-}address.
---
 gcc/config/i386/i386.c | 5 +++++
 1 file changed, 5 insertions(+)



[-- Attachment #2: 0001-Do-not-allow-mabi-ms-and-fsanitize-kernel-address-PR.patch --]
[-- Type: text/x-patch, Size: 823 bytes --]

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 711bec0cc9d..b3e0807b894 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3546,6 +3546,11 @@ ix86_option_override_internal (bool main_args_p,
     error ("-mabi=ms not supported with X32 ABI");
   gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
 
+  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+    error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>");
+  if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+    error ("%<-mabi=ms%> not supported with %<-fsanitize=kernel-address%>");
+
   /* For targets using ms ABI enable ms-extensions, if not
      explicit turned off.  For non-ms ABI we turn off this
      option.  */


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
  2018-11-12 12:03 [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930) Martin Liška
@ 2018-11-12 12:07 ` Jakub Jelinek
  2018-11-13 15:02   ` Martin Liška
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2018-11-12 12:07 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

On Mon, Nov 12, 2018 at 01:03:41PM +0100, Martin Liška wrote:
> The patch reject usage of the mentioned options.
> 
> Ready for trunk?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2018-11-12  Martin Liska  <mliska@suse.cz>
> 
> 	PR sanitizer/87930
> 	* config/i386/i386.c (ix86_option_override_internal): Error
> 	about usage -mabi=ms and -fsanitize={,kernel-}address.

Please add testcases for this.  Can this be changed through attribute too?
If so, a test for that should be there too.

> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -3546,6 +3546,11 @@ ix86_option_override_internal (bool main_args_p,
>      error ("-mabi=ms not supported with X32 ABI");
>    gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
>  
> +  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_ix86_abi == MS_ABI)
> +    error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>");
> +  if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI)
> +    error ("%<-mabi=ms%> not supported with %<-fsanitize=kernel-address%>");
> +
>    /* For targets using ms ABI enable ms-extensions, if not
>       explicit turned off.  For non-ms ABI we turn off this
>       option.  */
> 


	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
  2018-11-12 12:07 ` Jakub Jelinek
@ 2018-11-13 15:02   ` Martin Liška
  2018-11-13 15:09     ` Jakub Jelinek
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Liška @ 2018-11-13 15:02 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]

On 11/12/18 1:07 PM, Jakub Jelinek wrote:
> On Mon, Nov 12, 2018 at 01:03:41PM +0100, Martin Liška wrote:
>> The patch reject usage of the mentioned options.
>>
>> Ready for trunk?
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 2018-11-12  Martin Liska  <mliska@suse.cz>
>>
>> 	PR sanitizer/87930
>> 	* config/i386/i386.c (ix86_option_override_internal): Error
>> 	about usage -mabi=ms and -fsanitize={,kernel-}address.
> 
> Please add testcases for this. 

Done in attached patch.

Can this be changed through attribute too?

No.

I'm going to install the patch.

Thanks,
Martin

> If so, a test for that should be there too.
> 
>> --- a/gcc/config/i386/i386.c
>> +++ b/gcc/config/i386/i386.c
>> @@ -3546,6 +3546,11 @@ ix86_option_override_internal (bool main_args_p,
>>      error ("-mabi=ms not supported with X32 ABI");
>>    gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
>>  
>> +  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_ix86_abi == MS_ABI)
>> +    error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>");
>> +  if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI)
>> +    error ("%<-mabi=ms%> not supported with %<-fsanitize=kernel-address%>");
>> +
>>    /* For targets using ms ABI enable ms-extensions, if not
>>       explicit turned off.  For non-ms ABI we turn off this
>>       option.  */
>>
> 
> 
> 	Jakub
> 


[-- Attachment #2: 0001-Do-not-allow-mabi-ms-and-fsanitize-kernel-address-PR.patch --]
[-- Type: text/x-patch, Size: 2023 bytes --]

From 7720cb384b33835a29beaaddb4a940a5eeadb13f Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 12 Nov 2018 12:55:33 +0100
Subject: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR
 sanitizer/87930).

gcc/ChangeLog:

2018-11-12  Martin Liska  <mliska@suse.cz>

	PR sanitizer/87930
	* config/i386/i386.c (ix86_option_override_internal): Error
	about usage -mabi=ms and -fsanitize={,kernel-}address.

gcc/testsuite/ChangeLog:

2018-11-13  Martin Liska  <mliska@suse.cz>

	PR sanitizer/87930
	* gcc.target/i386/pr87930.c: New test.
---
 gcc/config/i386/i386.c                  | 5 +++++
 gcc/testsuite/gcc.target/i386/pr87930.c | 6 ++++++
 2 files changed, 11 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr87930.c

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 711bec0cc9d..b3e0807b894 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3546,6 +3546,11 @@ ix86_option_override_internal (bool main_args_p,
     error ("-mabi=ms not supported with X32 ABI");
   gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
 
+  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+    error ("%<-mabi=ms%> not supported with %<-fsanitize=address%>");
+  if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_ix86_abi == MS_ABI)
+    error ("%<-mabi=ms%> not supported with %<-fsanitize=kernel-address%>");
+
   /* For targets using ms ABI enable ms-extensions, if not
      explicit turned off.  For non-ms ABI we turn off this
      option.  */
diff --git a/gcc/testsuite/gcc.target/i386/pr87930.c b/gcc/testsuite/gcc.target/i386/pr87930.c
new file mode 100644
index 00000000000..e9cf29c221a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr87930.c
@@ -0,0 +1,6 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-fsanitize=address -mabi=ms" } */
+
+int i;
+
+/* { dg-error ".-mabi=ms. not supported with .-fsanitize=address." "" { target *-*-* } 0 } */
-- 
2.19.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
  2018-11-13 15:02   ` Martin Liška
@ 2018-11-13 15:09     ` Jakub Jelinek
  2018-11-13 15:25       ` Martin Liška
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2018-11-13 15:09 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

On Tue, Nov 13, 2018 at 04:01:56PM +0100, Martin Liška wrote:
> On 11/12/18 1:07 PM, Jakub Jelinek wrote:
> > On Mon, Nov 12, 2018 at 01:03:41PM +0100, Martin Liška wrote:
> >> The patch reject usage of the mentioned options.
> >>
> >> Ready for trunk?
> >> Thanks,
> >> Martin
> >>
> >> gcc/ChangeLog:
> >>
> >> 2018-11-12  Martin Liska  <mliska@suse.cz>
> >>
> >> 	PR sanitizer/87930
> >> 	* config/i386/i386.c (ix86_option_override_internal): Error
> >> 	about usage -mabi=ms and -fsanitize={,kernel-}address.
> > 
> > Please add testcases for this. 
> 
> Done in attached patch.
> 
> Can this be changed through attribute too?
> 
> No.
> 
> I'm going to install the patch.

Can you please move the test to gcc.dg/asan/ and guard with
{ i?86-*-* x86_64-*-* } && lp64 ?
I don't think we don't want -fsanitize=address tests outside of /asan/
subdirs where we guard them on the availability of asan.

	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
  2018-11-13 15:09     ` Jakub Jelinek
@ 2018-11-13 15:25       ` Martin Liška
  2018-11-13 15:26         ` Jakub Jelinek
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Liška @ 2018-11-13 15:25 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

On 11/13/18 4:08 PM, Jakub Jelinek wrote:
> On Tue, Nov 13, 2018 at 04:01:56PM +0100, Martin Liška wrote:
>> On 11/12/18 1:07 PM, Jakub Jelinek wrote:
>>> On Mon, Nov 12, 2018 at 01:03:41PM +0100, Martin Liška wrote:
>>>> The patch reject usage of the mentioned options.
>>>>
>>>> Ready for trunk?
>>>> Thanks,
>>>> Martin
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>> 2018-11-12  Martin Liska  <mliska@suse.cz>
>>>>
>>>> 	PR sanitizer/87930
>>>> 	* config/i386/i386.c (ix86_option_override_internal): Error
>>>> 	about usage -mabi=ms and -fsanitize={,kernel-}address.
>>>
>>> Please add testcases for this. 
>>
>> Done in attached patch.
>>
>> Can this be changed through attribute too?
>>
>> No.
>>
>> I'm going to install the patch.
> 
> Can you please move the test to gcc.dg/asan/ and guard with
> { i?86-*-* x86_64-*-* } && lp64 ?
> I don't think we don't want -fsanitize=address tests outside of /asan/
> subdirs where we guard them on the availability of asan.
> 
> 	Jakub
> 

Sure, there's a patch I've just tested.

Martin

[-- Attachment #2: 0001-Move-a-test-case-to-a-proper-folder.patch --]
[-- Type: text/x-patch, Size: 1066 bytes --]

From 89aa27fb5d816c7d854cd77ba0f157d69bc927f7 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 13 Nov 2018 16:23:08 +0100
Subject: [PATCH] Move a test-case to a proper folder.

ChangeLog:

2018-11-13  Martin Liska  <mliska@suse.cz>

	* pr87930.c: Move from gcc/testsuite/gcc.target/i386/
	into gcc/testsuite/gcc.dg/asan/.
---
 gcc/testsuite/{gcc.target/i386 => gcc.dg/asan}/pr87930.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename gcc/testsuite/{gcc.target/i386 => gcc.dg/asan}/pr87930.c (68%)

diff --git a/gcc/testsuite/gcc.target/i386/pr87930.c b/gcc/testsuite/gcc.dg/asan/pr87930.c
similarity index 68%
rename from gcc/testsuite/gcc.target/i386/pr87930.c
rename to gcc/testsuite/gcc.dg/asan/pr87930.c
index e9cf29c221a..4f8e6999fde 100644
--- a/gcc/testsuite/gcc.target/i386/pr87930.c
+++ b/gcc/testsuite/gcc.dg/asan/pr87930.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target lp64 } } */
+/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
 /* { dg-options "-fsanitize=address -mabi=ms" } */
 
 int i;
-- 
2.19.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
  2018-11-13 15:25       ` Martin Liška
@ 2018-11-13 15:26         ` Jakub Jelinek
  2018-11-13 15:29           ` Martin Liška
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2018-11-13 15:26 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

On Tue, Nov 13, 2018 at 04:24:39PM +0100, Martin Liška wrote:
> 2018-11-13  Martin Liska  <mliska@suse.cz>
> 
> 	* pr87930.c: Move from gcc/testsuite/gcc.target/i386/
> 	into gcc/testsuite/gcc.dg/asan/.

	* gcc.target/i386/pr87930.c: Move to ...
	* gcc.dg/asan/pr87930.c: ... here.  Guard for i?86/x86_64 targets.

Ok with that change.

> ---
>  gcc/testsuite/{gcc.target/i386 => gcc.dg/asan}/pr87930.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>  rename gcc/testsuite/{gcc.target/i386 => gcc.dg/asan}/pr87930.c (68%)
> 
> diff --git a/gcc/testsuite/gcc.target/i386/pr87930.c b/gcc/testsuite/gcc.dg/asan/pr87930.c
> similarity index 68%
> rename from gcc/testsuite/gcc.target/i386/pr87930.c
> rename to gcc/testsuite/gcc.dg/asan/pr87930.c
> index e9cf29c221a..4f8e6999fde 100644
> --- a/gcc/testsuite/gcc.target/i386/pr87930.c
> +++ b/gcc/testsuite/gcc.dg/asan/pr87930.c
> @@ -1,4 +1,4 @@
> -/* { dg-do compile { target lp64 } } */
> +/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
>  /* { dg-options "-fsanitize=address -mabi=ms" } */
>  
>  int i;
> -- 
> 2.19.1
> 


	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930).
  2018-11-13 15:26         ` Jakub Jelinek
@ 2018-11-13 15:29           ` Martin Liška
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Liška @ 2018-11-13 15:29 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 11/13/18 4:26 PM, Jakub Jelinek wrote:
> On Tue, Nov 13, 2018 at 04:24:39PM +0100, Martin Liška wrote:
>> 2018-11-13  Martin Liska  <mliska@suse.cz>
>>
>> 	* pr87930.c: Move from gcc/testsuite/gcc.target/i386/
>> 	into gcc/testsuite/gcc.dg/asan/.
> 
> 	* gcc.target/i386/pr87930.c: Move to ...
> 	* gcc.dg/asan/pr87930.c: ... here.  Guard for i?86/x86_64 targets.
> 
> Ok with that change.

Thanks, installed as r266076.

Martin

> 
>> ---
>>  gcc/testsuite/{gcc.target/i386 => gcc.dg/asan}/pr87930.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>  rename gcc/testsuite/{gcc.target/i386 => gcc.dg/asan}/pr87930.c (68%)
>>
>> diff --git a/gcc/testsuite/gcc.target/i386/pr87930.c b/gcc/testsuite/gcc.dg/asan/pr87930.c
>> similarity index 68%
>> rename from gcc/testsuite/gcc.target/i386/pr87930.c
>> rename to gcc/testsuite/gcc.dg/asan/pr87930.c
>> index e9cf29c221a..4f8e6999fde 100644
>> --- a/gcc/testsuite/gcc.target/i386/pr87930.c
>> +++ b/gcc/testsuite/gcc.dg/asan/pr87930.c
>> @@ -1,4 +1,4 @@
>> -/* { dg-do compile { target lp64 } } */
>> +/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
>>  /* { dg-options "-fsanitize=address -mabi=ms" } */
>>  
>>  int i;
>> -- 
>> 2.19.1
>>
> 
> 
> 	Jakub
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-13 15:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 12:03 [PATCH] Do not allow -mabi=ms and -fsanitize={,kernel-}address (PR sanitizer/87930) Martin Liška
2018-11-12 12:07 ` Jakub Jelinek
2018-11-13 15:02   ` Martin Liška
2018-11-13 15:09     ` Jakub Jelinek
2018-11-13 15:25       ` Martin Liška
2018-11-13 15:26         ` Jakub Jelinek
2018-11-13 15:29           ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).