glagolig / heapwatch Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 2-Clause "Simplified" License
License: BSD 2-Clause "Simplified" License
Program terminated with signal SIGSEGV, Segmentation fault.
194 entry = entriesByDataHash[stackHash];
(gdb) bt
#0 0xb778225d in ReferenceStack () at StackStorage.c:194
#1 0xb778179d in malloc (size=size@entry=352) at Preload.c:218
#2 0xb75e985c in __fopen_internal (filename=filename@entry=0xb77561a7 "/proc/filesystems", mode=mode@entry=0xb7756018 "r", is32=is32@entry=0) at iofopen.c:73
#3 0xb75ebe5b in _IO_fopen64 (filename=0xb77561a7 "/proc/filesystems", mode=0xb7756018 "r") at iofopen64.c:39
#4 0xb774a9b2 in selinuxfs_exists () from /lib/i386-linux-gnu/libselinux.so.1
#5 0xb77428c3 in ?? () from /lib/i386-linux-gnu/libselinux.so.1
#6 0xb7799d77 in call_init (l=, argc=argc@entry=2, argv=argv@entry=0xbffd84d4, env=env@entry=0xbffd84e0) at dl-init.c:78
#7 0xb7799e64 in call_init (env=0xbffd84e0, argv=0xbffd84d4, argc=2, l=) at dl-init.c:36
#8 _dl_init (main_map=0xb77ac938, argc=2, argv=0xbffd84d4, env=0xbffd84e0) at dl-init.c:126
#9 0xb778c10f in _dl_start_user () from /lib/ld-linux.so.2
(gdb) p stackHash
$1 = 4294919899
in a different run, in HashFn:
result = -2552111681634388
STORAGE_SIZE = 1299721
result % STORAGE_SIZE = -539301
(unsigned long)(result % STORAGE_SIZE) = 4294427995
Looks like, for negative values of result in HashFn, values larger than STORAGE_SIZE are possible when the signed values are cast to unsigned.
I was seeing a crash because RealMalloc hadn't been assigned because the Init() constructor wasn't called.
LD_PRELOAD=./heapwatch_32.so ls
Segmentation fault (core dumped)
#0 0x00000000 in ?? ()
#1 0xb7737792 in malloc (size=size@entry=352) at Preload.c:216
#2 0xb759f85c in __fopen_internal (filename=filename@entry=0xb770c1a7 "/proc/filesystems", mode=mode@entry=0xb770c018 "r", is32=is32@entry=0) at iofopen.c:73
#3 0xb75a1e5b in _IO_fopen64 (filename=0xb770c1a7 "/proc/filesystems", mode=0xb770c018 "r") at iofopen64.c:39
#4 0xb77009b2 in selinuxfs_exists () from /lib/i386-linux-gnu/libselinux.so.1
#5 0xb76f88c3 in ?? () from /lib/i386-linux-gnu/libselinux.so.1
#6 0xb774fd77 in call_init (l=, argc=argc@entry=2, argv=argv@entry=0xbffbbd14, env=env@entry=0xbffbbd20) at dl-init.c:78
#7 0xb774fe64 in call_init (env=0xbffbbd20, argv=0xbffbbd14, argc=2, l=) at dl-init.c:36
#8 _dl_init (main_map=0xb7762938, argc=2, argv=0xbffbbd14, env=0xbffbbd20) at dl-init.c:126
#9 0xb774210f in _dl_start_user () from /lib/ld-linux.so.2
Instead of using the attribute((constructor)), I changed Init() to be called on first use of malloc. Obviously, this doesn't help if malloc isn't the first function called (i.e., calloc, valloc, posix_memalign are called before Init() is called)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.