public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] alpha: Fix generic brk system call emulation in __brk_call (bug 29490)
@ 2022-08-17  6:30 Florian Weimer
  2022-08-22  9:07 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2022-08-17  6:30 UTC (permalink / raw)
  To: libc-alpha; +Cc: matoro_bugzilla_glibc, sam

The kernel special-cases the zero argument for alpha brk, and we can
use that to restore the generic Linux error handling behavior.

This change fixes an ldconfig crash under qemu-user for me.

---
 sysdeps/unix/sysv/linux/alpha/brk_call.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/brk_call.h b/sysdeps/unix/sysv/linux/alpha/brk_call.h
index b8088cf13f..0b851b6c86 100644
--- a/sysdeps/unix/sysv/linux/alpha/brk_call.h
+++ b/sysdeps/unix/sysv/linux/alpha/brk_call.h
@@ -21,8 +21,7 @@ __brk_call (void *addr)
 {
   unsigned long int result = INTERNAL_SYSCALL_CALL (brk, addr);
   if (result == -ENOMEM)
-    /* Mimic the default error reporting behavior.  */
-    return addr;
-  else
-    return (void *) result;
+    /* Mimic the generic error reporting behavior.  */
+    result = INTERNAL_SYSCALL_CALL (brk, 0);
+  return (void *) result;
 }


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

* Re: [PATCH] alpha: Fix generic brk system call emulation in __brk_call (bug 29490)
  2022-08-17  6:30 [PATCH] alpha: Fix generic brk system call emulation in __brk_call (bug 29490) Florian Weimer
@ 2022-08-22  9:07 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2022-08-22  9:07 UTC (permalink / raw)
  To: Florian Weimer via Libc-alpha; +Cc: matoro_bugzilla_glibc

* Florian Weimer via Libc-alpha:

> The kernel special-cases the zero argument for alpha brk, and we can
> use that to restore the generic Linux error handling behavior.
>
> This change fixes an ldconfig crash under qemu-user for me.
>
> ---
>  sysdeps/unix/sysv/linux/alpha/brk_call.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/alpha/brk_call.h b/sysdeps/unix/sysv/linux/alpha/brk_call.h
> index b8088cf13f..0b851b6c86 100644
> --- a/sysdeps/unix/sysv/linux/alpha/brk_call.h
> +++ b/sysdeps/unix/sysv/linux/alpha/brk_call.h
> @@ -21,8 +21,7 @@ __brk_call (void *addr)
>  {
>    unsigned long int result = INTERNAL_SYSCALL_CALL (brk, addr);
>    if (result == -ENOMEM)
> -    /* Mimic the default error reporting behavior.  */
> -    return addr;
> -  else
> -    return (void *) result;
> +    /* Mimic the generic error reporting behavior.  */
> +    result = INTERNAL_SYSCALL_CALL (brk, 0);
> +  return (void *) result;
>  }

I've pushed this because I received confirmation on the bug that this
fixes things.

Thanks,
Florian


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

end of thread, other threads:[~2022-08-22  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17  6:30 [PATCH] alpha: Fix generic brk system call emulation in __brk_call (bug 29490) Florian Weimer
2022-08-22  9:07 ` Florian Weimer

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