public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Samuel Thibault <sthibaul@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] hurd: Stop relying on VM_MAX_ADDRESS
Date: Sat, 23 Mar 2024 22:16:21 +0000 (GMT)	[thread overview]
Message-ID: <20240323221621.3D2153858C32@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4648bfbbde5466929d24013478697cbdec847b46

commit 4648bfbbde5466929d24013478697cbdec847b46
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Sat Mar 23 20:32:43 2024 +0300

    hurd: Stop relying on VM_MAX_ADDRESS
    
    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>
    Message-ID: <20240323173301.151066-3-bugaevc@gmail.com>

Diff:
---
 hurd/hurdsig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 882a03471d..8b1928d1a1 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);
 	      break;
 	    }
-	  _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;

                 reply	other threads:[~2024-03-23 22:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240323221621.3D2153858C32@sourceware.org \
    --to=sthibaul@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).