From: "Gary Guo" <gary@garyguo.net>
To: "Alice Ryhl" <aliceryhl@google.com>, <gregkh@linuxfoundation.org>
Cc: <Liam.Howlett@oracle.com>, <akpm@linux-foundation.org>,
<broonie@kernel.org>, <dakr@kernel.org>, <jannh@google.com>,
<linux-mm@kvack.org>, <lkp@intel.com>, <llvm@lists.linux.dev>,
<miguel.ojeda.sandonis@gmail.com>, <nathan@kernel.org>,
<oe-kbuild-all@lists.linux.dev>, <ojeda@kernel.org>,
<rppt@kernel.org>, <rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH] rust_binder: use AssertSync for BINDER_VM_OPS
Date: Sat, 14 Mar 2026 13:37:31 +0000 [thread overview]
Message-ID: <DH2JO2PZ0XR4.1GM9108DVQGOL@garyguo.net> (raw)
In-Reply-To: <20260314111951.4139029-1-aliceryhl@google.com>
On Sat Mar 14, 2026 at 11:19 AM GMT, Alice Ryhl wrote:
> When declaring an immutable global variable in Rust, the compiler checks
> that it looks thread safe, because it is generally safe to access said
> global variable. When using C bindings types for these globals, we don't
> really want this check, because it is conservative and assumes pointers
> are not thread safe.
>
> In the case of BINDER_VM_OPS, this is a challenge when combined with the
> patch 'userfaultfd: introduce vm_uffd_ops' [1], which introduces a
> pointer field to vm_operations_struct. It previously only held function
> pointers, which are considered thread safe.
>
> Rust Binder should not be assuming that vm_operations_struct contains no
> pointer fields, so to fix this, use AssertSync (which Rust Binder has
> already declared for another similar global of type struct
> file_operations with the same problem). This ensures that even if
> another commit adds a pointer field to vm_operations_struct, this does
> not cause problems.
>
> Fixes: 8ef2c15aeae0 ("rust_binder: check ownership before using vma")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202603121235.tpnRxFKO-lkp@intel.com/
> Link: https://lore.kernel.org/r/20260306171815.3160826-8-rppt@kernel.org [1]
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> drivers/android/binder/page_range.rs | 8 +++++---
> drivers/android/binder/rust_binder_main.rs | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
next prev parent reply other threads:[~2026-03-14 13:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 4:21 [linux-next:master 5585/5731] error[E0277]: `*const kernel::bindings::vm_uffd_ops` cannot be shared between threads safely kernel test robot
2026-03-13 21:36 ` Nathan Chancellor
2026-03-13 22:39 ` Miguel Ojeda
2026-03-14 11:12 ` Greg Kroah-Hartman
2026-03-14 11:15 ` Alice Ryhl
2026-03-14 11:19 ` [PATCH] rust_binder: use AssertSync for BINDER_VM_OPS Alice Ryhl
2026-03-14 13:37 ` Gary Guo [this message]
2026-03-14 11:30 ` [linux-next:master 5585/5731] error[E0277]: `*const kernel::bindings::vm_uffd_ops` cannot be shared between threads safely Alice Ryhl
2026-03-14 11:53 ` Greg Kroah-Hartman
2026-03-14 11:58 ` Alice Ryhl
2026-03-31 11:32 ` Alice Ryhl
2026-03-31 12:59 ` Greg Kroah-Hartman
2026-03-31 13:04 ` Alice Ryhl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DH2JO2PZ0XR4.1GM9108DVQGOL@garyguo.net \
--to=gary@garyguo.net \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=nathan@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rppt@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox