mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 14:37:50 +00:00
libc: add message for corrupted allocation on 'free'
In case the meta data (or more) got zeroed upon 'free', print error message. The offset in the meta data can never be zero. This does not help on other memory corruptions, but at least gives a hint in the too much zeroed out case. issue #4675
This commit is contained in:
parent
4c98be54eb
commit
40f31a9050
@ -221,6 +221,10 @@ class Libc::Malloc
|
|||||||
|
|
||||||
void *alloc_addr = (void *)((addr_t)ptr - md->offset);
|
void *alloc_addr = (void *)((addr_t)ptr - md->offset);
|
||||||
|
|
||||||
|
if (md->offset == 0)
|
||||||
|
error("libc free: meta-data offset is 0 for address: ", ptr,
|
||||||
|
" - corrupted allocation");
|
||||||
|
|
||||||
if (msb > SLAB_STOP) {
|
if (msb > SLAB_STOP) {
|
||||||
_backing_store.free(alloc_addr, real_size);
|
_backing_store.free(alloc_addr, real_size);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user