Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Unified Diff: src/native_client/src/trusted/service_runtime/posix/nacl_signal.c

Issue 3857001: Work around sigaltstack() bug on Mac OS X when unregistering a signal stack (Closed)
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/native_client/src/trusted/service_runtime/posix/nacl_signal.c
diff --git a/src/native_client/src/trusted/service_runtime/posix/nacl_signal.c b/src/native_client/src/trusted/service_runtime/posix/nacl_signal.c
index 691329d336dfcd719e9d81b8fdcfffee38158498..2e68d5d7c741cbe51917d43188fbf74f7e5ea69b 100644
--- a/src/native_client/src/trusted/service_runtime/posix/nacl_signal.c
+++ b/src/native_client/src/trusted/service_runtime/posix/nacl_signal.c
@@ -146,7 +146,18 @@ void NaClSignalStackUnregister(void) {
* fault, although that is unlikely.
*/
stack_t st;
+#if NACL_OSX
+ /*
+ * This is a workaround for a bug in Mac OS X's libc, in which new
+ * versions of the sigaltstack() wrapper return ENOMEM if ss_size is
+ * less than MINSIGSTKSZ, even when ss_size should be ignored
+ * because we are unregistering the signal stack.
+ * See http://code.google.com/p/nativeclient/issues/detail?id=1053
+ */
+ st.ss_size = MINSIGSTKSZ;
+#else
st.ss_size = 0;
+#endif
st.ss_sp = NULL;
st.ss_flags = SS_DISABLE;
if (sigaltstack(&st, NULL) != 0) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698