Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash with musl c-library due to stack overflow in processes.c #652

Closed
fabled opened this issue Jun 20, 2014 · 0 comments
Closed

crash with musl c-library due to stack overflow in processes.c #652

fabled opened this issue Jun 20, 2014 · 0 comments
Labels
Bug A genuine bug

Comments

@fabled
Copy link

fabled commented Jun 20, 2014

In musl, ARG_MAX is defined as 131072 which seems to match linux kernel's definition of ARG_MAX.

processes.c in few places allocates "char cmdline[ARG_MAX];" buffers, and the default stack size of musl is about 80 kB, so the program crashes.

Allocating 100kB+ in stack sounds like a bad idea anyway. Perhaps use 4096 buffers always (as this is assumed if ARG_MAX is not defined). Alternatively, you could create the thread for processes.c with pthread_attr asking for sufficiently large stack.

@mfournier mfournier added the Bug label Jul 24, 2014
octo added a commit that referenced this issue Sep 8, 2014
ARG_MAX is quite big on many systems, for example >100 kByte on
GNU/Linux. This is a problem for systems with tight memory constraints,
for example embedded devices.

This patch uses at most 4 kByte for this, which out to be enough for the
vast majority of users. Users with specific requirements can compile
with "CMDLINE_BUFFER_SIZE=${LOTS}" in their CPPFLAGS to override this
default.

Fixes: #652
@octo octo closed this as completed Sep 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A genuine bug
Projects
None yet
Development

No branches or pull requests

3 participants