Re: [PATCH v2] rust: file: handle fd table teardown in file descriptor APIs
From: Pedro Falcato
Date: Thu Sep 24 2026 - 12:50:49 EST
On Thu, Sep 24, 2026 at 12:06:18PM -0400, Georgios Androutsopoulos wrote:
> On Thu, Sep 24, 2026 at 4:39 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> > This looks like it should ideally be on the C side instead.
>
> I could move the `NULL` checks into the C helpers in `fs/file.c` that
> currently dereference `current->files`. Since this would move the fix
> into the VFS code, would it be okay to send this as v3 of this patch?
FWIW, I don't think this makes sense. The VFS abstractions should ideally
be taught that using any of these functions from ->release() simply isn't
safe.
Adding random branches to rust or C code just to avoid UB sounds like
delaying the inevitable; maybe your kernel doesn't crash (right away?),
but the code is still incorrect and probably cannot correctly handle FD
installation randomly failing, or fdget on a Known Good(tm) fd failing.
--
Pedro