Segfault on the i386 enter instruction
Hi.
Quoted 1 line · Andi Kleen
Handling it like you expect would require to disassemble the function in the page fault handler and it's probably not worth doing that for this weird case.
Just wondering, is this case really that weird?
In fact, the check against %esp that the kernel does, looks strange. I realize that it can catch a (very rare) user-space bug of accessing below %esp, but other than that it looks redundant (IMHO) and as soon as it triggers the false-positives, what is it really good for? Aren't the rlimit and the other checks of acct_stack_growth() not enough, or am I missing something obvious?
Quoted 2 lines
Aren't the rlimit and the other checks of
acct_stack_growth()not enough, or am I missing something obvious?
Traditionally Linux doesn't have a stack ulimit.
-Andi
Hi.
Quoted 3 lines · Andi Kleen
Quoted 2 lines
Aren't the rlimit and the other checks of
acct_stack_growth()not enough, or am I missing something obvious?Traditionally Linux doesn't have a stack ulimit.
That clarifies the roots of this %esp check, as without the stack ulimit and without the proper memory accounting (the case of 2.4?) such a check is the "last hope" - I've got the point. But are there the reasons to still keep it in 2.6, considering also the false-positives? It seems to have the STACK_RLIMIT and it seems to get the memory accounting right, and not too many arches seem to have such a check even.
Quoted 5 lines · Stas Sergeev
Hi.
Quoted 2 lines · Andi Kleen
Quoted 2 lines
Aren't the rlimit and the other checks of
acct_stack_growth()not enough, or am I missing something obvious?
Quoted 8 lines
Quoted 1 line
Traditionally Linux doesn't have a stack ulimit.
That clarifies the roots of this %esp check, as without the stack ulimit and without the proper memory accounting (the case of 2.4?) such a check is the "last hope" - I've got the point. But are there the reasons to still keep it in 2.6, considering also the false-positives? It seems to have the
STACK_RLIMITand it seems to get the memory accounting right, and not too many arches seem to have such a check even.
Linux doesn't have a STACK_RLIMIT by default no.
It is set by a few distributions (for use with flexmmap) in PAM, but not by all. The kernel defaults don't have it.
-Andi
Hello.
Quoted 1 line · Andi Kleen
Linux doesn't have a
STACK_RLIMITby default no.
By default - OK, I thought you mean that it doesn't have the STACK_RLIMIT at all (doesn't implement it).
Quoted 2 lines
It is set by a few distributions (for use with flexmmap) in PAM, but not by all. The kernel defaults don't have it.
That might explain why I get
$ ulimit -s 8192 on fedora core. Thanks for explanations.
Quoted 7 lines · Stas Sergeev
Quoted 2 lines
It is set by a few distributions (for use with flexmmap) in PAM, but not by all. The kernel defaults don't have it.
That might explain why I get
$ ulimit -s 8192 on fedora core. Thanks for explanations.
Just FYI, this does actually have an important effect on multithreaded programs - glibc will allocate RLIMIT_STACK for each thread stack. If mlockall() is used this can eat quite a bit of memory. It's a real world problem for some pro audio apps.
Lee
Hi Lee,
Quoted 4 lines · Lee Revell
Just FYI, this does actually have an important effect on multithreaded programs - glibc will allocate
RLIMIT_STACKfor each thread stack. Ifmlockall()is used this can eat quite a bit of memory. It's a real world problem for some pro audio apps.
If it is: pthread_attr_setstacksize() is your friend. If you like to use the big hammer: just lower RLIMIT_STACK.
So no unsolvable real world problem here :-)
Regards
Ingo Oeser
Quoted 8 lines · Ingo Oeser
Hi Lee,
Quoted 4 lines · Lee Revell
Just FYI, this does actually have an important effect on multithreaded programs - glibc will allocate
RLIMIT_STACKfor each thread stack. Ifmlockall()is used this can eat quite a bit of memory. It's a real world problem for some pro audio apps.
Quoted 5 lines
If it is:
pthread_attr_setstacksize()is your friend. If you like to use the big hammer: just lowerRLIMIT_STACK.So no unsolvable real world problem here :-)
Yep, that's exactly what we do in JACK. POSIX makes it quite explicit that one should not assume the default thread stack size is sane...
Lee