kern.elf64.aslr.honor_sbrk what is it good for?

sbrk(2)

In the old times, before there was virtual memory, a program would just get a contiguous chunk of memory from the host. It is then the responsibility of the program to state how much of this chunk it wants to use for data. I think the remainder was then used for the stack, growing downwards.
Nowadays we have virtual memory management, but the old syscalls are still available and do something. And maybe some really old code wants to use them.
 
PMc I don't think sbrk(2) predates virtual memory. Well, maybe it does, I'm not entirely sure, but it doesn't matter too much, because it certainly was the only foundation for malloc(3) and friends before mmap(2) took over.

The "problem" with sbrk(2) is that its interface is SO simple (just move the end of the data segment in the, uhm, virtual address space by a given number of bytes), it's just not versatile enough and leads to inefficiencies.

Alain De Vos I can only guess here, maybe the ASLR implementation wants to randomize *every* mapped page, which wouldn't play nice with sbrk(2). This shouldn't be a concert for most software though, as nowadays, mmap(2) is used to request memory from the OS.
 
PMc I don't think sbrk(2) predates virtual memory. Well, maybe it does, I'm not entirely sure, but it doesn't matter too much, because it certainly was the only foundation for malloc(3) and friends before mmap(2) took over.
zirias@ You're right, this is a malloc() story, not so much a vmm story.

Alain De Vos I can only guess here, maybe the ASLR implementation wants to randomize *every* mapped page, which wouldn't play nice with sbrk(2). This shouldn't be a concert for most software though, as nowadays, mmap(2) is used to request memory from the OS.
Yes, it shouldn't be used anymore - but there may always be surprises similar to this one:
Releng intended to make ASLR the default and throw that rather silently over the fence with 13.2. Seems it was left to me to figure out that not everything would just work with that setting.
 
Back
Top