[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#8201) Enhancement: thread stack overrun detection

Full_Name: Howard Chu
Version: HEAD
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (
Submitted by: hyc

Have been looking at some puzzling SEGVs where none of the addresses in the core
dump backtrace appear to be invalid. Suspecting a thread stack overrun.

Normally pthreads allocates a 1-page guard at the end of the requested thread
stack. (This is a page of memory mprotect'd to deny any access, so spilling into
it should cause a SEGV.) It's possible for some overruns to skip over this guard
page, e.g. if they occur in a function that has a local variable larger than 1
page in size.

Adding a feature to set the guard region size to be equal to the original thread
stack size. (E.g., 8MB on 64 bit builds.) This should help catch the more
elusive overrun cases. The feature will be enabled by setting the LDAPSTACKGUARD
environment variable (to anything, the value is ignored).