Re: [PATCH v4] coredump: Add /proc/<pid>/coredump_pre_exit for pre-exit before dumping
From: Al Viro
Date: Thu Jun 25 2026 - 12:56:14 EST
On Thu, Jun 25, 2026 at 04:50:18PM +0800, Xin Zhao wrote:
> > [Severity: Medium]
> > Similar to the issue in exit_mmap_mapped_shared(), this non-atomic update
> > of file->f_flags risks losing concurrent fcntl() updates since it doesn't
> > hold file->f_lock.
> >
> > Also, if a file has duplicated file descriptors (e.g., via dup()), will
> > clearing O_TMPCLOS here prematurely skip the closure of the remaining
> > descriptors? When encountering the duplicated descriptor later, the flag
> > will already be cleared, leaving the shared file actively referenced.
>
> Currently, this flag will only be used by the logic we added, so I believe
> there won't be any issues.
What makes you (or whatever LLM you happen to use) think that file is referenced
only by descriptor table of the coredumping process? Or that only one coredumping
process exists at any time, for that matter - and each might hold references to
the same struct file.