Bug 501437

Summary: Unhandled instruction bytes error for shlx/shrx
Product: [Developer tools] valgrind Reporter: heideggm
Component: vexAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: normal CC: tom
Priority: NOR    
Version First Reported In: 3.24.0   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description heideggm 2025-03-13 08:14:13 UTC
I receive unhandled instruction bytes error on an Ubuntu/Amd64 platform:

==5137== Memcheck, a memory error detector
==5137== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==5137== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==5137== Command: ./myapp
==5137== 
vex amd64->IR: unhandled instruction bytes: 0xC4 0xE2 0x79 0xF7 0xD1 0x8B 0x45 0xB4 0x1 0xD0
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=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==5137== valgrind: Unrecognised instruction at address 0x4f7dc5.
==5137==    at 0x4F7DC5: google::protobuf::internal::ReadSizeFallback(char const*, unsigned int) (parse_context.cc:401)
==5137==    by 0x4CE499: google::protobuf::internal::ReadSize(char const**) (parse_context.h:606)
==5137==    by 0x6376D3: char const* google::protobuf::internal::ParseContext::ParseMessage<google::protobuf::DescriptorProto>(google::protobuf::DescriptorProto*, char const*) (parse_context.h:643)
==5137==    by 0x603169: google::protobuf::FileDescriptorProto::_InternalParse(char const*, google::protobuf::internal::ParseContext*) (descriptor.pb.cc:1639)
==5137==    by 0x4F3F25: bool google::protobuf::internal::MergeFromImpl<false>(google::protobuf::StringPiece, google::protobuf::MessageLite*, google::protobuf::MessageLite::ParseFlags) (message_lite.cc:144)
==5137==    by 0x4F4DFF: bool google::protobuf::MessageLite::ParseFrom<(google::protobuf::MessageLite::ParseFlags)1, google::protobuf::StringPiece>(google::protobuf::StringPiece const&) (message_lite.h:577)
==5137==    by 0x4F1F41: google::protobuf::MessageLite::ParseFromArray(void const*, int) (message_lite.cc:325)
==5137==    by 0x642618: google::protobuf::EncodedDescriptorDatabase::Add(void const*, int) (descriptor_database.cc:556)
==5137==    by 0x598762: google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int) (descriptor.cc:1371)
==5137==    by 0x52F7AC: google::protobuf::(anonymous namespace)::AddDescriptorsImpl(google::protobuf::internal::DescriptorTable const*) (generated_message_reflection.cc:2494)
==5137==    by 0x52F7E9: google::protobuf::(anonymous namespace)::AddDescriptors(google::protobuf::internal::DescriptorTable const*) (generated_message_reflection.cc:2505)
==5137==    by 0x52F85B: google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*) (generated_message_reflection.cc:2529)

Same error for version 3.24.

he problematic instructions seem to be shlx/shrx:

  5e:    c4 e2 f9 f7 d2           shlx   %rax,%rdx,%rdx
  63:    8b 45 dc                 mov    -0x24(%rbp),%eax
  66:    c4 e2 fb f7 d2           shrx   %rax,%rdx,%rdx
 
Which is from the bmi2 instruction set.

Adding -mno-bmi2 to the g++ parameters helps.

I'm confused, shouldn't shlx/shrx be supported by valgrind?

Regards
Comment 1 Tom Hughes 2025-03-13 08:32:33 UTC
The 0xC4 prefix indicates that this is using EVEX encoding which means it it dependent on AVX-512 support to be decoded.

*** This bug has been marked as a duplicate of bug 383010 ***
Comment 2 heideggm 2025-03-13 09:20:39 UTC
Greetings,

can you tell me if this fix has been integrated into a mainline release or is planned to be?

Regards
Comment 3 Tom Hughes 2025-03-13 10:01:37 UTC
There is no fix (yet) as that is still an open bug? I mean there are patches on it but they aren't committed anywhere.
Comment 4 heideggm 2025-03-13 10:08:24 UTC
ktx