Skip to contentSkip to conversation

linux-user: Update TASK_UNMAPPED_BASE for aarch64

PATCH Applied Lirong Yuan 3 participants 9 messages Mar 13, 2020 – Mar 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Update TASK_UNMAPPED_BASE for aarch64

This change updates TASK_UNMAPPED_BASE (the base address for guest programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +4 -0
index 8685f02e7e..e378033797 100644
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000
+#else
 # define TASK_UNMAPPED_BASE  (1ul << 38)
+#endif
 #else
 # define TASK_UNMAPPED_BASE  0x40000000
 #endif
Signature · 1 line
2.25.1.481.gfbce0eb801-goog
Reviewed-by on v1 1/1
#1 lore raw

Le 13/03/2020 à 01:28, Lirong Yuan a écrit :

Quoted 15 lines

This change updates TASK_UNMAPPED_BASE (the base address for guest programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 194

Quoted 10 lines
linux-user/mmap.c +4 -0
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000
+#else
 # define TASK_UNMAPPED_BASE  (1ul << 38)
+#endif
 #else
 # define TASK_UNMAPPED_BASE  0x40000000
 #endif
#2 lore raw
In reply to Lirong Yuan

Le 13/03/2020 à 01:28, Lirong Yuan a écrit :

Quoted 15 lines

This change updates TASK_UNMAPPED_BASE (the base address for guest programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 194

Quoted 10 lines
linux-user/mmap.c +4 -0
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000
+#else
 # define TASK_UNMAPPED_BASE  (1ul << 38)
+#endif
 #else
 # define TASK_UNMAPPED_BASE  0x40000000
 #endif

Applied to my linux-user branch.

Thanks,
Laurent

#3 lore raw
Quoted 33 lines · Laurent Vivier
Quoted 1 line · Lirong Yuan

This change updates TASK_UNMAPPED_BASE (the base address for guest

programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:

Quoted 1 line

https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

Quoted 13 lines
---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 194

Quoted 10 lines
linux-user/mmap.c +4 -0
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000
+#else
 # define TASK_UNMAPPED_BASE  (1ul << 38)
+#endif
 #else
 # define TASK_UNMAPPED_BASE  0x40000000
 #endif

Applied to my linux-user branch.

Quoted 3 lines

Thanks,
Laurent

Great, thanks a lot! :)

#4 lore raw
In reply to Lirong Yuan
Quoted 14 lines · Lirong Yuan

This change updates TASK_UNMAPPED_BASE (the base address for guest programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 188

Quoted 5 lines
linux-user/mmap.c +2 -0
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000

Hi, Lirong,

Can you point from which line of the file you linked to did you arrive to the value 0x5500000000?

Second question: What about other targets?

Regards,
Aleksandar

Quoted 10 lines
linux-user/mmap.c +2 -1
+#else
 # define TASK_UNMAPPED_BASE  (1ul << 38)
+#endif
 #else
 # define TASK_UNMAPPED_BASE  0x40000000
 #endif
--

2.25.1.481.gfbce0eb801-goog

#5 lore raw

Le 14/03/2020 à 04:06, Aleksandar Markovic a écrit :

Quoted 23 lines · Lirong Yuan
Quoted 14 lines

This change updates TASK_UNMAPPED_BASE (the base address for guest programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 188

Quoted 5 lines
linux-user/mmap.c +2 -0
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000

Hi, Lirong,

Quoted 4 lines

Can you point from which line of the file you linked to did you arrive to the value 0x5500000000?

Second question: What about other targets?

Personally, I prefer to not change the value for other targets if it is not required by someone that had some problems with the current value.

It needs to be changed carefully and to be well tested after change.

Thanks,
Laurent

#6 lore raw
Quoted 28 lines · Laurent Vivier
Quoted 26 lines · Aleksandar Markovic
Quoted 14 lines · Lirong Yuan

This change updates TASK_UNMAPPED_BASE (the base address for guest programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 188

Quoted 5 lines
linux-user/mmap.c +2 -0
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000

Hi, Lirong,

Can you point from which line of the file you linked to did you arrive to the value 0x5500000000?

Quoted 7 lines
Quoted 1 line

Second question: What about other targets?

Personally, I prefer to not change the value for other targets if it is not required by someone that had some problems with the current value.

It needs to be changed carefully and to be well tested after change.

Sure, but again, from where " 0x5500000000" comes from?

Quoted 2 lines

Thanks,
Laurent

#7 lore raw

Le 14/03/2020 à 18:01, Aleksandar Markovic a écrit :

Quoted 31 lines · Laurent Vivier
Quoted 30 lines · Aleksandar Markovic
Quoted 27 lines · Lirong Yuan
Quoted 14 lines

This change updates TASK_UNMAPPED_BASE (the base address for guest programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 188

Quoted 5 lines
linux-user/mmap.c +2 -0
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000

Hi, Lirong,

Can you point from which line of the file you linked to did you arrive to the value 0x5500000000?

Second question: What about other targets?

Quoted 7 lines
Quoted 5 lines

Personally, I prefer to not change the value for other targets if it is not required by someone that had some problems with the current value.

It needs to be changed carefully and to be well tested after change.

Sure, but again, from where " 0x5500000000" comes from?

The URL is in the comment, but more precisely I guess:

https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h#L164

Thanks,
Laurent

#8 lore raw

Thanks Laurent for the prompt responses! Yes that is exactly where the value is taken from.

For anyone interested in detailed information of the change, here is the previous discussion thread:
http://patchwork.ozlabs.org/patch/1242370/

Regards,
Lirong

Quoted 54 lines · Laurent Vivier
Quoted 1 line · Aleksandar Markovic

On Sat, Mar 14, 2020 at 11:45 AM Laurent Vivier <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines · Aleksandar Markovic
Quoted 3 lines · Lirong Yuan
Quoted 2 lines

This change updates TASK_UNMAPPED_BASE (the base address for guest

programs) for aarch64. It is needed to allow qemu to work with Thread Sanitizer (TSan), which has specific boundary definitions for memory mappings on different platforms:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h

Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
Quoted 11 lines
---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +0 -0
index 8685f02e7e..e378033797 100644

linux-user/mmap.c static int mmap_frag(abi_ulong real_start, · line 188

Quoted 5 lines
linux-user/mmap.c +2 -0
@@ -184,7 +184,11 @@ static int mmap_frag(abi_ulong real_start,
 }
 
 #if HOST_LONG_BITS == 64 && TARGET_ABI_BITS == 64
+#ifdef TARGET_AARCH64
+# define TASK_UNMAPPED_BASE  0x5500000000

Hi, Lirong,

Can you point from which line of the file you linked to did you arrive to the value 0x5500000000?

Second question: What about other targets?

Quoted 7 lines
Quoted 5 lines

Personally, I prefer to not change the value for other targets if it is not required by someone that had some problems with the current value.

It needs to be changed carefully and to be well tested after change.

Sure, but again, from where " 0x5500000000" comes from?

The URL is in the comment, but more precisely I guess:

https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/tsan_platform.h#L164

Thanks,
Laurent