xpapad
xpapad

Reputation: 4456

Huge size output in /proc/smaps

I'm looking at /proc//smaps for a program compiled with libasan (-fsanitize=address). I see some massive sizes and I'm trying to understand what it means. For example:

2008fff7000-10007fff8000 rw-p 00000000 00:00 0 
Size:           15032123396 kB
Rss:              142592 kB
Pss:              142592 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:    142592 kB
Referenced:       142592 kB
Anonymous:        142592 kB
AnonHugePages:         0 kB
Shared_Hugetlb:        0 kB
Private_Hugetlb:       0 kB
Swap:                  0 kB
SwapPss:               0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
VmFlags: rd wr mr mw me nr dd nh 

Total size adds up to 21,475,147,836K

I'm using Amazon Linux AMI release 2018.03 with kernel 4.4.19-29.55.amzn1.x86_64

Any ideas?

Upvotes: 0

Views: 402

Answers (1)

that other guy
that other guy

Reputation: 123510

ASAN works by reserving one byte (known as a shadow byte) per 8 bytes of user memory. The shadow bytes are checked on every memory access and updated on every change in allocation status.

Processes running on Linux on x86_64 have about 2^47 bytes of addressable space available, so ASAN maps around 2^47*1/9 ~= 15TB for these shadow bytes.

This is the mapping you're seeing.

Upvotes: 2

Related Questions