Bug 511304 - instruction decoding misaligned
Summary: instruction decoding misaligned
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (other bugs)
Version First Reported In: 3.23.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-29 08:37 UTC by leon
Modified: 2025-10-29 08:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description leon 2025-10-29 08:37:49 UTC
SUMMARY

the instruction boundary used by valgrind is offset for even the first instruction of the main. without valgrind, the application runs fine (well, except for a memory leak that i'm trying to debug ;-)

STEPS TO REPRODUCE

1. start valgrind for any application using musl libc on mips

OBSERVED RESULT

valgrind crashes because it tries to use the invalid instruction encodings at a wrong boundary. so far, the only offset i've encountered is: <main> + 1.

EXPECTED RESULT

normal operation of valgrind

SOFTWARE/OS VERSIONS

Openwrt (commit f5fd7ef8886)
these patches are applied: https://github.com/openwrt/openwrt/tree/1a55d90320c169e1e45faa88e5ade69f85af1c9c/package/devel/valgrind/patches

ADDITIONAL INFORMATION

valgrind /bin/busybox:

vex mips->IR: unhandled instruction bytes: 0xF8 0x1A 0x20 0x2A
==24440== valgrind: Unrecognised instruction at address 0x40985d.

0040985c <main>:
  40985c:       64f8            save    64,ra,s0-s1
  40985e:       1a20 2acc       jal     44ab30 <__errno_location@mips16plt>


homegrown application:

vex mips->IR: unhandled instruction bytes: 0xF9 0x67 0x7F 0xD3
==23528== valgrind: Unrecognised instruction at address 0x4049a1.

004049a0 <main>:
  4049a0:       63f9            addiu   sp,-56

int main(void)
{
  4049a2:       677f            move    v1,ra
  4049a4:       d30d            sw      v1,52(sp)
  4049a6:       d10c            sw      s1,48(sp)
  4049a8:       0106            addiu   s1,sp,24