gopalshankar / address-sanitizer

Automatically exported from code.google.com/p/address-sanitizer
0 stars 0 forks source link

all sanitizers need to intercept setenv/getenv #298

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
subj

Original issue reported on code.google.com by konstant...@gmail.com on 24 Apr 2014 at 7:13

GoogleCodeExporter commented 9 years ago
Any context?

Original comment by gli...@chromium.org on 24 Apr 2014 at 7:58

GoogleCodeExporter commented 9 years ago
1. setenv/getenv read users data (for that purpose msan already intercepts 
getenv)
2. a race between setenv and getenv is a rather frequent bug which we do not 
detect in tsan

Original comment by konstant...@gmail.com on 24 Apr 2014 at 8:00

GoogleCodeExporter commented 9 years ago
Some context:

Glibc says:
"Modifications of environment variables are not allowed in multi-threaded 
programs"
http://www.gnu.org/software/libc/manual/html_node/Environment-Access.html

POSIX says:
    "Since multi-threaded applications are not allowed to use the
    environ  variable to access or modify any environment variable
    while any other thread is concurrently modifying any environment
    variable, any function dependent on any environment variable is
    not thread-safe if another thread is modifying the environment"
https://groups.google.com/forum/#!topic/comp.unix.programmer/Jw85LMYevvY

Original comment by dvyu...@google.com on 24 Apr 2014 at 8:16