heap.c
lines 14 to 23 of 31
14
head
=
n
;
15
}
16
17
void
pop
(
void
)
{
18
node
*
n
=
head
;
19
head
=
n
-
>
next
;
20
free
(
n
)
;
21
}
22
23
int
main
(
void
)
{
disassembly
pop
4011
9b
19
mov
rax, [rbp - 8]
4011
9f
mov
rax, [rax + 8]
4011
a3
mov
[rip + 0x2e7e], rax
head
4011
aa
20
mov
rax, [rbp - 8]
4011
ae
mov
rdi, rax
4011
b1
call
401030
free@plt
free
in libc, stepped over
4011
b6
21
nop
rdi
405050
0x405
1029
4011
b7
leave
4011
b8
ret
registers
stack
heap
code
data
rwx
read-only
rax
0
rbx
0
rcx
0x405
rdx
0xf
rsi
0xe2263c1be1246b56
rdi
405050
0x405
1029
rbp
7fffffffecf0
7fffffffed00
7fffffffedb0
7fffffffee10
0
rsp
7fffffffece0
0
r8
405070
0x10001000100f
r9
0x20
32
r10
0x21
r11
7ffff7e19ac8
r12
7fffffffee38
7fffffffefea
"./heap"
r13
1
r14
7ffff7ffd000
7ffff7ffe3c0
0
r15
403df0
401110
__do_global_dtors_aux
rip
4011b6
pop+46
cf
PF
af
zf
sf
IF
df
of
stack
six words from rsp · the frames they belong to
rsp
+0
7fffffffe
ce0
0
+8
n
7fffffffe
ce8
405050
0x405
1029
rbp
+10
saved rbp
7fffffffe
cf0
7fffffffed00
+18
7fffffffe
cf8
4011e0
main+39
+20
saved rbp
7fffffffe
d00
7fffffffedb0
+28
7fffffffe
d08
7ffff7c27781
libc+27781
pop
main
the chunks of 0x20
the program's list · malloc's free list
the program's
405030
405010
12
7
tcache 0x20
1
405050
key
top
0x20ca0
405360
head
head
rdi
its bytes
the heap, 405000 to 40506f
4050
00
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
0x20
a
m
P
4050
10
07
00
00
00
00
00
00
00
7
00
00
00
00
00
00
00
00
NULL
4050
20
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
0x20
a
m
P
4050
30
0c
00
00
00
00
00
00
00
12
10
50
40
00
00
00
00
00
405010
4050
40
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
0x20
a
m
P
4050
50
05
04
00
00
00
00
00
00
NULL
^ 405
53
89
03
0a
cf
c5
9f
6b
key
4050
60
00
00
00
00
00
00
00
00
01
03
00
00
00
00
00
00
0x300
a
m
P
tcache
tcache
→
405070
tcache_perthread_struct · 0x2f8 bytes
405
070
0f
00
15
slots left · 1 in the bin
10
00
10
00
10
00
10
00
10
00
10
00
10
00
8 rows
405
100
10
00
10
00
10
00
10
00
50
50
40
00
00
00
00
00
405050
405
110
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
37 rows
moment 7 of 12
free gave 9's chunk to the tcache, malloc's bin for 0x20. Its first
word is the link now: 405, which is NULL, safe-linked.