[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025-08-27-powered-crazy-arcade-jack-Ajr33h@cyphar.com>
Date: Wed, 27 Aug 2025 23:16:06 +1000
From: Aleksa Sarai <cyphar@...har.com>
To: Alexander Monakov <amonakov@...ras.ru>
Cc: Al Viro <viro@...iv.linux.org.uk>, linux-fsdevel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, linux-kernel@...r.kernel.org
Subject: Re: ETXTBSY window in __fput
On 2025-08-27, Alexander Monakov <amonakov@...ras.ru> wrote:
> > Frankly, in such situation I would spawn a thread for that, did unshare(CLONE_FILES)
> > in it, replaced the binary and buggered off, with parent waiting for it to complete.
>
> Good to know, but it doesn't sound very efficient (and like something that could be
> integrated in Go runtime).
Can't you create a goroutine, runtime.LockOSThread,
unshare(CLONE_FILES), do the work, and then return -- without
runtime.UnlockOSThread (to kill the thread and stop it from being used
by other Go code)? Or does that not work in stdlib?
We have to do this a lot in runc and other Go programs that mess around
with unshare() or other per-thread attributes that don't play well with
Go's process model.
--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/
Download attachment "signature.asc" of type "application/pgp-signature" (266 bytes)
Powered by blists - more mailing lists