public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/release/2.36/master] stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
Date: Fri, 30 Sep 2022 18:36:01 +0000 (GMT)	[thread overview]
Message-ID: <20220930183601.476993858D1E@sourceware.org> (raw)

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

commit 76e05613ee28f4ac4a0ab97effc32e0e78e37a56
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Sep 29 16:15:20 2022 -0300

    stdlib: Fix __getrandom_nocancel type and arc4random usage (BZ #29638)
    
    Using an unsigned type prevents the fallback to be used if kernel
    does not support getrandom syscall.
    
    Checked on x86_64-linux-gnu.
    
    Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
    (cherry picked from commit 13db9ee2cb3b77e25f852be7d6952882e1be6f00)

Diff:
---
 NEWS                                 | 1 +
 stdlib/arc4random.c                  | 2 +-
 sysdeps/unix/sysv/linux/not-cancel.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 1cc9a16bbf..91bcfeb7a6 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ The following bugs are resolved with this release:
   [29537] libc: [2.34 regression]: Alignment issue on m68k when using
   [29539] libc: LD_TRACE_LOADED_OBJECTS changed how vDSO library are
   [29583] Use 64-bit interfaces in gconv_parseconfdir
+  [29638] libc: stdlib: arc4random fallback is never used
 \f
 Version 2.36
 
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);

                 reply	other threads:[~2022-09-30 18:36 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=20220930183601.476993858D1E@sourceware.org \
    --to=azanella@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).