mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-11 12:41:00 +01:00
MEDIUM: pools: detect() when munmap() fails in UAF mode
Better check that munmap() always works, otherwise it means we might have miscalculated an address, and if it fails silently, it will eat all the memory extremely quickly. Let's add a BUG_ON() on munmap's return.
This commit is contained in:
parent
0e6a233217
commit
17930edecc
@ -97,7 +97,8 @@ static inline void pool_free_area_uaf(void *area, size_t size)
|
||||
if (pad >= sizeof(void *) && *(void **)(area - sizeof(void *)) != area)
|
||||
ABORT_NOW();
|
||||
|
||||
munmap(area - pad, (size + 4095) & -4096);
|
||||
/* better know immediately if an address calculation was wrong! */
|
||||
BUG_ON(munmap(area - pad, (size + 4095) & -4096) == -1);
|
||||
}
|
||||
|
||||
#endif /* _HAPROXY_POOL_OS_H */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user