https://bugs.kde.org/show_bug.cgi?id=432801
Bug ID: 432801
Summary: Valgrind 3.16.1 reports a jump based on uninitialized
memory somehow related to clang and signals
Product: valgrind
Version: unspecified
Platform: Other
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: memcheck
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 135595
--> https://bugs.kde.org/attachment.cgi?id=135595&action=edit
The test program
The attached program (extracted from a much larger piece of code) gives us this
report:
==2193718== Conditional jump or move depends on uninitialised value(s)
==2193718== at 0x20199D: main (Standalone.c:33)
==2193718== Uninitialised value was created by a stack allocation
==2193718== at 0x201A90: ??? (in a.out)
STEPS TO REPRODUCE
clang -W -Wall -g -O2 Standalone.c && valgrind --track-origins=yes ./a.out
According to objdump the allocation happens in sigaction():
201a90: ff 25 ea 21 00 00 jmpq *0x21ea(%rip) # 203c80
<sigaction@GLIBC_2.2.5>
The use of the uninitialized memory then occurs in line 33 which reads "if
(hs==hp)".
It is unclear how something that sigaction() does could affect those two local
variables.
Some strange facts about the issue:
* It only occurs with clang (tested with 11.0.0 and 11.0.1), not with gcc
(8.3.1 and 4.8.5)
* It only happens when -O2 is specified, not with -O1
* It occurs under RHEL 8 (glibc 2.28) and Arch Linux (glibc 2.33) but not RHEL
7 (glibc 2.17)
* The problem goes away if slight, seemingly unrelated modifications are made
to the program
+ Skip assignment to variable pattern[0]
+ Change all size_t variables to unsigned int
+ Call sigaction() only once
+ Replace the myLen() call with a constant
We are in no way sure, this is a Valgrind issue, it could be a miscompile by
clang or a subtle error in the program we are missing. So our hope is that
someone with deeper knowledge can point us into the right direction.
--
You are receiving this mail because:
You are watching all bug changes.