[20.04] Valgrind: PPC sync instruction L field should only be 2 bits in ISA 3.0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
The Ubuntu-power-systems project |
Fix Released
|
Medium
|
Canonical Foundations Team | ||
valgrind (Ubuntu) |
Fix Released
|
Undecided
|
Canonical Foundations Team | ||
Bionic |
Fix Released
|
Undecided
|
Matthieu Clemenceau | ||
Focal |
Fix Released
|
Undecided
|
Matthieu Clemenceau |
Bug Description
SRU Description
[Impact]
Valgrind mishandles the L field of the sync instruction.
More details are available at: https:/
Single line patch available online with commit fb6f7abcbc92506
[Test Case]
On a PPC64le Hardware
# sudo apt-get install gcc valgrind
#cat test-sync.c
define __SYNC(l) ".long (0x7c0004AC | ((" #l ") << 21))"
int
main ()
{
asm volatile(__SYNC(4) : : : "memory");
}
# gcc test-sync.c && valgrind --tool=none ./a.out
This will report this error unpatched part of the valgrind output
dis_memsync(
disInstr(ppc): unhandled instruction: 0x7C8004AC
# This won't report this error once using the updated version
[Regression Potential]
The regression potential is very low since this bug has been submitted upstream and is already available in Groovy. Package build and run successfully. Not anticipating regression
End SRU Description
---Problem Description---
This is a bug report for focal.
Valgrind, including version 3.16, mishandles the L field of the sync instruction.
More details are available at: https:/
This is a request to backport the following Valgrind patch from upstream:
commit fb6f7abcbc92506
Author: Carl Love <email address hidden>
Date: Tue Jun 9 10:42:03 2020 -0500
Power PC Fix extraction of the L field for sync instruction
The L field is currently a two bit[22:21] field in ISA 3.0. The size of the
L field has changed over time.
Currently the ISA 3.0 Valgrind sync instruction support code sets the
flag_L for the instruction L field to a five bit value that includes bits
that are marked reserved the sync instruction. This patch fixes the issue for ISA 3.0
to only setting flag_L the specified two bits.
Valgrind bugzilla: https:/
Contact Information = Tulio <email address hidden>
---uname output---
N/A
Machine Type = Reproducible on all POWER8 and POWER9 servers
---Debugger---
A debugger is not configured
---Steps to Reproduce---
$ cat test-sync.c
#define __SYNC(l) ".long (0x7c0004AC | ((" #l ") << 21))"
int
main ()
{
asm volatile(__SYNC(4) : : : "memory");
}
$ gcc test-sync.c && valgrind --tool=none ./a.out
==150073== Nulgrind, the minimal Valgrind tool
==150073== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote.
==150073== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==150073== Command: ./a.out
==150073==
dis_memsync(
disInstr(ppc): unhandled instruction: 0x7C8004AC
==150073== valgrind: Unrecognised instruction at address 0x180788.
==150073== at 0x180788: main (in /home/tuliom/
==150073== Your program just tried to execute an instruction that Valgrind
==150073== did not recognise.
...
Userspace tool common name: Valgrind
The userspace tool has the following bit modes: 64-bit
Userspace deb: valgrind
Userspace tool obtained from project website: na
tags: | added: architecture-ppc64le bugnameltc-186878 severity-medium targetmilestone-inin20041 |
Changed in ubuntu: | |
assignee: | nobody → Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage) |
affects: | ubuntu → valgrind (Ubuntu) |
Changed in ubuntu-power-systems: | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage) |
Changed in valgrind (Ubuntu): | |
assignee: | Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage) → Canonical Foundations Team (canonical-foundations) |
Changed in ubuntu-power-systems: | |
assignee: | Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage) → Canonical Foundations Team (canonical-foundations) |
Changed in valgrind (Ubuntu Focal): | |
assignee: | nobody → Matthieu Clemenceau (mclemenceau) |
Changed in valgrind (Ubuntu Bionic): | |
assignee: | nobody → Matthieu Clemenceau (mclemenceau) |
Changed in valgrind (Ubuntu Focal): | |
status: | New → In Progress |
Changed in ubuntu-power-systems: | |
status: | Triaged → In Progress |
Changed in ubuntu-power-systems: | |
status: | In Progress → Fix Committed |
tags: | added: id-5eece09c4ff98f41a3ed6135 |
tags: |
added: verification-done-focal removed: verification-needed-focal |
Changed in ubuntu-power-systems: | |
status: | Fix Committed → Fix Released |
tags: | added: fr-2 |
Just as a side note: this is a follow on ticket of LP 1884143