feat(poc): body builders with golden parity vs reference generators
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import struct
|
||||
import sys
|
||||
from collections import Counter
|
||||
|
||||
buf = open(sys.argv[1], "rb").read()
|
||||
print("len", len(buf))
|
||||
|
||||
counts = Counter()
|
||||
for off in range(0, len(buf) - 7, 8):
|
||||
q = struct.unpack_from("<Q", buf, off)[0]
|
||||
if 0x1000000000 <= q <= 0x7FFFFFFFFFFF:
|
||||
counts[q] += 1
|
||||
|
||||
print("canonical user-space qwords:", sum(counts.values()), "distinct:", len(counts))
|
||||
print("top 12:")
|
||||
for q, c in counts.most_common(12):
|
||||
print(" %#018x x%d" % (q, c))
|
||||
|
||||
buckets = Counter()
|
||||
for q, c in counts.items():
|
||||
buckets[q & ~0x1FFFFF] += c
|
||||
print("2MiB buckets:")
|
||||
for b, c in buckets.most_common(10):
|
||||
print(" %#018x x%d" % (b, c))
|
||||
|
||||
top_q, top_c = counts.most_common(1)[0]
|
||||
for name, off in (("zval_ptr_dtor", 0x65EB60), ("zif_system", 0x465370)):
|
||||
print("if top==%s -> libphp=%#x" % (name, (top_q - off) & 0xFFFFFFFFFFFFFFFF))
|
||||
Reference in New Issue
Block a user