Message ID | mvmtte26asa.fsf@suse.de |
---|---|
State | New |
Headers | show |
Series | Fix missing randomness in __gen_tempname (bug 32214) | expand |
* Andreas Schwab: > Make sure to update the random value also if getrandom fails. > > Fixes: 686d542025 ("posix: Sync tempname with gnulib") > --- > sysdeps/posix/tempname.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c > index c00fe0c181..fc30958a0c 100644 > --- a/sysdeps/posix/tempname.c > +++ b/sysdeps/posix/tempname.c > @@ -117,6 +117,8 @@ random_bits (random_value *r, random_value s) > succeed. */ > #if !_LIBC > *r = mix_random_values (v, clock ()); > +#else > + *r = v; > #endif > return false; > } Does misc/tst-mkfstemp-fuse-parallel catch this by chance? Change looks good. Thanks, Florian
On Sep 26 2024, Florian Weimer wrote:
> Does misc/tst-mkfstemp-fuse-parallel catch this by chance?
Did you mean misc/tst-mkstemp-fuse-parallel?
No, the error only happens if getrandom fails.
* Andreas Schwab: > On Sep 26 2024, Florian Weimer wrote: > >> Does misc/tst-mkfstemp-fuse-parallel catch this by chance? > > Did you mean misc/tst-mkstemp-fuse-parallel? Yes. > No, the error only happens if getrandom fails. Sure, but if we inject an error into the test, will it detect the lack of randomness? Thanks, Florian
On Sep 26 2024, Florian Weimer wrote: > Sure, but if we inject an error into the test, will it detect the lack > of randomness? Most likely, since the generated file name is constant and predictable.
Can this be backported to 2.40? I'm not sure about the protocol to do that so I thought I'd just ask here.
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index c00fe0c181..fc30958a0c 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -117,6 +117,8 @@ random_bits (random_value *r, random_value s) succeed. */ #if !_LIBC *r = mix_random_values (v, clock ()); +#else + *r = v; #endif return false; }