From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>
Cc: NeilBrown <neil@brown.name>,
linux-fsdevel@vger.kernel.org, Jann Horn <jannh@google.com>,
Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Xin Zhao <jackzxcui1989@163.com>,
Mateusz Guzik <mjguzik@gmail.com>,
Jeff Layton <jlayton@kernel.org>, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH RFC v4 09/18] fs: make close_cloexec_files() synchronous
Date: Thu, 24 Sep 2026 14:07:27 +0200 [thread overview]
Message-ID: <arUSf7YBK62yUIZX@redhat.com> (raw)
In-Reply-To: <20260910-work-coredump-unlock-self-v4-9-a5c1800dc930@kernel.org>
On 09/10, Christian Brauner wrote:
>
> Punting file closing to task work during exec slows down exec
> significantly when its done with a bunch of file descriptors. We can
> do this in-band instead. Flush already runs synchronous. Jann moved
> close-on-exec in e780259b54e6 ("exec: do_close_on_exec() before taking
> exec_update_lock") outside of exec_update_lock.
>
> The only lock that's still held now is cred_guard_mutex. It's deprecated
> and has five takers
>
> (1) exec
> (2) ptrace_attach()
> (3) seccomp() with SECCOMP_FILTER_FLAG_TSYNC
> (4) writes to /proc/<pid>/attr/*
> (5) lsm_set_self_attr()
>
> Four of them take the task's own cred_guard_mutex. When
> close_cloexec_files() runs, de_thread() ensured that the calling task is
> the only one alive in its thread-group. That leaves ptrace() waiting on
> cred_guard_mutex of the tracee going through exec. exec already sleeps
> under cred_guard_mutex in de_thread() when it reads binary and
> interpreter. So while we add wait-time to an attaching ptracer no new
> lock dependency is added.
Plus ptrace has other issues with cred_guard_mutex, ptrace_attach() may
deadlock ;) So I agree this is not a problem.
I like 1-9 and believe they are correct with the additional fix
[PATCH v3 08/17] exit: hang up the tty before closing the files
https://lore.kernel.org/all/20260921-work-coredump-fixes-v3-8-8e4adb1619e6@kernel.org/
feel free to add
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
next prev parent reply other threads:[~2026-09-24 12:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 15:47 [PATCH RFC v4 00/18] coredump, files: exit files on request Christian Brauner
2026-09-10 15:47 ` [PATCH RFC v4 01/18] fs: don't open-code file_close_fd() in close_fd() Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 02/18] fs: add switch_files_struct() Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 03/18] fs: move unshare_fd() to fs/file.c Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 04/18] fs: remove unshare_files() Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 05/18] fs: add filp_close_sync() Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 06/18] fs: make close_files() synchronous Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 07/18] fs: make close_range() synchronous Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 08/18] fs: rename do_close_on_exec() to close_cloexec_files() Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 09/18] fs: make close_cloexec_files() synchronous Christian Brauner
2026-09-24 12:07 ` Oleg Nesterov [this message]
2026-09-10 15:48 ` [PATCH RFC v4 10/18] coredump: drop core_state->dumper Christian Brauner
2026-09-23 15:27 ` Oleg Nesterov
2026-09-10 15:48 ` [PATCH RFC v4 11/18] sched: add wait_var_event_state() Christian Brauner
2026-09-23 15:28 ` Oleg Nesterov
2026-09-10 15:48 ` [PATCH RFC v4 12/18] coredump: replace the startup completion with a thread count Christian Brauner
2026-09-23 15:28 ` Oleg Nesterov
2026-09-10 15:48 ` [PATCH RFC v4 13/18] coredump: factor out coredump_wait_inactive() Christian Brauner
2026-09-23 15:29 ` Oleg Nesterov
2026-09-10 15:48 ` [PATCH RFC v4 14/18] fs: add alloc_files_struct() Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 15/18] coredump: add COREDUMP_CLOSE_FILES Christian Brauner
2026-09-24 14:47 ` Oleg Nesterov
2026-09-25 16:01 ` Christian Brauner
2026-09-26 11:52 ` Oleg Nesterov
2026-09-10 15:48 ` [PATCH RFC v4 16/18] coredump: cancel io_uring requests before closing files Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 17/18] tools: sync coredump.h header Christian Brauner
2026-09-10 15:48 ` [PATCH RFC v4 18/18] selftests/coredump: test COREDUMP_CLOSE_FILES Christian Brauner
2026-09-10 23:48 ` [PATCH RFC v4 00/18] coredump, files: exit files on request NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arUSf7YBK62yUIZX@redhat.com \
--to=oleg@redhat.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=jackzxcui1989@163.com \
--cc=jannh@google.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=neil@brown.name \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox