[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hurd-bug
Subject:    Re: Implementing getrandom/getentropy, anybody?
From:       Samuel Thibault <samuel.thibault () gnu ! org>
Date:       2019-10-31 12:58:10
Message-ID: 20191031125810.nxrsh6rqduwgd4bb () function
[Download RAW message or body]

Hello,

Thanks Guillem for the additional review :)

Guillem Jover, le jeu. 31 oct. 2019 13:31:58 +0100, a ecrit:
> On Tue, 2019-10-29 at 23:28:26 -0500, Andrew Eggenberger wrote:
> > +  if (flags & GRND_RANDOM){
> > +    random_source = "/dev/random";
> > +  }
> > +
> > +  fp = open(random_source, O_RDONLY);
> 
> Shouldn't this be opened with O_CLOEXEC, otherwise children created
> by other threads might leak file descriptors. Although I don't see
> this being consistently done in glibc, not sure why?

Indeed.  I guess it's not always done only due to historical reasons.

> > +  amount_read = read(fp, buffer, length);
> 
> What about partial reads?

That is fine, the getrandom interface explicitly allows partial reads.

Samuel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic