Repository navigation
rust: file: handle fd table teardown in file descriptor APIs - #2646
Closed
vfsci-bot[bot] wants to merge 1 commit into
Closed
vfsci-bot[bot] wants to merge 1 commit into
vfsci-bot[bot] wants to merge 1 commit into
Conversation
Several Rust file descriptor APIs rely on `current->files` being available. However, `exit_files()` clears it while execution may still continue on the same task. This affects `LocalFile::fget()` and the `FileDescriptorReservation` operations that call `get_unused_fd_flags()`, `fd_install()`, and `put_unused_fd()`. `FileDescriptorReservation` cannot cross task boundaries, but remaining on the same task does not guarantee that `current->files` is still available when these operations are performed. Guard the affected operations against a missing `current->files`. `LocalFile::fget()` returns `EBADF` and `FileDescriptorReservation::get_unused_fd_flags()` returns `EMFILE`. For the infallible `fd_install()` and drop paths, warn once and avoid calling the corresponding C helper when the fd table is already gone. This prevents NULL dereferences through these safe Rust APIs after `exit_files()`. Fixes: 8518498 ("rust: file: add Rust abstraction for `struct file`") Fixes: 5da9857 ("rust: file: add `FileDescriptorReservation`") Closes: Rust-for-Linux/linux#1256 Signed-off-by: Georgios Androutsopoulos <georgeandrout13@gmail.com>
Author
|
Superseded by series 1171773 (v2). Closing automatically. Automated by ml2pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Series: https://patchwork.kernel.org/project/linux-fsdevel/list/?series=1169889
Submitter: Georgios Androutsopoulos
Version: 1
Patches: 1/1
Message-ID:
<20260920200154.1194983-1-georgeandrout13@gmail.com>Base: vfs.base.ci
Lore: https://lore.kernel.org/linux-fsdevel/20260920200154.1194983-1-georgeandrout13@gmail.com
Automated by ml2pr