|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../musl/convert-hangs-to-crashes.patch # Copyright (C) 2020 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END ---
diff --git a/src/process/fork.c b/src/process/fork.c
index 7e984ff8..c4fa7510 100644
--- a/src/process/fork.c
+++ b/src/process/fork.c
@@ -30,7 +30,7 @@ pid_t fork(void)
self->next = self->prev = self; __thread_list_lock = 0; libc.threads_minus_1 = 0; - if (libc.need_locks) libc.need_locks = -1;
+ if (libc.need_locks > 0) libc.need_locks = -2;
} __restore_sigs(&set); __fork_handler(!ret); diff --git a/src/thread/__lock.c b/src/thread/__lock.c
index 60eece49..75412cc8 100644
--- a/src/thread/__lock.c
+++ b/src/thread/__lock.c
@@ -24,6 +24,7 @@ void __lock(volatile int *l)
int current = a_cas(l, 0, INT_MIN + 1); if (need_locks < 0) libc.need_locks = 0; if (!current) return; + if (need_locks < -1) a_crash();
/* A first spin loop, for medium congestion. */ for (unsigned i = 0; i < 10; ++i) { if (current < 0) current -= INT_MIN + 1;
|