Skip to content

Can't access user address #370

@hao-lee

Description

@hao-lee

Here is a vma extracted from the smaps file. It is evident that this particular VMA contains 1942012kB of anonymous memory.

700000000-8003b7000 rw-p 00000000 00:00 0
Size:            4198108 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:             1942012 kB
Pss:             1942012 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:   1942012 kB
Referenced:      1942012 kB
Anonymous:       1942012 kB
LazyFree:              0 kB
AnonHugePages:         0 kB
ShmemPmdMapped:        0 kB
Shared_Hugetlb:        0 kB
Private_Hugetlb:       0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
ProtectionKey:         0
VmFlags: rd wr mr mw me ac sd

Now, using drgn 0.0.24, we can scan each address within this VMA and count the number of addresses that can be successfully accessed.

task = find_task(prog, 2023533)
addr = 0x700000000
count = 0
while addr < 0x8003b7000:
	try:
		data = access_process_vm(task, addr, 4096)
		count += 1
	except:
		#print(hex(addr))
		pass
	addr += 4096

print(count)
print(count * 4096 / 1024/1024)

The result indicates a count of 20436, and the total accessible size is 79.828125MB, which is significantly smaller than the actual size.

I don't know how to solve this...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions