Bug 504301

Summary: Unrecognised instruction when load librte_eal.so with rdseed
Product: [Developer tools] valgrind Reporter: Gabin <ligangbin117>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED WORKSFORME    
Severity: normal CC: mark, pjfloyd
Priority: NOR    
Version First Reported In: 3.25.0   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Gabin 2025-05-16 02:00:34 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY
when we run  program with valgrind,we got a abort.
valgrind log:
--2416285-- REDIR: 0x20a491b0 (libc.so.6:__GI_strstr) redirected to 0x4c3b1c0 (__strstr_sse2)
--2416285-- REDIR: 0x20b152e0 (libc.so.6:__strchrnul_avx2) redirected to 0x4c3aa20 (strchrnul)
--2416285-- REDIR: 0x20a4a130 (libc.so.6:strcasestr) redirected to 0x4c3b400 (strcasestr)
--2416285-- REDIR: 0x20a61c30 (libc.so.6:__strstr_sse2_unaligned) redirected to 0x4c3b140 (strstr)
vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF8 0x89 0x44 0x24 0x8 0x72
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==2416285== valgrind: Unrecognised instruction at address 0x97f6994.
==2416285==    at 0x97F6994: rte_rand_init (in /usr/lib64/librte_eal.so.24)
==2416285==    by 0x400F779: call_init.part.0 (dl-init.c:72)
==2416285==    by 0x400F885: call_init (dl-init.c:118)
==2416285==    by 0x400F885: _dl_init (dl-init.c:119)
==2416285==    by 0x40011F9: ??? (in /usr/lib64/ld-2.31.so)
==2416285==    by 0xA: ???
==2416285==    by 0xFFF00063A: ???
==2416285==    by 0xFFF00064B: ???
==2416285==    by 0xFFF00064E: ???
==2416285==    by 0xFFF000651: ???
==2416285==    by 0xFFF00065B: ???
==2416285==    by 0xFFF00065E: ???
==2416285==    by 0xFFF000661: ???
==2416285== Your program just tried to execute an instruction that Valgrind
==2416285== did not recognise.  There are two possible reasons for this.
==2416285== 1. Your program has a bug and erroneously jumped to a non-code
==2416285==    location.  If you are running Memcheck and you just saw a
==2416285==    warning about a bad jump, it's probably your program's fault.
==2416285== 2. The instruction is legitimate but Valgrind doesn't handle it,
==2416285==    i.e. it's Valgrind's fault.  If you think this is the case or
==2416285==    you are not sure, please let us know and we'll try to fix it.
==2416285== Either way, Valgrind will now raise a SIGILL signal which will
==2416285== probably kill your program.
==2416285==
==2416285== Process terminating with default action of signal 4 (SIGILL): dumping core
==2416285==  Illegal opcode at address 0x97F6994
==2416285==    at 0x97F6994: rte_rand_init (in /usr/lib64/librte_eal.so.24)
==2416285==    by 0x400F779: call_init.part.0 (dl-init.c:72)
==2416285==    by 0x400F885: call_init (dl-init.c:118)
==2416285==    by 0x400F885: _dl_init (dl-init.c:119)
==2416285==    by 0x40011F9: ??? (in /usr/lib64/ld-2.31.so)
==2416285==    by 0xA: ???
==2416285==    by 0xFFF00063A: ???
==2416285==    by 0xFFF00064B: ???
==2416285==    by 0xFFF00064E: ???
==2416285==    by 0xFFF000651: ???
==2416285==    by 0xFFF00065B: ???
==2416285==    by 0xFFF00065E: ???
==2416285==    by 0xFFF000661: ???
backtrace info:
(gdb) bt
#0  0x00000000097f6994 in rte_rand_init () from /lib64/librte_eal.so.24
#1  0x000000000400f77a in call_init (l=<optimized out>, argc=argc@entry=11, argv=argv@entry=0xfff000398, env=env@entry=0xfff0003f8) at dl-init.c:72
#2  0x000000000400f886 in call_init (env=0xfff0003f8, argv=0xfff000398, argc=11, l=<optimized out>) at dl-init.c:118
#3  _dl_init (main_map=0x422a190, argc=11, argv=0xfff000398, env=0xfff0003f8) at dl-init.c:119
#4  0x00000000040011fa in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#5  0x000000000000000b in ?? ()
#6  0x0000000fff00063b in ?? ()
#7  0x0000000fff00064c in ?? ()
#8  0x0000000fff00064f in ?? ()
#9  0x0000000fff000652 in ?? ()
#10 0x0000000fff00065c in ?? ()
#11 0x0000000fff00065f in ?? ()
#12 0x0000000fff000662 in ?? ()
#13 0x0000000fff000665 in ?? ()
#14 0x0000000fff000668 in ?? ()
#15 0x0000000fff000684 in ?? ()
#16 0x0000000fff000687 in ?? ()
#17 0x0000000000000000 in ?? ()
(gdb) disass
Dump of assembler code for function rte_rand_init:
   0x00000000097f6990 <+0>:     sub    $0x18,%rsp
=> 0x00000000097f6994 <+4>:     rdseed %eax
   0x00000000097f6997 <+7>:     mov    %eax,0x8(%rsp)
   0x00000000097f699b <+11>:    jb     0x97f69b3 <rte_rand_init+35>
   0x00000000097f699d <+13>:    rdtsc
   0x00000000097f699f <+15>:    shl    $0x20,%rdx
   0x00000000097f69a3 <+19>:    or     %rdx,%rax
   0x00000000097f69a6 <+22>:    mov    %rax,%rdi
   0x00000000097f69a9 <+25>:    callq  0x97f4b70 <rte_srand@plt>
   0x00000000097f69ae <+30>:    add    $0x18,%rsp
   0x00000000097f69b2 <+34>:    retq
   0x00000000097f69b3 <+35>:    rdseed %eax
   0x00000000097f69b6 <+38>:    mov    %eax,0xc(%rsp)
   0x00000000097f69ba <+42>:    jae    0x97f699d <rte_rand_init+13>
   0x00000000097f69bc <+44>:    mov    %eax,%edi
   0x00000000097f69be <+46>:    mov    0x8(%rsp),%eax
   0x00000000097f69c2 <+50>:    shl    $0x20,%rdi
   0x00000000097f69c6 <+54>:    or     %rax,%rdi
   0x00000000097f69c9 <+57>:    jmp    0x97f69a9 <rte_rand_init+25>
End of assembler dump.


STEPS TO REPRODUCE
1. running program with valgrind
2. 
3. 

OBSERVED RESULT
aborted.

EXPECTED RESULT
running normal

SOFTWARE/OS VERSIONS
Windows:
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.9.2009 (Core)
Release:        7.9.2009
Codename:       Core


Linux node146 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Paul Floyd 2025-05-16 05:06:39 UTC
Are you really using the latest Valgrind?

Rdseed support was added about 5 years ago.
Comment 2 Mark Wielaard 2025-10-17 12:34:25 UTC
(In reply to Paul Floyd from comment #1)
> Are you really using the latest Valgrind?
> 
> Rdseed support was added about 5 years ago.

Yeah, it seems unlikely this was against a recent valgrind given this seems to be on RHEL7.
Please reopen if you can replicate against a more recent valgrind version.