overflow.c · both builds
lines 2 to 6 of 10
2
__attribute__
(
(
noinline
)
)
static
void
fill
(
void
)
{
3
char
buf
[
16
]
;
4
for
(
int
i
=
0
;
i
<
32
;
i
+
+
)
buf
[
i
]
=
'
A
'
;
5
}
6
asan
disassembly
plain · fill
4011
44
4
mov
[rbp - 0x14]
, 0
4011
4b
cmp
[rbp - 0x14]
, 0x20
4011
4f
jge
401165
4011
51
movsxd
rax, [rbp - 0x14]
4011
55
mov
[rbp + rax - 0x10]
, 0x41
7fffffffece0
0x41
65
4011
5a
mov
eax, [rbp - 0x14]
4011
5d
add
eax, 1
4011
60
mov
[rbp - 0x14], eax
4011
63
jmp
40114b
plain · registers
the line's registers, and rip
rax
0x10
16
rbp
7fffffffece0
7fffffffed41
rsp
7fffffffece0
rip
401155
fill+21
plain · stack
fill's frame as bytes, eight a row
7fffffffec
b0
00
00
00
00
00
00
00
00
7fffffffec
b8
00
00
00
00
00
00
00
00
7fffffffec
c0
00
00
00
00
00
00
00
00
7fffffffec
c8
10
00
00
00
i
16
00
00
00
00
7fffffffec
d0
41
41
41
41
41
41
41
41
buf[0..7]
"AAAAAAAA"
7fffffffec
d8
41
41
41
41
41
41
41
41
buf[8..15]
"AAAAAAAA"
rbp rsp
7fffffffec
e0
41
ed
ff
ff
ff
7f
00
00
saved rbp
7fffffffed41
7fffffffec
e8
34
11
40
00
00
00
00
00
return
401134
main+20
7fffffffec
f0
00
00
00
00
00
00
00
00
7fffffffec
f8
00
00
00
00
00
00
00
00
fill
disassembly
asan · fill
523d
26
4
mov
rax, [rbx + 0x18]
523d
2a
movsxd
rcx, [rbx + 0x64]
523d
2e
add
rax, rcx
523d
31
mov
[rbx], rax
523d
34
shr
rax, 3
rax
0xf7ffeb1e006
523d
38
mov
al, [rax + 0x7fff8000]
f807eb16006
0xf3
243
523d
3e
mov
[rbx + 0xf], al
523d
41
cmp
al, 0
f3
:
0
zf
523d
43
je
523d5b
not taken
asan · registers
the line's registers, and rip
rax
0xf7ffeb1e006
rbx
7fffffffec20
7bfff58f0030
rcx
0x10
16
rip
523d38
fill+216
asan · fake frame
its shadow at addr >> 3 + 7fff8000 · then the real stack's way back
f1
7bfff58f00
00
b3
8a
b5
41
00
00
00
00
magic
f1
7bfff58f00
08
a7
87
53
00
00
00
00
00
descr
5387a7
"1 32 16 5 b…
f1
7bfff58f00
10
60
3c
52
00
00
00
00
00
pc
523c60
fill
f1
7bfff58f00
18
10
ec
ff
ff
ff
7f
00
00
real stack
7fffffffec10
00
7bfff58f00
20
41
41
41
41
41
41
41
41
buf[0..7]
"AAAAAAAA"
00
7bfff58f00
28
41
41
41
41
41
41
41
41
buf[8..15]
"AAAAAAAA"
f3
7bfff58f00
30
00
00
00
00
00
00
00
00
redzone
f3
7bfff58f00
38
00
80
8e
f5
ff
7b
00
00
redzone
rbp
7fffffffecc0
e0
ec
ff
ff
ff
7f
00
00
saved rbp
7fffffffece0
7fffffffecc8
54
3c
52
00
00
00
00
00
return
523c54
main+20
fill
i 16 · moments 164 / 770
i = 16, one past buf: plain writes 41, an 'A', into the saved rbp.
ASan reads the shadow first: f3, a redzone. It does not store.