public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: bug-hurd@gnu.org
Cc: commit-hurd@gnu.org, libc-alpha@sourceware.org
Subject: Re: [hurd, commited] hurd: Use __trivfs_server_name instead of trivfs_server_name
Date: Sat, 1 Jan 2022 18:41:20 +0100	[thread overview]
Message-ID: <20220101174120.z7kh5zq4qdsbfnvt@begin> (raw)
In-Reply-To: <87tuenv016.fsf@mid.deneb.enyo.de>

Florian Weimer, le sam. 01 janv. 2022 18:27:49 +0100, a ecrit:
> > @@ -33,14 +33,14 @@ __getrandom (void *buffer, size_t length, unsigned int flags)
> >    size_t amount_read;
> >    int fd;
> >  
> > -  if (&trivfs_server_name && trivfs_server_name
> > -      && trivfs_server_name[0] == 'r'
> > -      && trivfs_server_name[1] == 'a'
> > -      && trivfs_server_name[2] == 'n'
> > -      && trivfs_server_name[3] == 'd'
> > -      && trivfs_server_name[4] == 'o'
> > -      && trivfs_server_name[5] == 'm'
> > -      && trivfs_server_name[6] == '\0')
> > +  if (&__trivfs_server_name && __trivfs_server_name
> > +      && __trivfs_server_name[0] == 'r'
> > +      && __trivfs_server_name[1] == 'a'
> > +      && __trivfs_server_name[2] == 'n'
> > +      && __trivfs_server_name[3] == 'd'
> > +      && __trivfs_server_name[4] == 'o'
> > +      && __trivfs_server_name[5] == 'm'
> > +      && __trivfs_server_name[6] == '\0')
> >      /* We are random, don't try to read ourselves!  */
> >      return length;
> 
> How does this work?  It's a new synbol name, so there's no definition,
> so the weak reference is always null.

It is peeking it from the program.

Basically the problem is that the random translator uses glibc, whose
malloc implementation started using /dev/random in glibc 2.34, thus
reading itself.

Samuel

  reply	other threads:[~2022-01-01 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-01 16:53 Samuel Thibault
2022-01-01 17:27 ` Florian Weimer
2022-01-01 17:41   ` Samuel Thibault [this message]
2022-01-01 18:48     ` Florian Weimer
2022-01-01 18:58       ` Samuel Thibault
2022-01-01 19:02         ` Florian Weimer
2022-01-01 19:11           ` Samuel Thibault

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=20220101174120.z7kh5zq4qdsbfnvt@begin \
    --to=samuel.thibault@gnu.org \
    --cc=bug-hurd@gnu.org \
    --cc=commit-hurd@gnu.org \
    --cc=libc-alpha@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).