Bug 388895

Summary: LibVEX_FrontEnd assertion failure: `0 == sizeof(VexGuestX86State) % LibVEX_GUEST_STATE_ALIGN'
Product: [Developer tools] valgrind Reporter: bob
Component: vexAssignee: Julian Seward <jseward>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: ivosh
Priority: NOR    
Version First Reported In: 3.14 SVN   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Tiny test case

Description bob 2018-01-13 05:06:03 UTC
Upon calling LibVEX_FrontEnd (with the args configured for an AMD64 host and an x86 guest), libvex bails out with the following message:

    priv/main_main.c:375 (LibVEX_FrontEnd): Assertion `0 == sizeof(VexGuestX86State) % LibVEX_GUEST_STATE_ALIGN' failed.
Comment 1 bob 2018-01-13 05:07:12 UTC
Created attachment 109830 [details]
Tiny test case

➜  test  gcc test.c
➜  test  ./a.out
ALIGN: 16
SIZE: 360
Comment 2 bob 2018-01-13 05:18:52 UTC
Just tested against the header from git master, and the result is the same. I assume it's a mirror of the 3.14 SVN?

Sorry for the noise.
Comment 3 Ivo Raisr 2018-01-13 19:46:41 UTC
SVN is a past thing. Valgrind lives in GIT now:
http://valgrind.org/downloads/repository.html
Comment 4 bob 2018-01-15 10:37:55 UTC
I've been fiddling with the headers a little, and it turns out that GCC on my system seems to always pad VexGuestX86State and then align by 8. The header in git has a 16-aligned size if I specify the packed GCC attribute.

It seems to be that an extra four bytes of padding are added after the segment registers to 8-align the guest_LDT member. Moving one of the trailing padding ints to after guest_SS gives a 16-aligned size.
Comment 5 Julian Seward 2018-08-06 08:24:12 UTC
(In reply to bob from comment #0)
> Upon calling LibVEX_FrontEnd (with the args configured for an AMD64 host and
> an x86 guest), libvex bails out with the following message:

We gave up on supporting cross-target Vex some years back, so I am not
surprised this doesn't work.  It seems unlikely to me that it'll get fixed
any time soon.