[valgrind-variant] r126 committed - Cherry-pick the patch by Philippe Waroquiers that fixes https://bugs.k...

2 views
Skip to first unread message

valgrind...@googlecode.com

unread,
Dec 2, 2011, 7:08:29 AM12/2/11
to valgrind-var...@googlegroups.com
Revision: 126
Author: ramosian.glider
Date: Fri Dec 2 04:08:02 2011
Log: Cherry-pick the patch by Philippe Waroquiers that fixes
https://bugs.kde.org/show_bug.cgi?id=286270
("vgpreload is not friendly to 64->32 bit execs, gives ld.so warnings")

Philippe's comment below:

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).


http://code.google.com/p/valgrind-variant/source/detail?r=126

Modified:
/trunk/valgrind/coregrind/m_libcproc.c

=======================================
--- /trunk/valgrind/coregrind/m_libcproc.c Tue Oct 25 09:11:36 2011
+++ /trunk/valgrind/coregrind/m_libcproc.c Fri Dec 2 04:08:02 2011
@@ -243,12 +243,18 @@
// - LD_PRELOAD is on Linux, not on Darwin, not sure about AIX
// - DYLD_INSERT_LIBRARIES and DYLD_SHARED_REGION are Darwin-only
for (i = 0; envp[i] != NULL; i++) {
- if (VG_(strncmp)(envp[i], "LD_PRELOAD=", 11) == 0)
- ld_preload_str =
VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.1", &envp[i][11]);
- if (VG_(strncmp)(envp[i], "LD_LIBRARY_PATH=", 16) == 0)
- ld_library_path_str =
VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.2", &envp[i][16]);
- if (VG_(strncmp)(envp[i], "DYLD_INSERT_LIBRARIES=", 22) == 0)
- dyld_insert_libraries_str =
VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.3", &envp[i][22]);
+ if (VG_(strncmp)(envp[i], "LD_PRELOAD=", 11) == 0) {
+ envp[i] = VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.1",
envp[i]);
+ ld_preload_str = &envp[i][11];
+ }
+ if (VG_(strncmp)(envp[i], "LD_LIBRARY_PATH=", 16) == 0) {
+ envp[i] = VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.2",
envp[i]);
+ ld_library_path_str = &envp[i][16];
+ }
+ if (VG_(strncmp)(envp[i], "DYLD_INSERT_LIBRARIES=", 22) == 0) {
+ envp[i] = VG_(arena_strdup)(VG_AR_CORE, "libcproc.erves.3",
envp[i]);
+ dyld_insert_libraries_str = &envp[i][22];
+ }
}

buf = VG_(arena_malloc)(VG_AR_CORE, "libcproc.erves.4",

Reply all
Reply to author
Forward
0 new messages