This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/10320] erand48 implementation not thread safe but POSIX says it should be


http://sourceware.org/bugzilla/show_bug.cgi?id=10320

--- Comment #4 from Ondrej Bilka <neleai at seznam dot cz> 2012-12-20 12:11:58 UTC ---
Sorry that I mistaken erand48 for drand48.

Note that there is a GNU extension reentrant functions drand48_r ...

Function lcong48 changes a,c in x_{n+1}=a*x_n+c mod 2^48 congruence formula. 
These are saved in __libc_drand48_data

Then erand48... read only these a,c from __libc_drand48_data.

There is indeed a race between lcong48 and *rand48 but it is mostly harmless.

Only thing that can go wrong is that when lcong48 with a',c' is called then
some seed will be updated according to formula x_{n+1}=a'*x_n+c . As then seed
is nondeterministic because both x_{n+1}=a*x_n+c , x_{n+1}=a'*x_n+c' are valid
updates.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]