node/lib/metasm/samples/dbg-plugins/heapscan/heapscan.rb
# scan chunks from a mmap base addr
# big chunks are allocated on anonymous-mmap areas
# for mmap chunks, pv_sz=0 pv_inuse=0, mmap=1, data starts at 8, mmapsz = userlen+12 [roundup 4096]
# one entry in /proc/pid/maps may point to multiple consecutive mmap chunks
# scans for a mmap chunk header, returns the chunk size if pattern match or nil
scan chunks from a mmap base addr
big chunks are allocated on anonymous-mmap areas
for mmap chunks, pv_sz=0 pv_inuse=0, mmap=1, data starts at 8, mmapsz = userlen+12 [roundup 4096]
one entry in /proc/pid/maps may point to multiple consecutive mmap chunks
scans for a mmap chunk header, returns the chunk size if pattern match or nil
scan chunks from a mmap base addr big chunks are allocated on anonymous - mmap areas for mmap chunks pv_sz = 0 pv_inuse = 0 mmap = 1 data starts at 8 mmapsz = userlen + 12 [ roundup 4096 ] one entry in / proc / pid / maps may point to multiple consecutive mmap chunks scans for a mmap chunk header returns the chunk size if pattern match or nil
def scan_mmap(base, len)
		foo = chunkdata(base)
		clen = foo[1] & ~0xfff
		if foo[0] == 0 and foo[1] & 0xfff == 2 and clen > 0 and clen <= len
			@chunks[base + foo.length] = clen-4*@ptsz
			@mmapchunks << (base + foo.length)
			clen
		end
	end
def scan_mmap ( base , len ) foo = chunkdata ( base ) clen = foo [ 1 ] & ~ 0xfff if foo [ 0 ] == 0 and foo [ 1 ] & 0xfff == 2 and clen > 0 and clen <= len @chunks [ base + foo . length ] = clen - 4 * @ptsz @mmapchunks << ( base + foo . length ) clen end end
scan chunks from a mmap base addr
big chunks are allocated on anonymous-mmap areas
for mmap chunks, pv_sz=0 pv_inuse=0, mmap=1, data starts at 8, mmapsz = userlen+12 [roundup 4096]
one entry in /proc/pid/maps may point to multiple consecutive mmap chunks
scans for a mmap chunk header, returns the chunk size if pattern match or nil
scan chunks from a mmap base addr big chunks are allocated on anonymous - mmap areas for mmap chunks pv_sz = 0 pv_inuse = 0 mmap = 1 data starts at 8 mmapsz = userlen + 12 [ roundup 4096 ] one entry in / proc / pid / maps may point to multiple consecutive mmap chunks scans for a mmap chunk header returns the chunk size if pattern match or nil
base
len