public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] riscv: update riscv_asan_shadow_offset
@ 2023-05-30  8:42 Andreas Schwab
  2023-05-30  9:02 ` Kito Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2023-05-30  8:42 UTC (permalink / raw)
  To: gcc-patches

This fixes all asan tests, apart from
c-c++-common/asan/pointer-compare-1.c which needs a workaround for PR
sanitizer/82501.

	PR target/110036
	* config/riscv/riscv.cc (riscv_asan_shadow_offset): Update to
	match libsanitizer.
---
 gcc/config/riscv/riscv.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 09fc9e5d95e..b358ca8b5d0 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -7043,10 +7043,9 @@ riscv_asan_shadow_offset (void)
 {
   /* We only have libsanitizer support for RV64 at present.
 
-     This number must match kRiscv*_ShadowOffset* in the file
-     libsanitizer/asan/asan_mapping.h which is currently 1<<29 for rv64,
-     even though 1<<36 makes more sense.  */
-  return TARGET_64BIT ? (HOST_WIDE_INT_1 << 29) : 0;
+     This number must match ASAN_SHADOW_OFFSET_CONST in the file
+     libsanitizer/asan/asan_mapping.h.  */
+  return TARGET_64BIT ? HOST_WIDE_INT_UC (0xd55550000) : 0;
 }
 
 /* Implement TARGET_MANGLE_TYPE.  */
-- 
2.40.1


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] riscv: update riscv_asan_shadow_offset
  2023-05-30  8:42 [PATCH] riscv: update riscv_asan_shadow_offset Andreas Schwab
@ 2023-05-30  9:02 ` Kito Cheng
  2023-05-30  9:36   ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Kito Cheng @ 2023-05-30  9:02 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

LGTM, I remember Luís updated[1] that, but apparently I forgot sync this to gcc,

and just to remind, I plan to change that to dynamic offset[2] to make
that work on Sv39, Sv48 and Sv57,
but we are still running testing and debugging to make sure LSAN works well...

[1] https://reviews.llvm.org/D97646
[2] https://reviews.llvm.org/D139827

On Tue, May 30, 2023 at 4:43 PM Andreas Schwab via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This fixes all asan tests, apart from
> c-c++-common/asan/pointer-compare-1.c which needs a workaround for PR
> sanitizer/82501.
>
>         PR target/110036
>         * config/riscv/riscv.cc (riscv_asan_shadow_offset): Update to
>         match libsanitizer.
> ---
>  gcc/config/riscv/riscv.cc | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
> index 09fc9e5d95e..b358ca8b5d0 100644
> --- a/gcc/config/riscv/riscv.cc
> +++ b/gcc/config/riscv/riscv.cc
> @@ -7043,10 +7043,9 @@ riscv_asan_shadow_offset (void)
>  {
>    /* We only have libsanitizer support for RV64 at present.
>
> -     This number must match kRiscv*_ShadowOffset* in the file
> -     libsanitizer/asan/asan_mapping.h which is currently 1<<29 for rv64,
> -     even though 1<<36 makes more sense.  */
> -  return TARGET_64BIT ? (HOST_WIDE_INT_1 << 29) : 0;
> +     This number must match ASAN_SHADOW_OFFSET_CONST in the file
> +     libsanitizer/asan/asan_mapping.h.  */
> +  return TARGET_64BIT ? HOST_WIDE_INT_UC (0xd55550000) : 0;
>  }
>
>  /* Implement TARGET_MANGLE_TYPE.  */
> --
> 2.40.1
>
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

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

* Re: [PATCH] riscv: update riscv_asan_shadow_offset
  2023-05-30  9:02 ` Kito Cheng
@ 2023-05-30  9:36   ` Andreas Schwab
  2023-05-30 11:04     ` Kito Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2023-05-30  9:36 UTC (permalink / raw)
  To: Kito Cheng; +Cc: gcc-patches

Ok for 12 and 13 branch?

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] riscv: update riscv_asan_shadow_offset
  2023-05-30  9:36   ` Andreas Schwab
@ 2023-05-30 11:04     ` Kito Cheng
  0 siblings, 0 replies; 4+ messages in thread
From: Kito Cheng @ 2023-05-30 11:04 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GCC Patches

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

Andreas Schwab via Gcc-patches <gcc-patches@gcc.gnu.org> 於 2023年5月30日 週二
17:37 寫道:

> Ok for 12 and 13 branch?
>

Yes, thanks!


> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
>

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

end of thread, other threads:[~2023-05-30 11:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30  8:42 [PATCH] riscv: update riscv_asan_shadow_offset Andreas Schwab
2023-05-30  9:02 ` Kito Cheng
2023-05-30  9:36   ` Andreas Schwab
2023-05-30 11:04     ` Kito Cheng

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).