public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
@ 2022-09-29 19:27 Adhemerval Zanella
  2022-09-29 19:27 ` [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624) Adhemerval Zanella
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Adhemerval Zanella @ 2022-09-29 19:27 UTC (permalink / raw)
  To: libc-alpha, Wilco Dijkstra, Yu Chien Peter Lin

Using an unsigned type prevents the fallback to be used if kernel
does not support getrandom syscall.

Checked on x86_64-linux-gnu.
---
 stdlib/arc4random.c                  | 2 +-
 sysdeps/unix/sysv/linux/not-cancel.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
index e417ef624d..960a38f295 100644
--- a/stdlib/arc4random.c
+++ b/stdlib/arc4random.c
@@ -34,7 +34,7 @@ void
 __arc4random_buf (void *p, size_t n)
 {
   static int seen_initialized;
-  size_t l;
+  ssize_t l;
   int fd;
 
   if (n == 0)
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index a263d294b1..cf35c8bfc9 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
   INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
 }
 
-static inline int
+static inline ssize_t
 __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
 {
   return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);
-- 
2.34.1


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

* [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624)
  2022-09-29 19:27 [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) Adhemerval Zanella
@ 2022-09-29 19:27 ` Adhemerval Zanella
  2022-09-30 15:09   ` Wilco Dijkstra
  2022-09-29 19:39 ` [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) H.J. Lu
  2022-09-30 15:05 ` Wilco Dijkstra
  2 siblings, 1 reply; 11+ messages in thread
From: Adhemerval Zanella @ 2022-09-29 19:27 UTC (permalink / raw)
  To: libc-alpha, Wilco Dijkstra, Yu Chien Peter Lin

Use INTERNAL_SYSCALL_CALL instead of INLINE_SYSCALL_CALL.  This
requires emulate the semantic for hurd call (so __arc4random_buf
uses the fallback).

Checked on x86_64-linux-gnu.
---
 stdlib/arc4random.c                  |  2 +-
 sysdeps/mach/hurd/not-cancel.h       | 12 ++++++++++--
 sysdeps/unix/sysv/linux/not-cancel.h |  2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
index 960a38f295..c126c601bf 100644
--- a/stdlib/arc4random.c
+++ b/stdlib/arc4random.c
@@ -51,7 +51,7 @@ __arc4random_buf (void *p, size_t n)
 	  n -= l;
 	  continue; /* Interrupted by a signal; keep going.  */
 	}
-      else if (l < 0 && errno == ENOSYS)
+      else if (l == -ENOSYS)
 	break; /* No syscall, so fallback to /dev/urandom.  */
       arc4random_getrandom_failure ();
     }
diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h
index ae58b734e3..5d2d2b4b8a 100644
--- a/sysdeps/mach/hurd/not-cancel.h
+++ b/sysdeps/mach/hurd/not-cancel.h
@@ -25,6 +25,7 @@
 #include <sys/wait.h>
 #include <time.h>
 #include <sys/uio.h>
+#include <sys/random.h>
 #include <hurd.h>
 #include <hurd/fd.h>
 
@@ -75,8 +76,15 @@ __typeof (__fcntl) __fcntl_nocancel;
 #define __fcntl64_nocancel(...) \
   __fcntl_nocancel (__VA_ARGS__)
 
-#define __getrandom_nocancel(buf, size, flags) \
-  __getrandom (buf, size, flags)
+static inline int
+__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
+{
+  int save_errno = errno;
+  int r = __getrandom (buf, buflen, flags);
+  r = r == -1 ? -errno : r;
+  __set_errno (save_errno);
+  return r;
+}
 
 #define __poll_infinity_nocancel(fds, nfds) \
   __poll (fds, nfds, -1)
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index cf35c8bfc9..93615de681 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -71,7 +71,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
 static inline ssize_t
 __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
 {
-  return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);
+  return INTERNAL_SYSCALL_CALL (getrandom, buf, buflen, flags);
 }
 
 static inline int
-- 
2.34.1


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

* Re: [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
  2022-09-29 19:27 [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) Adhemerval Zanella
  2022-09-29 19:27 ` [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624) Adhemerval Zanella
@ 2022-09-29 19:39 ` H.J. Lu
  2022-09-29 19:54   ` Adhemerval Zanella Netto
  2022-09-29 20:01   ` Andreas Schwab
  2022-09-30 15:05 ` Wilco Dijkstra
  2 siblings, 2 replies; 11+ messages in thread
From: H.J. Lu @ 2022-09-29 19:39 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha, Wilco Dijkstra, Yu Chien Peter Lin

On Thu, Sep 29, 2022 at 12:28 PM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> Using an unsigned type prevents the fallback to be used if kernel
> does not support getrandom syscall.
>
> Checked on x86_64-linux-gnu.
> ---
>  stdlib/arc4random.c                  | 2 +-
>  sysdeps/unix/sysv/linux/not-cancel.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
> index e417ef624d..960a38f295 100644
> --- a/stdlib/arc4random.c
> +++ b/stdlib/arc4random.c
> @@ -34,7 +34,7 @@ void
>  __arc4random_buf (void *p, size_t n)
>  {
>    static int seen_initialized;
> -  size_t l;
> +  ssize_t l;
>    int fd;
>
>    if (n == 0)
> diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
> index a263d294b1..cf35c8bfc9 100644
> --- a/sysdeps/unix/sysv/linux/not-cancel.h
> +++ b/sysdeps/unix/sysv/linux/not-cancel.h
> @@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
>    INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
>  }
>
> -static inline int
> +static inline ssize_t

Shouldn't it be __syscall_slong_t?

>  __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
>  {
>    return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);
> --
> 2.34.1
>



-- 
H.J.

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

* Re: [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
  2022-09-29 19:39 ` [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) H.J. Lu
@ 2022-09-29 19:54   ` Adhemerval Zanella Netto
  2022-09-29 20:01   ` Andreas Schwab
  1 sibling, 0 replies; 11+ messages in thread
From: Adhemerval Zanella Netto @ 2022-09-29 19:54 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha, Wilco Dijkstra, Yu Chien Peter Lin



On 29/09/22 16:39, H.J. Lu wrote:
> On Thu, Sep 29, 2022 at 12:28 PM Adhemerval Zanella via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>> Using an unsigned type prevents the fallback to be used if kernel
>> does not support getrandom syscall.
>>
>> Checked on x86_64-linux-gnu.
>> ---
>>  stdlib/arc4random.c                  | 2 +-
>>  sysdeps/unix/sysv/linux/not-cancel.h | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
>> index e417ef624d..960a38f295 100644
>> --- a/stdlib/arc4random.c
>> +++ b/stdlib/arc4random.c
>> @@ -34,7 +34,7 @@ void
>>  __arc4random_buf (void *p, size_t n)
>>  {
>>    static int seen_initialized;
>> -  size_t l;
>> +  ssize_t l;
>>    int fd;
>>
>>    if (n == 0)
>> diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
>> index a263d294b1..cf35c8bfc9 100644
>> --- a/sysdeps/unix/sysv/linux/not-cancel.h
>> +++ b/sysdeps/unix/sysv/linux/not-cancel.h
>> @@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
>>    INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
>>  }
>>
>> -static inline int
>> +static inline ssize_t
> 
> Shouldn't it be __syscall_slong_t?

Would it make any difference? 'size_t' is still 32 bit on x32, so arc4random_buf
would not be able to handle buffer larger than 32 bits.  Same for getrandom,
which return ssize_t.

> 
>>  __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
>>  {
>>    return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);
>> --
>> 2.34.1
>>
> 
> 
> 

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

* Re: [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
  2022-09-29 19:39 ` [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) H.J. Lu
  2022-09-29 19:54   ` Adhemerval Zanella Netto
@ 2022-09-29 20:01   ` Andreas Schwab
  1 sibling, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2022-09-29 20:01 UTC (permalink / raw)
  To: H.J. Lu via Libc-alpha
  Cc: Adhemerval Zanella, H.J. Lu, Yu Chien Peter Lin, Wilco Dijkstra

On Sep 29 2022, H.J. Lu via Libc-alpha wrote:

>> diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
>> index a263d294b1..cf35c8bfc9 100644
>> --- a/sysdeps/unix/sysv/linux/not-cancel.h
>> +++ b/sysdeps/unix/sysv/linux/not-cancel.h
>> @@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
>>    INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
>>  }
>>
>> -static inline int
>> +static inline ssize_t
>
> Shouldn't it be __syscall_slong_t?

getrandom can never return more than the size of the buffer.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
  2022-09-29 19:27 [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) Adhemerval Zanella
  2022-09-29 19:27 ` [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624) Adhemerval Zanella
  2022-09-29 19:39 ` [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) H.J. Lu
@ 2022-09-30 15:05 ` Wilco Dijkstra
  2022-10-01 12:16   ` Yu-Chien Peter Lin
  2 siblings, 1 reply; 11+ messages in thread
From: Wilco Dijkstra @ 2022-09-30 15:05 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha, Yu Chien Peter Lin

Hi Adhemerval,

This looks good to me (and will work on ILP32).

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Cheers,
Wilco


From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
 
Using an unsigned type prevents the fallback to be used if kernel
does not support getrandom syscall.

Checked on x86_64-linux-gnu.
---
 stdlib/arc4random.c                  | 2 +-
 sysdeps/unix/sysv/linux/not-cancel.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
index e417ef624d..960a38f295 100644
--- a/stdlib/arc4random.c
+++ b/stdlib/arc4random.c
@@ -34,7 +34,7 @@ void
 __arc4random_buf (void *p, size_t n)
 {
   static int seen_initialized;
-  size_t l;
+  ssize_t l;
   int fd;
 
   if (n == 0)
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index a263d294b1..cf35c8bfc9 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -68,7 +68,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
   INTERNAL_SYSCALL_CALL (writev, fd, iov, iovcnt);
 }
 
-static inline int
+static inline ssize_t
 __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
 {
   return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);
-- 
2.34.1

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

* Re: [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624)
  2022-09-29 19:27 ` [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624) Adhemerval Zanella
@ 2022-09-30 15:09   ` Wilco Dijkstra
  2022-09-30 16:29     ` Yann Droneaud
  0 siblings, 1 reply; 11+ messages in thread
From: Wilco Dijkstra @ 2022-09-30 15:09 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha, Yu Chien Peter Lin

Hi Adhemerval,

This looks good to me assuming Hurd is 32-bit only.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Cheers,
Wilco


From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
 
Use INTERNAL_SYSCALL_CALL instead of INLINE_SYSCALL_CALL.  This
requires emulate the semantic for hurd call (so __arc4random_buf
uses the fallback).

Checked on x86_64-linux-gnu.
---
 stdlib/arc4random.c                  |  2 +-
 sysdeps/mach/hurd/not-cancel.h       | 12 ++++++++++--
 sysdeps/unix/sysv/linux/not-cancel.h |  2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c
index 960a38f295..c126c601bf 100644
--- a/stdlib/arc4random.c
+++ b/stdlib/arc4random.c
@@ -51,7 +51,7 @@ __arc4random_buf (void *p, size_t n)
           n -= l;
           continue; /* Interrupted by a signal; keep going.  */
         }
-      else if (l < 0 && errno == ENOSYS)
+      else if (l == -ENOSYS)
         break; /* No syscall, so fallback to /dev/urandom.  */
       arc4random_getrandom_failure ();
     }
diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h
index ae58b734e3..5d2d2b4b8a 100644
--- a/sysdeps/mach/hurd/not-cancel.h
+++ b/sysdeps/mach/hurd/not-cancel.h
@@ -25,6 +25,7 @@
 #include <sys/wait.h>
 #include <time.h>
 #include <sys/uio.h>
+#include <sys/random.h>
 #include <hurd.h>
 #include <hurd/fd.h>
 
@@ -75,8 +76,15 @@ __typeof (__fcntl) __fcntl_nocancel;
 #define __fcntl64_nocancel(...) \
   __fcntl_nocancel (__VA_ARGS__)
 
-#define __getrandom_nocancel(buf, size, flags) \
-  __getrandom (buf, size, flags)
+static inline int
+__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
+{
+  int save_errno = errno;
+  int r = __getrandom (buf, buflen, flags);
+  r = r == -1 ? -errno : r;
+  __set_errno (save_errno);
+  return r;
+}
 
 #define __poll_infinity_nocancel(fds, nfds) \
   __poll (fds, nfds, -1)
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index cf35c8bfc9..93615de681 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -71,7 +71,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt)
 static inline ssize_t
 __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
 {
-  return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags);
+  return INTERNAL_SYSCALL_CALL (getrandom, buf, buflen, flags);
 }
 
 static inline int
-- 
2.34.1

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

* Re: [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624)
  2022-09-30 15:09   ` Wilco Dijkstra
@ 2022-09-30 16:29     ` Yann Droneaud
  2022-09-30 16:37       ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 11+ messages in thread
From: Yann Droneaud @ 2022-09-30 16:29 UTC (permalink / raw)
  To: Wilco Dijkstra, Adhemerval Zanella, libc-alpha, Yu Chien Peter Lin

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

Hi,

Le 30/09/2022 à 17:09, Wilco Dijkstra via Libc-alpha a écrit :
> Hi Adhemerval,
>
> This looks good to me assuming Hurd is 32-bit only.
>
> Reviewed-by: Wilco Dijkstra<Wilco.Dijkstra@arm.com>
>
> Cheers,
> Wilco
>
>
> From: Adhemerval Zanella<adhemerval.zanella@linaro.org>
>   
> Use INTERNAL_SYSCALL_CALL instead of INLINE_SYSCALL_CALL.  This
> requires emulate the semantic for hurd call (so __arc4random_buf
> uses the fallback).
>
> Checked on x86_64-linux-gnu.
> ---
> diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h
> index ae58b734e3..5d2d2b4b8a 100644
> --- a/sysdeps/mach/hurd/not-cancel.h
> +++ b/sysdeps/mach/hurd/not-cancel.h
> @@ -25,6 +25,7 @@
>   #include <sys/wait.h>
>   #include <time.h>
>   #include <sys/uio.h>
> +#include <sys/random.h>
>   #include <hurd.h>
>   #include <hurd/fd.h>
>   
> @@ -75,8 +76,15 @@ __typeof (__fcntl) __fcntl_nocancel;
>   #define __fcntl64_nocancel(...) \
>     __fcntl_nocancel (__VA_ARGS__)
>   
> -#define __getrandom_nocancel(buf, size, flags) \
> -  __getrandom (buf, size, flags)
> +static inline int


ssize_t


> +__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
> +{
> +  int save_errno = errno;
> +  int r = __getrandom (buf, buflen, flags);

ssize_t r


> +  r = r == -1 ? -errno : r;
> +  __set_errno (save_errno);
> +  return r;
> +}
>   

Regards.

-- 
Yann Droneaud
OPTEYA

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

* Re: [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624)
  2022-09-30 16:29     ` Yann Droneaud
@ 2022-09-30 16:37       ` Adhemerval Zanella Netto
  2022-10-01 12:21         ` Yu-Chien Peter Lin
  0 siblings, 1 reply; 11+ messages in thread
From: Adhemerval Zanella Netto @ 2022-09-30 16:37 UTC (permalink / raw)
  To: Yann Droneaud, Wilco Dijkstra, libc-alpha, Yu Chien Peter Lin



On 30/09/22 13:29, Yann Droneaud wrote:
> Hi,
> 
> Le 30/09/2022 à 17:09, Wilco Dijkstra via Libc-alpha a écrit :
>> Hi Adhemerval,
>>
>> This looks good to me assuming Hurd is 32-bit only.
>>
>> Reviewed-by: Wilco Dijkstra<Wilco.Dijkstra@arm.com>
>>
>> Cheers,
>> Wilco
>>
>>
>> From: Adhemerval Zanella<adhemerval.zanella@linaro.org>
>>   Use INTERNAL_SYSCALL_CALL instead of INLINE_SYSCALL_CALL.  This
>> requires emulate the semantic for hurd call (so __arc4random_buf
>> uses the fallback).
>>
>> Checked on x86_64-linux-gnu.
>> ---
>> diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h
>> index ae58b734e3..5d2d2b4b8a 100644
>> --- a/sysdeps/mach/hurd/not-cancel.h
>> +++ b/sysdeps/mach/hurd/not-cancel.h
>> @@ -25,6 +25,7 @@
>>   #include <sys/wait.h>
>>   #include <time.h>
>>   #include <sys/uio.h>
>> +#include <sys/random.h>
>>   #include <hurd.h>
>>   #include <hurd/fd.h>
>>   @@ -75,8 +76,15 @@ __typeof (__fcntl) __fcntl_nocancel;
>>   #define __fcntl64_nocancel(...) \
>>     __fcntl_nocancel (__VA_ARGS__)
>>   -#define __getrandom_nocancel(buf, size, flags) \
>> -  __getrandom (buf, size, flags)
>> +static inline int
> 
> 
> ssize_t
> 
> 
>> +__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags)
>> +{
>> +  int save_errno = errno;
>> +  int r = __getrandom (buf, buflen, flags);
> 
> ssize_t r

Ack.

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

* Re: [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
  2022-09-30 15:05 ` Wilco Dijkstra
@ 2022-10-01 12:16   ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 11+ messages in thread
From: Yu-Chien Peter Lin @ 2022-10-01 12:16 UTC (permalink / raw)
  To: adhemerval.zanella; +Cc: Wilco.Dijkstra, libc-alpha

Hi Adhemerval,

Tested on riscv[32|64]-linux-gnu
LGTM.

Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>

Thanks,
Peter Lin

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

* Re: [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624)
  2022-09-30 16:37       ` Adhemerval Zanella Netto
@ 2022-10-01 12:21         ` Yu-Chien Peter Lin
  0 siblings, 0 replies; 11+ messages in thread
From: Yu-Chien Peter Lin @ 2022-10-01 12:21 UTC (permalink / raw)
  To: Adhemerval Zanella Netto; +Cc: Yann Droneaud, Wilco Dijkstra, libc-alpha

Hi Adhemerval,

Tested on riscv[32|64]-linux-gnu
LGTM.

Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>

Thanks,
Peter Lin       

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

end of thread, other threads:[~2022-10-01  4:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 19:27 [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) Adhemerval Zanella
2022-09-29 19:27 ` [PATCH v3 2/2] malloc: Do not clobber errno on __getrandom_nocancel (BZ #29624) Adhemerval Zanella
2022-09-30 15:09   ` Wilco Dijkstra
2022-09-30 16:29     ` Yann Droneaud
2022-09-30 16:37       ` Adhemerval Zanella Netto
2022-10-01 12:21         ` Yu-Chien Peter Lin
2022-09-29 19:39 ` [PATCH 1/2] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638) H.J. Lu
2022-09-29 19:54   ` Adhemerval Zanella Netto
2022-09-29 20:01   ` Andreas Schwab
2022-09-30 15:05 ` Wilco Dijkstra
2022-10-01 12:16   ` Yu-Chien Peter Lin

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