Stack frames larger than 4K should be rejected, but what if I want more

Steven Schveighoffer schveiguy at gmail.com
Mon Jun 28 14:01:50 UTC 2021


On 6/28/21 9:09 AM, IGotD- wrote:
> On Monday, 28 June 2021 at 12:41:20 UTC, Steven Schveighoffer wrote:
>>
>> Could this be fixed by not allowing *uninitialized* stack segments 
>> larger than 4k? Basically, if you can't create a stack which contains 
>> a contiguous 4k of uninitialized space, then you can't skip over the 
>> guard page.
>>
>> void-initialized data is pretty rare in D.
>>
> 
> Why? When you decide not to initialize you also surpass the safety 
> benefits of initialized values.

The point is to ensure the guard page is triggered. This is not about 
the safety of initialized values. It's about making sure the stack 
pointer stays sane. I don't know about you, but I don't want to start 
having to worry about stack pointer correctness, even in system code.

This would be like saying null pointer dereferences only trigger a 
segfault in safe code, so now all system code that doesn't want to 
corrupt some mmapped data at the null page must first check that a 
pointer is not null before using. It's nonsense.

-Steve


More information about the Digitalmars-d mailing list