Hey all,
Not quite sure this is the best place for this, but I thought some here may have ideas/experience with this:
I'm trying to "gracefully" deal with stack overflows, by having signal handler (with its own small stack) test against the siginfo_t's si_code on SIGSEGV. On OS X/clang I get a SEGV_ACCERR, as the main thread gets a (i.e. one) guard page below the stack.
To my surprise though, I couldn't find a way to achieve the same on Linux (and gcc 5.4). I can't think of any other approach, and I don't want to "artificially" spawn another thread with such a guard page in place to address the issue.
All my experiments with trying to mmap (PROT_NONE, MAP_FIXED) such a page myself didn't succeeded either.
Has anyone ever dealt with such a case?
Thanks!
Alex