diff options
| author | Alice Ryhl <[email protected]> | 2025-04-08 09:22:39 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-05-12 00:48:24 +0000 |
| commit | 040f404b731207935ed644b14bcc2bb8b8488d00 (patch) | |
| tree | 91b8f2cb11c3107f290b8bb874399916d78b597f /rust/helpers | |
| parent | mm: rust: add abstraction for struct mm_struct (diff) | |
| download | kernel-040f404b731207935ed644b14bcc2bb8b8488d00.tar.gz kernel-040f404b731207935ed644b14bcc2bb8b8488d00.zip | |
mm: rust: add vm_area_struct methods that require read access
This adds a type called VmaRef which is used when referencing a vma that
you have read access to. Here, read access means that you hold either the
mmap read lock or the vma read lock (or stronger).
Additionally, a vma_lookup method is added to the mmap read guard, which
enables you to obtain a &VmaRef in safe Rust code.
This patch only provides a way to lock the mmap read lock, but a follow-up
patch also provides a way to just lock the vma read lock.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Alice Ryhl <[email protected]>
Acked-by: Lorenzo Stoakes <[email protected]>
Acked-by: Liam R. Howlett <[email protected]>
Reviewed-by: Jann Horn <[email protected]>
Reviewed-by: Andreas Hindborg <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Cc: Alex Gaynor <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Balbir Singh <[email protected]>
Cc: Benno Lossin <[email protected]>
Cc: Björn Roy Baron <[email protected]>
Cc: Boqun Feng <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: John Hubbard <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Miguel Ojeda <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Trevor Gross <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'rust/helpers')
| -rw-r--r-- | rust/helpers/mm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/helpers/mm.c b/rust/helpers/mm.c index 7201747a5d31..7b72eb065a3e 100644 --- a/rust/helpers/mm.c +++ b/rust/helpers/mm.c @@ -37,3 +37,9 @@ void rust_helper_mmap_read_unlock(struct mm_struct *mm) { mmap_read_unlock(mm); } + +struct vm_area_struct *rust_helper_vma_lookup(struct mm_struct *mm, + unsigned long addr) +{ + return vma_lookup(mm, addr); +} |
