[v2,02/20] hurd: Stop relying on VM_MAX_ADDRESS

Message ID 20240323173301.151066-3-bugaevc@gmail.com
State Committed
Commit 4648bfbbde5466929d24013478697cbdec847b46
Series aarch64-gnu port & GNU/Hurd on AArch64 progress |


Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 fail Patch failed to apply

Commit Message

Sergey Bugaev March 23, 2024, 5:32 p.m. UTC
  We'd like to avoid committing to a specific size of virtual address
space (i.e. the value of VM_AARCH64_T0SZ) on AArch64.  While the current
version of GNU Mach still exports VM_MAX_ADDRESS for compatibility, we
should try to avoid relying on it when we can.  This piece of logic in
_hurdsig_getenv () doesn't actually care about the size of user-
accessible virtual address space, it just wants to preempt faults on any
addresses starting from the value of the P pointer and above.  So, use
(unsigned long int) -1 instead of VM_MAX_ADDRESS.

While at it, change the casts to (unsigned long int) and not just
(long int), since the type of struct hurd_signal_preemptor.{first,last}
is unsigned long int.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
 hurd/hurdsig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 882a0347..8b1928d1 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -1658,8 +1658,8 @@  _hurdsig_getenv (const char *variable)
       while (*ep)
 	  const char *p = *ep;
-	  _hurdsig_fault_preemptor.first = (long int) p;
-	  _hurdsig_fault_preemptor.last = VM_MAX_ADDRESS;
+	  _hurdsig_fault_preemptor.first = (unsigned long int) p;
+	  _hurdsig_fault_preemptor.last = (unsigned long int) -1;
 	  if (! strncmp (p, variable, len) && p[len] == '=')
 	      size_t valuelen;
@@ -1671,8 +1671,8 @@  _hurdsig_getenv (const char *variable)
 		memcpy (value, p, valuelen);
-	  _hurdsig_fault_preemptor.first = (long int) ++ep;
-	  _hurdsig_fault_preemptor.last = (long int) (ep + 1);
+	  _hurdsig_fault_preemptor.first = (unsigned long int) ++ep;
+	  _hurdsig_fault_preemptor.last = (unsigned long int) (ep + 1);
       _hurdsig_end_catch_fault ();
       return value;