]> git.ipfire.org Git - thirdparty/valgrind.git/commit
fix 286270 VG_(env_remove_valgrind_env_stuff)
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 11 Dec 2011 16:29:43 +0000 (16:29 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 11 Dec 2011 16:29:43 +0000 (16:29 +0000)
commitc523185b76af8bb2b85abdc78ea142f5a90c71b4
tree9e93886daf9bfc0f059d5302a39d1732ce117c0e
parentb1c891d91624e56434691ea143a46903ff5812d1
fix 286270 VG_(env_remove_valgrind_env_stuff)

rev 12001 has introduced a regression in VG_(env_remove_valgrind_env_stuff):
to avoid modifying a possibly read-only env string, the string is duplicated,
and the copy is modified. However, mash_env_column modifies the string
"in-place". The modified string was not put back in the env (and could not,
because the src string is only partially copied).

This means that the valgrind preload strings were not cleaned up and
when a 32 bit executable execs a 64 bits (or vice versa: 64 bit execs 32 bits),
LD_PRELOAD contains both the 32 bits and 64 bits versions of Valgrind
vgpreload.... => ld.so then gives an error msg, as it can't preload either
the 32 or the 64 bits version.

The patch fixes this by duplicating the whole env string, and passing
to mash_colon_env a pointer to the correct offset in the whole env string.
The duplicated string is replacing the original entry in envp.

This patch adds two regression tests : none/tests/allexec32 and
none/tests/allexec64. On a bi-arch valgrind, these will be 32bits and 64 bits
executables, exec-ing each other. On a single arch, one will be a symlink
to the other (to avoid different .exp files, and still test exec).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12287
22 files changed:
coregrind/m_libcproc.c
none/tests/Makefile.am
none/tests/allexec.c [new file with mode: 0644]
none/tests/allexec32.stderr.exp [new file with mode: 0644]
none/tests/allexec32.stdout.exp [new file with mode: 0644]
none/tests/allexec32.vgtest [new file with mode: 0644]
none/tests/allexec64.stderr.exp [new file with mode: 0644]
none/tests/allexec64.stdout.exp [new file with mode: 0644]
none/tests/allexec64.vgtest [new file with mode: 0644]
none/tests/allexec_prepare_prereq [new file with mode: 0755]
none/tests/amd64/Makefile.am
none/tests/amd64/allexec.c [new symlink]
none/tests/arm/Makefile.am
none/tests/arm/allexec.c [new symlink]
none/tests/ppc32/Makefile.am
none/tests/ppc32/allexec.c [new symlink]
none/tests/ppc64/Makefile.am
none/tests/ppc64/allexec.c [new symlink]
none/tests/s390x/Makefile.am
none/tests/s390x/allexec.c [new symlink]
none/tests/x86/Makefile.am
none/tests/x86/allexec.c [new symlink]