summaryrefslogtreecommitdiff
path: root/libbb/xfuncs_printf.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2025-10-08 14:49:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2025-10-08 14:49:26 +0200
commit3621595939e43a831d66f6b757d4f410029bff95 (patch)
treecb2ee155787618ce12a4a029c31ae3987a885439 /libbb/xfuncs_printf.c
parenta0017a5b5038b3f803ece9140099410c8d4ed4b1 (diff)
nsenter,unshare: don't use xvfork_parent_waits_and_exits(), it SEGVs on ppc64le
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/xfuncs_printf.c')
-rw-r--r--libbb/xfuncs_printf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 842d10cd2..d413c81e8 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -696,6 +696,14 @@ pid_t FAST_FUNC xfork(void)
}
#endif
+#if 0
+/* DO NOT DO THIS. This can't be a function.
+ * It works on some arches (x86) but fails on others (ppc64le: SEGV).
+ * The reason is: the child returns from this function
+ * and likely pops up the stack in an arch-dependent way.
+ * When child eventually exits or execs, parent "reappear"
+ * in the now-unwound stack (!) and the behavior is undefined.
+ */
void FAST_FUNC xvfork_parent_waits_and_exits(void)
{
pid_t pid;
@@ -711,6 +719,7 @@ void FAST_FUNC xvfork_parent_waits_and_exits(void)
}
/* Child continues */
}
+#endif
// Useful when we do know that pid is valid, and we just want to wait
// for it to exit. Not existing pid is fatal. waitpid() status is not returned.