Bug 1464085 - valgrind: Mask CPUID support in HWCAP on aarch64
Summary: valgrind: Mask CPUID support in HWCAP on aarch64
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: valgrind
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Mark Wielaard
QA Contact: Miloš Prchlík
Vladimír Slávik
URL:
Whiteboard:
Depends On: 1464211
Blocks: 1467952
TreeView+ depends on / blocked
 
Reported: 2017-06-22 12:04 UTC by Florian Weimer
Modified: 2018-04-10 13:14 UTC (History)
6 users (show)

Fixed In Version: valgrind-3.13.0-9.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1464211 1467952 (view as bug list)
Environment:
Last Closed: 2018-04-10 13:14:07 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
KDE Software Compilation 381556 None None None 2017-06-23 10:55:44 UTC
Red Hat Product Errata RHBA-2018:0773 None None None 2018-04-10 13:14:45 UTC

Description Florian Weimer 2017-06-22 12:04:45 UTC
valgrind currently does not know anything about the CPUID flag added to the HWCAP auxv entry in kernel 4.11.  It passes this flag through to applications, but it will then choke when the application uses it, like this:

ARM64 front end: branch_etc
disInstr(arm64): unhandled instruction 0xD5380000
disInstr(arm64): 1101'0101 0011'1000 0000'0000 0000'0000
==924== valgrind: Unrecognised instruction at address 0x11f548.
==924==    at 0x11F548: init_cpu_features (cpu-features.c:32)
==924==    by 0x11F548: dl_platform_init (dl-machine.h:241)
==924==    by 0x11F548: _dl_sysdep_start (dl-sysdep.c:231)
==924==    by 0x10981B: _dl_start_final (rtld.c:412)
==924==    by 0x109AAB: _dl_start (rtld.c:520)

This is from a newer glibc (not the one in Red Hat Enterprise Linux).  The crashing instruction is the mrs in the glibc startup code:

  if (hwcap & HWCAP_CPUID)
    {
      register uint64_t id = 0;
      asm volatile ("mrs %0, midr_el1" : "=r"(id));
      cpu_features->midr_el1 = id;
    }
  else
    cpu_features->midr_el1 = 0;

Perhaps valgrind should mask all the HWCAP bits it knows nothing about.

Comment 1 Florian Weimer 2017-06-22 16:21:40 UTC
Workaround: Run with “LD_HWCAP_MASK=1”.

Comment 2 Mark Wielaard 2017-06-23 10:55:45 UTC
The upstream bug is https://bugs.kde.org/show_bug.cgi?id=381556
arm64: Handle feature registers access on 4.11 Linux kernel or later

Fedora valgrind-3.13.0-3.fc27 contains a workaround, see bug https://bugzilla.redhat.com/show_bug.cgi?id=1464211

Comment 7 Miloš Prchlík 2018-01-08 09:02:56 UTC
Verified with build valgrind-3.13.0-10.el7.

Comment 10 errata-xmlrpc 2018-04-10 13:14:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0773


Note You need to log in before you can comment on or make changes to this bug.