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

MINSIGSTKSZ is no longer a constant #3299

Open
workingjubilee opened this issue Jul 10, 2023 · 0 comments
Open

MINSIGSTKSZ is no longer a constant #3299

workingjubilee opened this issue Jul 10, 2023 · 0 comments
Labels
C-bug Category: bug

Comments

@workingjubilee
Copy link
Contributor

workingjubilee commented Jul 10, 2023

Same with SIGSTKSZ.

This starts with a more philosophical problem: glibc 2.34 defines these macros as expanding to an expression that resolves as a dynamic, non-constant value. This addresses the fact that, from glibc's perspective, and indeed for any libc that wants to support a vast array of architectures, they are non-constant values. See:

https://sourceware.org/glibc/wiki/Release/2.34#Non-constant_MINSIGSTKSZ_and_SIGSTKSZ

The reason is that MINSIGSTKSZ can either be so huge that it effectively rules out some hardware that currently can run glibc-based programs, or it can be non-constant. As glibc chose the latter route, it might be useful to contrast with a libc that chose the former route, Darwin:

#define MINSIGSTKSZ     32768   /* (32K)minimum allowable stack */
#define SIGSTKSZ        131072  /* (128K)recommended stack size */

However, the previous constant can be useful in actual programs if taken as somewhere close to a "floor", e.g. see:

The more practical issue that spawns out of this: if this value is incorrect, it can easily lead to data corruption. Huge amounts of hardware state may potentially need to be managed by a signal handler, and clobbering user data is unacceptable.

@workingjubilee workingjubilee added the C-bug Category: bug label Jul 10, 2023
@workingjubilee workingjubilee changed the title ` MINSIGSTKSZ is no longer a constant Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

1 participant