https://bugs.kde.org/show_bug.cgi?id=451837

            Bug ID: 451837
           Summary: When profiling this specific executable, valgrind
                    fails to break down 0x62 0xF1 0x7F 0x28 0x7F 0x2 0xF
                    0x87 0x95 0xA1 into 2 separate instructions
           Product: valgrind
           Version: 3.19 GIT
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: callgrind
          Assignee: josef.weidendor...@gmx.de
          Reporter: ytr...@sdf-eu.org
  Target Milestone: ---

Created attachment 147688
  --> https://bugs.kde.org/attachment.cgi?id=147688&action=edit
Attached executable for reproducing the bug.

I built the latest btrfsprogs on my system with profile feedback
(-fprofile-use), the program runs normally on my cpu but when I try to perform
[liveuser@localhost-live btrfs-progs-v5.16.2]$ valgrind --tool=callgrind
--dump-instr=yes --branch-sim=yes --collect-jumps=yes ./btrfs.static check -p
--init-csum-tree /tmp/newly_btrfs_volume_example_with_sha256
with the executable attached, it fails with :
Starting repair.
Opening filesystem to check...
vex amd64->IR: unhandled instruction bytes: 0x62 0xF1 0x7F 0x28 0x7F 0x2 0xF
0x87 0x95 0xA1
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
==63828== valgrind: Unrecognised instruction at address 0x45dade.
==63828==    at 0x45DADE: btrfs_csum_data.constprop.0.isra.0 (disk-io.c:147)
==63828==    by 0x45D949: btrfs_check_super (disk-io.c:1666)
==63828==    by 0x45D876: btrfs_read_dev_super (disk-io.c:1879)
==63828==    by 0x45D5A9: btrfs_scan_one_device (volumes.c:548)
==63828==    by 0x45D4E3: check_mounted_where.constprop.0 (open-utils.c:61)
==63828==    by 0x45D489: check_mounted (open-utils.c:130)
==63828==    by 0x45CD93: cmd_check (main.c:10455)
==63828==    by 0x45C6DD: main (commands.h:125)
==63828== Your program just tried to execute an instruction that Valgrind
==63828== did not recognise.  There are two possible reasons for this.
==63828== 1. Your program has a bug and erroneously jumped to a non-code
==63828==    location.  If you are running Memcheck and you just saw a
==63828==    warning about a bad jump, it's probably your program's fault.
==63828== 2. The instruction is legitimate but Valgrind doesn't handle it,
==63828==    i.e. it's Valgrind's fault.  If you think this is the case or
==63828==    you are not sure, please let us know and we'll try to fix it.
==63828== Either way, Valgrind will now raise a SIGILL signal which will
==63828== probably kill your program.
==63828== 
==63828== Process terminating with default action of signal 4 (SIGILL): dumping
core
==63828==  Illegal opcode at address 0x45DADE
==63828==    at 0x45DADE: btrfs_csum_data.constprop.0.isra.0 (disk-io.c:147)
==63828==    by 0x45D949: btrfs_check_super (disk-io.c:1666)
==63828==    by 0x45D876: btrfs_read_dev_super (disk-io.c:1879)
==63828==    by 0x45D5A9: btrfs_scan_one_device (volumes.c:548)
==63828==    by 0x45D4E3: check_mounted_where.constprop.0 (open-utils.c:61)
==63828==    by 0x45D489: check_mounted (open-utils.c:130)
==63828==    by 0x45CD93: cmd_check (main.c:10455)
==63828==    by 0x45C6DD: main (commands.h:125)
==63828== 
==63828== Events    : Ir Bc Bcm Bi Bim
==63828== Collected : 791898 132272 8055 1806 620
==63828== 
==63828== I   refs:      791,898
==63828== 
==63828== Branches:      134,078  (132,272 cond + 1,806 ind)
==63828== Mispredicts:     8,675  (  8,055 cond +   620 ind)
==63828== Mispred rate:      6.5% (    6.1%     +  34.3%   )

But unlike what valgrind says 0x62 0xF1 0x7F 0x28 0x7F 0x2 0xF 0x87 0x95 0xA1
consists of 2 instructions instead of 1 and thus in reality isn’t a single
invalid instruction but :

000000000045dac0 <btrfs_csum_data.constprop.0.isra.0>:
  45dade:       62 f1 7f 28 7f 02       vmovdqu8 YMMWORD PTR [rdx],ymm0
  45dae4:       0f 87 95 a1 fa ff       ja     407c7f
<btrfs_csum_data.constprop.0.isra.0.cold+0x19>

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 37. Rpms executables only

Please fix this !

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to