Document assembly instructions for x86_self_modifying

This commit is contained in:
Andrew Dutcher 2016-08-30 14:40:26 -05:00
parent 10519d6864
commit f8ac51bb3d
2 changed files with 17 additions and 0 deletions

View File

@ -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()

View File

@ -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