diff --git a/tests/regress/x86_self_modifying.py b/tests/regress/x86_self_modifying.py index 189faa77..7c6e6a37 100755 --- a/tests/regress/x86_self_modifying.py +++ b/tests/regress/x86_self_modifying.py @@ -6,6 +6,9 @@ from struct import pack import os import regress +# The file we're loading is a full assembled ELF. +# Source for it, along with assembly instructions, are in x86_self_modifying.s + CODE_ADDR = 0x08048000 STACK_ADDR = 0x2000000 CODE = open(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'x86_self_modifying.elf')).read() diff --git a/tests/regress/x86_self_modifying.s b/tests/regress/x86_self_modifying.s index 86a5114e..5da290c1 100644 --- a/tests/regress/x86_self_modifying.s +++ b/tests/regress/x86_self_modifying.s @@ -1,3 +1,17 @@ +# Assembly instructions (tested on ubuntu 16.04 x86_64): +# $ as --32 x86_self_modifying.s -o x86_self_modifying.o +# $ ld -melf_i386 -z execstack x86_self_modifying.o -o x86_self_modifying.elf + +# Test that it works. return code should be 65 +# $ ./x86_self_modifying.elf +# $ echo $? +# 65 + +# Fix the entry point address in x86_self_modifying.py +# $ readelf -h x86_self_modifying.elf | grep Entry +# Entry point address: 0x8048074 + + .intel_syntax noprefix .global _start