valgrind: Backport Valgrind patches for s390 to Ubuntu 16.04

Bug #1563420 reported by bugproxy
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu on IBM z Systems
Fix Released
Critical
dann frazier
valgrind (Ubuntu)
Fix Released
Undecided
dann frazier

Bug Description

The following patches for s390 need to be picked for Valgrind:

* r15702 -- s390x: Crash with certain glibc versions due to
  non-implemented TBEGIN (https://bugs.kde.org/show_bug.cgi?id=353680)
  Note that this is also needed when using a glibc with vector-accelerated
  string functions.

* r15792/VEX r3210 -- s390x: popcnt (B9E1) not implemented
  (https://bugs.kde.org/show_bug.cgi?id=359289)

* r15806 -- s390: wire up separate socketcalls system calls
  (https://bugs.kde.org/show_bug.cgi?id=359703)
  This is needed when using a kernel that has separate system calls for
  socket functions.

bugproxy (bugproxy)
tags: added: architecture-s39064 bugnameltc-139796 severity-critical targetmilestone-inin1604
Changed in ubuntu:
assignee: nobody → Skipper Bug Screeners (skipper-screen-team)
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1563420/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
dann frazier (dannf)
affects: ubuntu → valgrind (Ubuntu)
Revision history for this message
dann frazier (dannf) wrote :

I've prepared a package with these changes, but I haven't been able to test it. I'm observing the following failure in both patched and unpatched builds, and also with the latest upstream trunk:

ubuntu@ubuntu:~/valgrind$ VALGRIND_LIB=$(pwd)/.in_place $(pwd)/coregrind/valgrind /bin/true
==31168== Memcheck, a memory error detector
==31168== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==31168== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==31168== Command: /bin/true
==31168==
vex s390->IR: unimplemented insn: EC12 2021 1E59
==31168== valgrind: Unrecognised instruction at address 0x400b916.
==31168== at 0x400B916: _dl_new_object (dl-object.c:98)
==31168== by 0x400B8EB: _dl_new_object (dl-object.c:87)
==31168== Your program just tried to execute an instruction that Valgrind
==31168== did not recognise. There are two possible reasons for this.
==31168== 1. Your program has a bug and erroneously jumped to a non-code
==31168== location. If you are running Memcheck and you just saw a
==31168== warning about a bad jump, it's probably your program's fault.
==31168== 2. The instruction is legitimate but Valgrind doesn't handle it,
==31168== i.e. it's Valgrind's fault. If you think this is the case or
==31168== you are not sure, please let us know and we'll try to fix it.
==31168== Either way, Valgrind will now raise a SIGILL signal which will
==31168== probably kill your program.
==31168==
==31168== Process terminating with default action of signal 4 (SIGILL)
==31168== Illegal opcode at address 0x400B916
==31168== at 0x400B916: _dl_new_object (dl-object.c:98)
==31168== by 0x400B8EB: _dl_new_object (dl-object.c:87)
==31168==
==31168== HEAP SUMMARY:
==31168== in use at exit: 0 bytes in 0 blocks
==31168== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==31168==
==31168== All heap blocks were freed -- no leaks are possible
==31168==
==31168== For counts of detected and suppressed errors, rerun with: -v
==31168== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction (core dumped)

Changed in valgrind (Ubuntu):
assignee: Skipper Bug Screeners (skipper-screen-team) → dann frazier (dannf)
status: New → Incomplete
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2016-03-31 06:41 EDT-------
> [...]
> vex s390->IR: unimplemented insn: EC12 2021 1E59
> ==31168== valgrind: Unrecognised instruction at address 0x400b916.

Right, I've seen that in my testing as well. It may occur with binaries compiled for zEC12 (or higher). In this case, since Ubuntu's dynamic loader is affected, Valgrind doesn't work for *any* dynamically linked executable.

Here's the upstream Valgrind bug for tracking this issue: https://bugs.kde.org/show_bug.cgi?id=361226
I'm working on a fix.

Apart from that problem, I've also seen Ubuntu debug packages with compressed debug sections. This is not supported by Valgrind. In particular, if the dynamic loader or the C library are affected, Valgrind is pretty much unusable. A patch for Valgrind to support compressed debug sections has been posted, but it's not upstream yet: https://bugs.kde.org/show_bug.cgi?id=303877

Revision history for this message
dann frazier (dannf) wrote :

The issue described in Comment #2 has been split off into LP: #1556765.

Changed in valgrind (Ubuntu):
status: Incomplete → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package valgrind - 1:3.11.0-1ubuntu3

---------------
valgrind (1:3.11.0-1ubuntu3) xenial; urgency=medium

  * Fixes for s390x, LP: #1563420:
    - 15_s390x-HWCAP-mask.patch: Suppress advertising features
      in HWCAP that are unsupported by valgrind.
    - 16_s390x_popcnt-insn.patch: Add support for popcnt instruction.
    - 17_s390x-splitout-socketcalls.patch: Support individual socket
      syscalls, which were split out from socketcall in Linux 4.3.
  * 18_s390x-support-RISBGN-insn.patch: Fix issue with binaries
    compiled for zEC12 or higher, such as Ubuntu's dynamic loader.
    LP: #1556765.
  * Add smoke test for autopkgtest.

 -- dann frazier <email address hidden> Fri, 01 Apr 2016 19:16:07 +0000

Changed in valgrind (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-04-08 07:26 EDT-------
OK, the updated valgrind package supports RISBGN now, but apparently not POPCNT:

==7145==
vex s390->IR: unimplemented insn: B9E1 0011
==7145== valgrind: Unrecognised instruction at address 0x108888.

For verification I used the test from the valgrind test suite: none/tests/s390x/popcnt.c.

Maybe there is something wrong with the patch '16_s390x_popcnt-insn.patch'?

Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-04-08 08:54 EDT-------
> Maybe there is something wrong with the patch '16_s390x_popcnt-insn.patch'?

Right: that patch lacks the VEX part (r3210). In upstream Valgrind you can see this with "svn log --diff -r3210 VEX".

dann frazier (dannf)
Changed in ubuntu-z-systems:
status: New → Fix Released
importance: Undecided → Critical
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2016-04-12 02:31 EDT-------
Currently this bug is flagged as "Fix Released", but
valgrind package supports for POPCNT is still missing.
Please change the status, and reopen. Or should we launch a new bugzilla referring to this missing support?

dann frazier (dannf)
Changed in ubuntu-z-systems:
assignee: nobody → dann frazier (dannf)
Changed in valgrind (Ubuntu):
status: Fix Released → Confirmed
Changed in ubuntu-z-systems:
status: Fix Released → Confirmed
Revision history for this message
dann frazier (dannf) wrote :

I'm going to leave this bug as fix released and instead track this in the new bug LP: #1569391 - since the scope of that is limited to just the popcnt issue, and therefore easier to review.

Changed in valgrind (Ubuntu):
status: Confirmed → Fix Released
Changed in ubuntu-z-systems:
status: Confirmed → Fix Released
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I was at debugging at IBM when we said we need to open that, thanks a lot Dann!
This will help to speed up some debugging.

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.