microzig icon indicating copy to clipboard operation
microzig copied to clipboard

Packages and stack

Open vesim987 opened this issue 2 years ago • 3 comments

vesim987 avatar Feb 15 '22 09:02 vesim987

This degrades the initial UX because it looks like you have to manually set the stack size. Is there any reason to distinguish between stack and heap anyways since we have allocators in userspace?

mattnite avatar Feb 15 '22 16:02 mattnite

This degrades the initial UX because it looks like you have to manually set the stack size. Is there any reason to distinguish between stack and heap anyways since we have allocators in userspace?

This actually increases long-term UX as you will now easily find stack overflows by triggering "SIGBUS" on most devices instead of silently corrupting the heap. Imho, this is an important security and safety feature

ikskuh avatar Feb 15 '22 16:02 ikskuh

I understand the value but the defaults are wrong. If someone just uses the default, as soon as they use more than 1024 bytes of the stack they'll just have a runtime crash which will be especially difficult to debug if they are new.

Instead the default value for the stack size config should be null, so that people who know what they're doing can opt-in. Otherwise the full ram section is used for the stack.

mattnite avatar Feb 15 '22 17:02 mattnite