[CRIU] [PATCH v2 02/24] exec: Simplify unshare_files
Eric W. Biederman
ebiederm at xmission.com
Mon Nov 23 23:54:37 MSK 2020
Linus Torvalds <torvalds at linux-foundation.org> writes:
> On Mon, Nov 23, 2020 at 9:52 AM Oleg Nesterov <oleg at redhat.com> wrote:
>>
>> Can anyone explain why does do_coredump() need unshare_files() at all?
>
> Hmm. It goes back to 2012, and it's placed just before calling
> "->core_dump()", so I assume some core dumping function messed with
> the file table back when..
I don't see that in the code from back then. Until 2009 binfmt_elf did
install a file descriptor in the file descriptor table e7b9b550f53e
("Don't mess with descriptor table in load_elf_binary()"). But that was
gone for 3 years by the time the wrapper was added
> I can't see anything like that currently.
>
> The alternative is that core-dumping just keeps the file table around
> for a long while, and thus files don't actually close in a timely
> manner. So it might not be a "correctness" issue as much as a latency
> issue.
That doesn't work out. Unsharing the file descriptor table would
increase the latency because it guarantees that the file descritpors
have a reference until the core dump is finished. While continuing to
share the file descriptor table would allow the file descriptors to be
closed.
Continue to look but I don't see a reason for that unshare.
Eric
More information about the CRIU
mailing list