[valgrind] [Bug 471036] disInstr_AMD64: disInstr miscalculated next %rip on RORX imm8, m32/64, r32/64

2024-02-09 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=471036

Matthias Schwarzott  changed:

   What|Removed |Added

 Attachment #165688|0   |1
is obsolete||

--- Comment #5 from Matthias Schwarzott  ---
Created attachment 165691
  --> https://bugs.kde.org/attachment.cgi?id=165691=edit
Show more context (rip, instr bytes, vex-disasm trace) for this panic case

Even more context for the error case (idea how to rerun disInstr_AMD64_WRK
taken from the expect_CAS case below):
 current %rip = 0x109ABE
assumed next %rip = 0x109AC7
 actual next %rip = 0x109AC8
instruction bytes: 0xC4 0xE3 0xFB 0xF0 0xD 0x60 0x45 0x0 0x0 0x43
0x109ABE:  rorx 67,17760(%rip),%rcx


vex: the `impossible' happened:
   disInstr_AMD64: disInstr miscalculated next %rip

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

[valgrind] [Bug 471036] disInstr_AMD64: disInstr miscalculated next %rip on RORX imm8, m32/64, r32/64

2024-02-09 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=471036

--- Comment #4 from Matthias Schwarzott  ---
I tested the attachment "Example patch for guest_amd64_toIR"
https://bugs.kde.org/attachment.cgi?id=159662
It perfectly fixes the problem.

Without fix (but extended context-printing) the extended bmi testcase fails
like this:
shrx32   -> 

 current %rip = 0x109ABE
assumed next %rip = 0x109AC7
 actual next %rip = 0x109AC8
instruction bytes: 0xC4 0xE3 0xFB 0xF0 0xD 0x60 0x45 0x0 0x0 0x43

vex: the `impossible' happened:
   disInstr_AMD64: disInstr miscalculated next %rip
vex storage: T total 171126616 bytes allocated
vex storage: P total 512 bytes allocated

valgrind: the 'impossible' happened:
   LibVEX called failure_exit().

host stacktrace:
==20396==at 0x5804383A: show_sched_status_wrk (m_libcassert.c:407)
==20396==by 0x58043957: report_and_quit (m_libcassert.c:478)
==20396==by 0x58043BAB: panic (m_libcassert.c:554)
==20396==by 0x58043BAB: vgPlain_core_panic_at (m_libcassert.c:559)
==20396==by 0x58043BCA: vgPlain_core_panic (m_libcassert.c:564)
==20396==by 0x58058034: failure_exit (m_translate.c:761)
==20396==by 0x5813068A: vpanic (main_util.c:253)
==20396==by 0x581BBDDD: disInstr_AMD64 (guest_amd64_toIR.c:32714)
==20396==by 0x58148E76: disassemble_basic_block_till_stop.constprop.0
(guest_generic_bb_to_IR.c:956)
==20396==by 0x5814965C: bb_to_IR (guest_generic_bb_to_IR.c:1365)
==20396==by 0x5812D6AF: LibVEX_FrontEnd (main_main.c:583)
==20396==by 0x5812E00C: LibVEX_Translate (main_main.c:1235)
==20396==by 0x5805A791: vgPlain_translate (m_translate.c:1831)
==20396==by 0x58097F3B: handle_chain_me (scheduler.c:1164)
==20396==by 0x5809A42B: vgPlain_scheduler (scheduler.c:1531)
==20396==by 0x580E5569: thread_wrapper (syswrap-linux.c:102)
==20396==by 0x580E5569: run_a_thread_NORETURN (syswrap-linux.c:155)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 20396)
==20396==at 0x1099FC: do_rorx64 (bmi.c:379)
==20396==by 0x10AEDC: main (bmi.c:1012)
client stack range: [0x1FFEFFD000 0x1FFF000FFF] client SP: 0x1FFEFFF258
valgrind stack range: [0x1002DEB000 0x1002EEAFFF] top usage: 10960 of 1048576

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

[valgrind] [Bug 471036] disInstr_AMD64: disInstr miscalculated next %rip on RORX imm8, m32/64, r32/64

2024-02-09 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=471036

--- Comment #3 from Matthias Schwarzott  ---
Created attachment 165690
  --> https://bugs.kde.org/attachment.cgi?id=165690=edit
Add rorx rip-relative testcase to bmi.c

Adding these instructions to the bmi testcase:
1abe:   c4 e3 fb f0 0d 60 45rorx   $0x43,0x4560(%rip),%rcx#
6028 
1ac5:   00 00 43 

1bf9:   c4 e3 7b f0 0d 2d 44rorx   $0x43,0x442d(%rip),%ecx#
6030 
1c00:   00 00 43

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

[valgrind] [Bug 471036] disInstr_AMD64: disInstr miscalculated next %rip on RORX imm8, m32/64, r32/64

2024-02-09 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=471036

Matthias Schwarzott  changed:

   What|Removed |Added

 CC||z...@gentoo.org

--- Comment #2 from Matthias Schwarzott  ---
Created attachment 165688
  --> https://bugs.kde.org/attachment.cgi?id=165688=edit
Show more context (rip and instr bytes) for this panic case

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

[valgrind] [Bug 79362] Debug info is lost for .so files when they are dlclose'd

2017-11-06 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=79362

Matthias Schwarzott <z...@gentoo.org> changed:

   What|Removed |Added

 CC||z...@gentoo.org

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

[k3b] [Bug 382941] Segfault from getSupportedWriteSpeedsVia2A

2017-08-14 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=382941

--- Comment #14 from Matthias Schwarzott <z...@gentoo.org> ---
(In reply to Leslie Zhai from comment #12)
> Git commit 16576d6fd33fd4fd81f66904d29a4478a91a561f by Leslie Zhai.
> Committed on 14/08/2017 at 03:35.
> Pushed by lesliezhai into branch 'master'.
> 
> Revert from{2,4}Byte.
> 
> Hi Thomas:
> Please help me! I have no idea why num_wr_speed_des (numDesc) might
> be wrong? and how to make it correct if bigger than (32 - 8) / 4,
> and where the *magic numbers* about 32 and 8 come from.
> 
> Testcase by Matthias Schwarzott!
> 
> CCMAIL: scdbac...@gmx.net
> 
> M  +11   -8libk3bdevice/k3bdevice.cpp
> M  +2-2libk3bdevice/k3bdeviceglobals.cpp
> M  +19   -5tests/k3bdeviceglobalstest.cpp
> 
> https://commits.kde.org/k3b/16576d6fd33fd4fd81f66904d29a4478a91a561f

This testcase should be deleted (for from2Byte and from4Byte):
+const unsigned char buf0[] = { '\0' };
+QCOMPARE(K3b::Device::from4Byte(buf0), (quint32)0);

It reads data after the array, so will observe undefined behaviour.

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

[k3b] [Bug 382941] Segfault from getSupportedWriteSpeedsVia2A

2017-08-11 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=382941

Matthias Schwarzott <z...@gentoo.org> changed:

   What|Removed |Added

 CC||z...@gentoo.org

--- Comment #7 from Matthias Schwarzott <z...@gentoo.org> ---
Commit 7f0be6a33b8260f7789c6aeed58be8d1c844229a seems to have broken detection
of the burn device / existing empty media to burn on.

I get a lot of lines printing "Invalid Byte!" the other errors:
[...]
Invalid Byte!   
(K3b::Device::Device)  "/dev/sr0" : Missing modepage 0x05 data. 
(K3b::Device::Device)  "/dev/sr0" : Cannot check write modes.   
[...]

Looking at the code:
from{2,4}Byte seems to be used to read 16/32bit big endian integer values from
raw data.
So calling strlen is just wrong. This leads to rejecting valid byte-streams
containing zero bytes.

Second: I suggest to improve the unit test with a test parsing good 16 and
32bit  values (at least one with all values != 0 and one where 0 values are
part).

e.g. for from2Byte
+unsigned const char buf0[] = { 0x00, 0x00 };
+QCOMPARE(K3b::Device::from2Byte(buf0), (quint16)0x);
+unsigned const char buf1[] = { 0x00, 0x70 };
+QCOMPARE(K3b::Device::from2Byte(buf1), (quint16)0x0070);
+unsigned const char buf2[] = { 0x05, 0x00 };
+QCOMPARE(K3b::Device::from2Byte(buf2), (quint16)0x0500);
+unsigned const char buf3[] = { 0xF0, 0x03 };
+QCOMPARE(K3b::Device::from2Byte(buf2), (quint16)0xF003);

the same should be done for from4Byte
+unsigned const char buf0[] = { 0x00, 0x00, 0x00, 0x00 };
+QCOMPARE(K3b::Device::from4Byte(buf0), (quint32)0x);
+unsigned const char buf0[] = { 0x00, 0x00, 0x00, 0x01 };
+QCOMPARE(K3b::Device::from4Byte(buf0), (quint32)0x0001);
+unsigned const char buf0[] = { 0x12, 0x34, 0x56, 0x78 };
+QCOMPARE(K3b::Device::from4Byte(buf0), (quint32)0x12345678);

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

[valgrind] [Bug 380200] xtree generated callgrind files refer to files without directory name

2017-06-02 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=380200

--- Comment #3 from Matthias Schwarzott <z...@gentoo.org> ---
(In reply to Philippe Waroquiers from comment #2)
> (In reply to Matthias Schwarzott from comment #1)
> > Created attachment 105714 [details]
> > valgrind-xtree-add-regtests.patch
> > 
> > This attachment adds two experimental tests for xtree-leak and xtree-memory.
> > xtree-leak uses callgrind_annotate to show the cost values per function and
> > sorts the output afterwards to make it stable.
> Why is the sort needed ? Do you see variations between runs ?
> Or variations between different systems/platforms ?
> 
I run it under amd64. There are variations between runs.
The order of functions differs.
I have not yet checked if the xtree files are stable or not.

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

[valgrind] [Bug 380200] xtree generated callgrind files refer to files without directory name

2017-05-25 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=380200

--- Comment #1 from Matthias Schwarzott <z...@gentoo.org> ---
Created attachment 105714
  --> https://bugs.kde.org/attachment.cgi?id=105714=edit
valgrind-xtree-add-regtests.patch

This attachment adds two experimental tests for xtree-leak and xtree-memory.
xtree-leak uses callgrind_annotate to show the cost values per function and
sorts the output afterwards to make it stable.

The other for xtree-memory only checks the generated file. I wonder if this one
is stable enough.

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

[valgrind] [Bug 380200] New: xtree generated callgrind files refer to files without directory name

2017-05-25 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=380200

Bug ID: 380200
   Summary: xtree generated callgrind files refer to files without
directory name
   Product: valgrind
   Version: 3.13 SVN
  Platform: Other
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: jsew...@acm.org
  Reporter: z...@gentoo.org
  Target Milestone: ---

Created attachment 105712
  --> https://bugs.kde.org/attachment.cgi?id=105712=edit
valgrind-xtree-add-directory-to-filename

The files generated by the new xtree code in callgrind format contain only
filenames without directory.

The attached patch fixes it.

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

[valgrind] [Bug 358697] valgrind.h: Some code remains even when defining NVALGRIND

2017-03-30 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=358697

--- Comment #5 from Matthias Schwarzott <z...@gentoo.org> ---
Patch valgrind-3.12.0-valgrind_printf-simple-nvalgrind-fix-plus-testcase.patch
has been tested with MSVC 2008 configured to warning level 4.

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

[valgrind] [Bug 358697] valgrind.h: Some code remains even when defining NVALGRIND

2017-03-30 Thread Matthias Schwarzott
https://bugs.kde.org/show_bug.cgi?id=358697

--- Comment #4 from Matthias Schwarzott <z...@gentoo.org> ---
Created attachment 104809
  --> https://bugs.kde.org/attachment.cgi?id=104809=edit
valgrind-3.12.0-valgrind_printf-simple-nvalgrind-fix-plus-testcase.patch

This new patch fixes the problem in the simplest way: "(void)format;"
Additionally it adds a testcase to compile and run the existing vgprintf.c with
NVALGRIND

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

[valgrind] [Bug 358697] valgrind.h: Some code remains even when defining NVALGRIND

2016-01-29 Thread Matthias Schwarzott via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=358697

--- Comment #3 from Matthias Schwarzott <z...@gentoo.org> ---
e.g. QT has a macro like this:

#define Q_UNUSED(x) (void)x;

To be used inside functions:
Q_UNUSED(format)

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


[valgrind] [Bug 358697] valgrind.h: Some code remains even when defining NVALGRIND

2016-01-28 Thread Matthias Schwarzott via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=358697

--- Comment #2 from Matthias Schwarzott <z...@gentoo.org> ---
The simplest solution could be to use "(void)format" and protect this with an
ifdef checking that we are not running under the problematic static code
checker.

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


[valgrind] [Bug 358697] valgrind.h: Some code remains even when defining NVALGRIND

2016-01-28 Thread Matthias Schwarzott via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=358697

--- Comment #1 from Matthias Schwarzott <z...@gentoo.org> ---
Created attachment 96891
  --> https://bugs.kde.org/attachment.cgi?id=96891=edit
valgrind-improve-unused-parameter-on-r15763.patch

This patch implements the __attribute__ usage.
But I am not sure about the ifdef code. It is just what was originally around
the __attribute__ usage.

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


[valgrind] [Bug 356817] New: valgrind.h triggers compiler errors on MSVC when defining NVALGRIND

2015-12-16 Thread Matthias Schwarzott via KDE Bugzilla
https://bugs.kde.org/show_bug.cgi?id=356817

Bug ID: 356817
   Summary: valgrind.h triggers compiler errors on MSVC when
defining NVALGRIND
   Product: valgrind
   Version: unspecified
  Platform: Compiled Sources
OS: MS Windows
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: jsew...@acm.org
  Reporter: z...@gentoo.org

When compiling sources on MSVC with NVALGRIND being defined, it shows this
error:
1>include\Valgrind/valgrind.h(4493) : error C2220: warning treated as error -
no 'object' file generated
1>include\Valgrind/valgrind.h(4493) : warning C4100: 'format' : unreferenced
formal parameter
1>include\Valgrind/valgrind.h(4531) : warning C4100: 'format' : unreferenced
formal parameter


Reproducible: Always

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