bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] posix: Improve randomness on try_tempname_len


From: Paul Eggert
Subject: Re: [PATCH 2/2] posix: Improve randomness on try_tempname_len
Date: Fri, 8 Jan 2021 18:20:31 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0

On 1/4/21 9:03 AM, Adhemerval Zanella wrote:
For __GT_NOCREATE (mktemp, tempnam, tmpnam) getrandom is also used
on first try, otherwise randomness is obtained using the clock plus
a linear congruential generator.

Why not use getrandom in the first try also for __GT_DIR (mkdtemp) and __GT_FILE (mkostemp, mkostemps, mkstemp, mkstemps, tmpfile)? That is what Gnulib tempname.c is doing now. This not only simplifies the code, it improves resistance to some (admittedly less-likely) attacks.

Also for getrandom GRND_NONBLOCK is used to avoid blocking indefinitely
on some older kernels.

Thanks, I installed that part of the proposal into Gnulib by installing the attached. The idea is for tempname.c to be identical after we get the abovementioned issue worked out.

Attachment: 0001-tempname-don-t-block-for-minutes.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]