public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] hurd: Make dl-sysdep __sbrk check __vm_allocate call
@ 2023-01-02 10:36 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-01-02 10:36 UTC (permalink / raw)
  To: glibc-cvs

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

commit b7a5fec8b04edb505f51c207ae50b6777c2c55b2
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Mon Jan 2 01:49:59 2023 +0100

    hurd: Make dl-sysdep __sbrk check __vm_allocate call
    
    The caller won't be able to progress, but better crash than use random
    addr.

Diff:
---
 sysdeps/mach/hurd/dl-sysdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 2f022ee90c..84fe966efe 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -699,7 +699,8 @@ void *weak_function
 __sbrk (intptr_t increment)
 {
   vm_address_t addr;
-  __vm_allocate (__mach_task_self (), &addr, increment, 1);
+  if (__vm_allocate (__mach_task_self (), &addr, increment, 1))
+    return NULL;
   return (void *) addr;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-02 10:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 10:36 [glibc] hurd: Make dl-sysdep __sbrk check __vm_allocate call Samuel Thibault

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