Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyvex errors on 32 bit linux #53

Closed
k0ss opened this issue Jan 19, 2017 · 3 comments
Closed

Pyvex errors on 32 bit linux #53

k0ss opened this issue Jan 19, 2017 · 3 comments
Assignees

Comments

@k0ss
Copy link

k0ss commented Jan 19, 2017

I was testing angr in a 32 bit kali vm and noticed that no functions were being found by any CFG. During troubleshooting with @ltfish he found that it was a problem with pyvex on my 32 bit version of linux.

(angr) root@kali:~# cat testpyvex.py 
import pyvex
import archinfo
pyvex.IRSB("\xc3", 0, archinfo.arch_from_id('X86')).pp()
(angr) root@kali:~# python testpyvex.py 
Traceback (most recent call last):
  File "testpyvex.py", line 3, in <module>
    pyvex.IRSB("\xc3", 0, archinfo.arch_from_id('X86')).pp()
  File "/root/.virtualenvs/angr/local/lib/python2.7/site-packages/pyvex/block.py", line 60, in __init__
    lift(self, data, num_bytes, num_inst, bytes_offset, traceflags)
  File "/root/.virtualenvs/angr/local/lib/python2.7/site-packages/pyvex/lift/__init__.py", line 88, in lift
    raise PyVEXError('\n\n'.join(errors))
pyvex.errors.PyVEXError: vex: priv/main_main.c:619 (LibVEX_Translate): Assertion `0 == sizeof(VexGuestX86State) % LibVEX_GUEST_STATE_ALIGN' failed
@ltfish
Copy link
Member

ltfish commented Jan 19, 2017

Confirmed. Assigned to @rhelmot (since he was messing with that part of the code).

@rhelmot
Copy link
Member

rhelmot commented Jan 22, 2017

Resolved via angr/vex@3666b75

This ended up being a really obscure piece of GCC behavior... by default, on 32 bit platforms, gcc will only align 64-bit datatypes to 32 bits. This is some pretty fucked up behavior if you ask me! The flag -malign-double fixes this.

@rhelmot rhelmot closed this as completed Jan 22, 2017
@joeleong
Copy link

FYI: I think the patch breaks builds with old versions of clang such as the system version on many versions of OS X. I worked around it by installing a newer version via Homebrew. (More info: https://reviews.llvm.org/D19740)

shaymargolis pushed a commit to shaymargolis/pyvex that referenced this issue Jul 16, 2024
* Added the simplest form of RETF without consideration for protected mode / segment privilege

* Changed comment from RET to RETF

* Missed sizeof(R_CS) = 16 bits returns Ijk_Ret now

Co-authored-by: Dan Pesce <dan@redballoonsecurity.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants