Valgrind suppressions don't work on 64-bit systems

Bug #1512622 reported by Marius Gedminas
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-defaults (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Confirmed
Undecided
Unassigned

Bug Description

Hello!

The Python package helpfully ships /usr/lib/valgrind/python.supp, which is basically the upstream Valgrind suppressions file with some suppressions uncommented so they work on standard Python builds.

Unfortunately those suppressions are tailored for 32-bit systems and therefore do not suppress false positive errors in PyObject_Free/PyObject_Realloc.

See upstream bug http://bugs.python.org/issue12612 and upstream commit https://github.com/python/cpython/commit/9264faed068b87888a4605ce36bfc9d158515c42 for the changes you need to do.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: python 2.7.9-1
ProcVersionSignature: Ubuntu 4.2.0-16.19-generic 4.2.3
Uname: Linux 4.2.0-16-generic x86_64
ApportVersion: 2.19.1-0ubuntu4
Architecture: amd64
CurrentDesktop: GNOME
Date: Tue Nov 3 11:02:23 2015
EcryptfsInUse: Yes
InstallationDate: Installed on 2012-07-25 (1195 days ago)
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
SourcePackage: python-defaults
UpgradeStatus: Upgraded to wily on 2015-10-22 (11 days ago)

Revision history for this message
Marius Gedminas (mgedmin) wrote :
Revision history for this message
Matthias Klose (doko) wrote :

ok, I see that this file needs some updates from the python2.7 package.

Please could you point out what you would expect to be different from the 32bit version? The referenced commit doesn't change anything for 64bit, and the changes are already in the python-defaults package.

Changed in python-defaults (Ubuntu):
status: New → Incomplete
Revision history for this message
Marius Gedminas (mgedmin) wrote :

Oh, I'm sorry, I got terribly confused!

Upstream Python ships a Valgrind suppressions file that requires you to do one of two things:

- use a debugging build of Python, or
- uncomment the suppressions for PyObject_Free and PyObject_Realloc.

/usr/lib/valgrind/python.supp on wily has this bit

    # Debian note:
    # The file Misc/valgrind-python.supp is placed in an modified form into the
    # directory /usr/lib/valgrind as python.supp. There's no need to to add it
    # with the --suppressions option.
    # The unmodified file is found in /usr/share/doc/python2.6/
    #
    # The python2.6-dbg build has been compiled with -DPy_USING_MEMORY_DEBUGGER
    # so you can safely comment out the suppressions for PyObject_Free and
    # PyObject_Realloc.

I saw the "modified" bit and the "you can safely comment out", and I mistakenly assumed that it had the PyObject_Free and PyObject_Realloc suppressions uncommented already. Because "Comment out" means the opposite of "uncomment", right? And "you can" means it hasn't been done already? Anyway, sorry for jumping to conclusions :(

I'm now looking at a diff with upstream's valgrind-python.supp, and the only diffs are in .so version numbers.

I guess this leaves just the fact that /usr/lib/valgrind/python.supp, as shipped by python-defaults, doesn't have all the required PyObject_Free/PyObject_Realloc suppressions, so even if you uncomment the ones that are there, you'll still see false positives.

It's in fact also a problem with upstream Python 2.7, because the commented-out 64-bit suppressions were only added to, uh, the 'default' branch, which was already 3.something in 2011.

Now that the confusion is out of the way,

> Please could you point out what you would expect to be different from the 32bit version? The referenced commit doesn't change anything for 64bit, and the changes are already in the python-defaults package.

I used "64-bit" to refer to the usage of Addr8/Value8 in the newly-added commented-out PyObject_{Free/Realloc} suppressions, because the existing commetned-out suppressions use Addr4/Value4, which are only used on 32-bit systems. To be more precise, I'm attaching a patch of what I think needs to be done -- ideally in Debian first (or even upstream; I asked for a 2.7 backport in http://bugs.python.org/issue12612).

Matthias Klose (doko)
Changed in python-defaults (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-defaults (Ubuntu Xenial):
status: New → Confirmed
Revision history for this message
LCID Fire (lcid-fire) wrote :

This just bit me in 16.04. Is there any supression file out there that is working with 16.04 python3?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-defaults - 2.7.11-2

---------------
python-defaults (2.7.11-2) unstable; urgency=medium

  [ Scott Kitterman ]
  * Python policy updates for Stretch (Many thanks to Ben Finney for all the
    updates)
    - Change focus in text to python3
    - Remove/deprecate features no longer needed due to only a single Python 2
      version
    - Discuss update process in more detail
    - Revamp tools section to better align to current practice

  [ Matthias Klose ]
  * Update valgrind suppression file. Issue #12612. LP: #1512622.
  * Rebuild to pick up the GNU triplet change on i386 archs. Addresses: #826128.

 -- Matthias Klose <email address hidden> Fri, 03 Jun 2016 01:29:55 +0200

Changed in python-defaults (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.