summaryrefslogtreecommitdiff
path: root/design/mock/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'design/mock/context.py')
-rw-r--r--design/mock/context.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/design/mock/context.py b/design/mock/context.py
index efae74c..a040109 100644
--- a/design/mock/context.py
+++ b/design/mock/context.py
@@ -1403,7 +1403,7 @@ def frame_sqlite(name, late):
# 2 (in the stub), 4 (at libc's `syscall`), 5 (after it) and 6 (back in main).
HELLO = open(__file__.replace("design/mock/context.py", "anim/tools/hello.c")).read().split("\n")
R_ = VELLUM # read-only data: the string, and the GOT once relro has sealed it
-HM = [(0x40117a, 4, "sub", "rsp, 0x40"), (0x40117e, 4, "mov", "rax, qword ptr fs:[0x28]"),
+HM = [(0x401176, 4, "push", "rbp"), (0x401177, 4, "mov", "rbp, rsp"), (0x40117a, 4, "sub", "rsp, 0x40"), (0x40117e, 4, "mov", "rax, qword ptr fs:[0x28]"),
(0x401187, 4, "mov", "qword ptr [rbp - 8], rax"), (0x40118b, 4, "xor", "eax, eax"),
(0x40118d, 6, "lea", "rax, [rip + 0xe70]"), (0x401194, 6, "mov", "esi, 0"), (0x401199, 6, "mov", "rdi, rax"),
(0x40119c, 6, "mov", "eax, 0"), (0x4011a1, 6, "call", (0x401070, "open@plt")),
@@ -1443,7 +1443,7 @@ def frame_descent(name):
call_c = ("runs", [("open", BRIGHT), ('("note", O_RDONLY)', VELLUM)])
instants = [
("1", "at the call", "moment 1", None, "main",
- [("main", None, main_rows(0, 17, {0x401194: "trail2", 0x401199: "trail1", 0x40119c: "trail0", 0x4011a1: "cur"},
+ [("main", None, main_rows(0x40117a, 17, {0x401194: "trail2", 0x401199: "trail1", 0x40119c: "trail0", 0x4011a1: "cur"},
{0x401194: ("set", "rsi", [], ("int", 0)),
0x401199: ("set", "rdi", [(0x402004, R_)], ("str", "note")),
0x40119c: ("set", "rax", [], ("int", 0)),
@@ -1452,13 +1452,15 @@ def frame_descent(name):
["main calls open by its stub in the PLT. The arguments",
'are in rdi and rsi: "note" and O_RDONLY.']),
("2", "in the stub", "moment 2", "main waits at line 6 · the pc is in the PLT", "open@plt · the PLT",
- [("main", None, main_rows(0x401187, 13, {0x401199: "trail2", 0x40119c: "trail1", 0x4011a1: "wait"},
+ # main keeps one row after its call and gives the rest above it: the stub's head is under its return row
+ [("main", None, main_rows(0x401176, 12, {0x401199: "trail2", 0x40119c: "trail1", 0x4011a1: "wait"},
{0x4011a1: call_c})),
("open@plt", "the PLT · its jmp reads open@got, 403fd8",
[(0x401070, None, "jmp", [("qword ptr [rip + 0x2f62]", P)], "cur",
("runs", [("", "arrow"), (0x7ffff7d10ec0, CODE), (" open", VELLUM)])),
(0x401076, None, "push", [("4", P)], None, ("text", "lazy binding: unused", FAINT)),
- (0x40107b, None, "jmp", [(0x401020, CODE)], None, None)])],
+ (0x40107b, None, "jmp", [(0x401020, CODE)], None, None),
+ (0x401080, None, "endbr64", [], "other_first", ("text", "_start", DIM))])],
["The call pushed main+48 and went down: main's window keeps",
"its call, ringed; the stub's opens under it, and its jmp reads the GOT."]),
("3", "the crossing", "moments 4 and 5", "main waits at line 6 · the pc is in libc's open",
@@ -1482,7 +1484,7 @@ def frame_descent(name):
["libc's open is a wrapper: it puts openat's number in rax",
"and its arguments in rdi, rsi, rdx, r10; syscall crosses down."]),
("4", "back up", "moment 6", None, "main",
- [("main", None, main_rows(0, 17, {0x401199: "trail2", 0x40119c: "trail1", 0x4011a1: "trail0", 0x4011a6: "cur"},
+ [("main", None, main_rows(0x40117a, 17, {0x401199: "trail2", 0x40119c: "trail1", 0x4011a1: "trail0", 0x4011a6: "cur"},
{0x4011a1: ("runs", [("open", VELLUM), ('("note", O_RDONLY) = ', DIM), ("3", VELLUM)]),
0x4011a6: ("chain", [(0x7fffffffecc8, S_)], ("int", 0), None)}))],
["open's ret came straight back to main+48: the stub was a jump,",