Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <al5V4Ww6bI24tlnh@dev-dsk-darnshah-1c-a4c7d5e9.eu-west-1.amazon.com>
Date: Mon, 20 Jul 2026 18:06:45 +0000
From: Darshit Shah <darnshah@...zon.de>
To: <musl@...ts.openwall.com>
Subject: [RFC] clone() interaction with seccomp filters and signal handlers

[ Not subscribed to list, please keep me in Cc when responding. ]

Hi,

I'm having some issues with musl 1.2.6 and would like to solicit ideas / recommendations on how to either change our
usage pattern / fixup musl to work with it.

The context is this: I am building an application linked with musl that installs both, 1. a seccomp filter and 2.
A signal handler for the filtered syscall. This normally works without an issue. However, starting with musl 1.2.5 
fa4a8abd06a ("fix public clone function to be safe and usable by applications"), the clone() wrapper now blocks all
signals before actually invoking the underlying syscall. I understand the intent behind it. But this breaks our workflow
where we have a seccomp filter, configured with SECCOMP_RET_TRAP, to block calls to clone() and a signal handler that
catches the resulting SIGSYS and handles the blocking gracefully.

On a filtered clone() the kernel raises a SIGSYS synchronously on the calling thread. Because the wrapper has masked all
signals at that point, the signal is blocked when the kernel tries to deliver it. This is a forced/synchronous signal,
so the kernel doesn't just queue it and move on: force_sig_info() unblocks SIGSYS and resets its handler to SIG_DFL
to guarantee the thread can't ignore a synchronous fault. The net effect is that our handler is silently torn down and
the SIGSYS is delievered directly to the thread, killing it.

What paths forward do we have here? We would like to be able to continue installing a signal handler to handle seccomp
filters. The direct proposal that comes to mind is that clone() should not mask SIGSYS. But that creates an edge case in
how clone() is implemented in musl and is not a neat solution. Any ideas on how this can be resolved neatly?

Regards,
Darshit Shah

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.