Package: valgrind
Version: 1:3.16.1-1
Severity: minor

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

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.8.0-2-amd64 (SMP w/32 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages valgrind depends on:
ii  libc6      2.31-5
ii  libc6-dbg  2.31-5

Versions of packages valgrind recommends:
ii  gdb           10.1-1+b1
pn  valgrind-dbg  <none>

Versions of packages valgrind suggests:
pn  alleyoop      <none>
ii  kcachegrind   4:20.08.0-1
pn  valgrind-mpi  <none>
pn  valkyrie      <none>

-- no debconf information

Reply via email to