Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How does this work with heap allocation? When you free memory and then allocate it again and get back the same address range, wouldn't the flag still apply to the new block?


madvise() works at the page level and if you're using madvise(), then you're expected to be using mmap() to allocate pages explicitly. It would be unusual and a bad idea to start madvise()ing memory that's being handled by an allocator (like malloc).

Of course you could also write a security focused heap allocator that uses these madvise() options under the hood.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: