|
From: Christian B. <bor...@de...> - 2014-02-24 20:54:10
|
On 19/02/14 17:38, Florian Krohm wrote:
> On 02/19/2014 12:11 PM, Maran Pakkirisamy wrote:
>
>> The test case fails from VEX r2818. Also the failure is not happening
>> always. Sometimes the testcase passes.
>> If I revert the changes in trunk/pub/libvex_guest_s390x.h, the testcase
>> passes all the time.
>
> Reverting r2818 is not exactly what we want as the problem is s390x
> specific. Can you add this assert somewhere
>
> vassert(sizeof(VexGuestS390XState) == 432);
>
> and see whether it fires? 432 is the expected size of the guest state
> but there is some trickery with a [0] array at the end of the guest
> state. This *should* work according to my reading of the docs but who knows.
The problem is fixed by the following code.
===================================================================
--- coregrind/m_initimg/initimg-linux.c (revision 13837)
+++ coregrind/m_initimg/initimg-linux.c (working copy)
@@ -1078,9 +1078,9 @@
VG_(memset)(&arch->vex_shadow1, 0xFF, sizeof(VexGuestS390XState));
VG_(memset)(&arch->vex_shadow2, 0x00, sizeof(VexGuestS390XState));
/* ... except SP, FPC, and IA */
- VG_(memset)(&arch->vex_shadow1 + VG_O_STACK_PTR, 0x00, 8);
- VG_(memset)(&arch->vex_shadow1 + VG_O_FPC_REG, 0x00, 4);
- VG_(memset)(&arch->vex_shadow1 + VG_O_INSTR_PTR, 0x00, 8);
+ arch->vex_shadow1.guest_SP = 0;
+ arch->vex_shadow1.guest_fpc = 0;
+ arch->vex_shadow1.guest_IA = 0;
/* Put essential stuff into the new state. */
arch->vex.guest_SP = iifii.initial_client_SP;
My current understanding is:
The pointer arithmetic is wrong. So we zeroed out 20 bytes somewhere else
in the VG_(threads) array. With the last changes we hit the tid field, causing
the assert to trigger.
Christian
|