#976989 valgrind: Environment variables with slashes get dropped

Package:
valgrind
Source:
valgrind
Description:
instrumentation framework for building dynamic analysis tools
Submitter:
Timo Sirainen
Date:
2020-12-09 16:45:04 UTC
Severity:
minor
#976989#5
Date:
2020-12-09 16:35:50 UTC
From:
To:
Dear Maintainer,

Environment variables like "FOO/BAR" are dropped when executing programs via
valgrind.

This happens only when building the Debian package with dpkg-buildpackage.
It does not happen when using exactly the same Debian source code tree (via
apt source valgrind) but building it with:

./configure --prefix=/tmp/valgrind
make
make install

So I'm not sure what Debian packaging does differently to cause this.

Example program:

// gcc test.c -o test
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
	printf("%s\n", getenv("FOO/BAR"));
	return 0;
}

I can successfully run it with:

env 'FOO/BAR=1' ./test

However, with valgrind FOO/BAR is NULL and it crashes:

env 'FOO/BAR=1' valgrind ./test
==77478== Invalid read of size 1
==77478==    at 0x4C2FD72: strlen (vg_replace_strmem.c:458)
==77478==    by 0x4EA7D01: puts (ioputs.c:35)
==77478==    by 0x1086A1: main (in /home/tss/test)

Originally reported to upstream in https://bugs.kde.org/show_bug.cgi?id=395266