* [PATCH] rust_binder: use compat_ptr_ioctl
@ 2025-10-30 10:41 Alice Ryhl
2025-10-30 12:38 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Alice Ryhl @ 2025-10-30 10:41 UTC (permalink / raw)
To: Greg Kroah-Hartman, Carlos Llamas
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, Suren Baghdasaryan,
linux-kernel, rust-for-linux, Alice Ryhl
This is commit 1832f2d8ff69 ("compat_ioctl: move more drivers to
compat_ptr_ioctl") but for Rust Binder.
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
drivers/android/binder/process.rs | 9 ---------
drivers/android/binder/rust_binder_main.rs | 22 +++-------------------
2 files changed, 3 insertions(+), 28 deletions(-)
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index f13a747e784c84a0fb09cbf47442712106eba07c..7df144d07b20d238a127299cd208f6280ba1bb7a 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -1599,15 +1599,6 @@ pub(crate) fn ioctl(this: ArcBorrow<'_, Process>, file: &File, cmd: u32, arg: us
}
}
- pub(crate) fn compat_ioctl(
- this: ArcBorrow<'_, Process>,
- file: &File,
- cmd: u32,
- arg: usize,
- ) -> Result {
- Self::ioctl(this, file, cmd, arg)
- }
-
pub(crate) fn mmap(
this: ArcBorrow<'_, Process>,
_file: &File,
diff --git a/drivers/android/binder/rust_binder_main.rs b/drivers/android/binder/rust_binder_main.rs
index 6773b7c273ec9634057300954d67b51ca9b54f6f..c79a9e7422401fd50078c1902774573b8ba0076c 100644
--- a/drivers/android/binder/rust_binder_main.rs
+++ b/drivers/android/binder/rust_binder_main.rs
@@ -313,8 +313,8 @@ unsafe impl<T> Sync for AssertSync<T> {}
let ops = kernel::bindings::file_operations {
owner: THIS_MODULE.as_ptr(),
poll: Some(rust_binder_poll),
- unlocked_ioctl: Some(rust_binder_unlocked_ioctl),
- compat_ioctl: Some(rust_binder_compat_ioctl),
+ unlocked_ioctl: Some(rust_binder_ioctl),
+ compat_ioctl: Some(bindings::compat_ptr_ioctl),
mmap: Some(rust_binder_mmap),
open: Some(rust_binder_open),
release: Some(rust_binder_release),
@@ -402,23 +402,7 @@ unsafe impl<T> Sync for AssertSync<T> {}
/// # Safety
/// Only called by binderfs.
-unsafe extern "C" fn rust_binder_compat_ioctl(
- file: *mut bindings::file,
- cmd: kernel::ffi::c_uint,
- arg: kernel::ffi::c_ulong,
-) -> kernel::ffi::c_long {
- // SAFETY: We previously set `private_data` in `rust_binder_open`.
- let f = unsafe { Arc::<Process>::borrow((*file).private_data) };
- // SAFETY: The caller ensures that the file is valid.
- match Process::compat_ioctl(f, unsafe { File::from_raw_file(file) }, cmd as _, arg as _) {
- Ok(()) => 0,
- Err(err) => err.to_errno() as isize,
- }
-}
-
-/// # Safety
-/// Only called by binderfs.
-unsafe extern "C" fn rust_binder_unlocked_ioctl(
+unsafe extern "C" fn rust_binder_ioctl(
file: *mut bindings::file,
cmd: kernel::ffi::c_uint,
arg: kernel::ffi::c_ulong,
---
base-commit: 211ddde0823f1442e4ad052a2f30f050145ccada
change-id: 20251030-binder-compatptrioctl-ecc9e2131edb
Best regards,
--
Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rust_binder: use compat_ptr_ioctl
2025-10-30 10:41 [PATCH] rust_binder: use compat_ptr_ioctl Alice Ryhl
@ 2025-10-30 12:38 ` Greg Kroah-Hartman
2025-10-30 13:25 ` Alice Ryhl
0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2025-10-30 12:38 UTC (permalink / raw)
To: Alice Ryhl
Cc: Carlos Llamas, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Suren Baghdasaryan, linux-kernel, rust-for-linux
On Thu, Oct 30, 2025 at 10:41:04AM +0000, Alice Ryhl wrote:
> This is commit 1832f2d8ff69 ("compat_ioctl: move more drivers to
> compat_ptr_ioctl") but for Rust Binder.
You might want to spell out why this is happening, not just refer to
another commit to try to find that information to make it more clear
here as to how to attempt to review this :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rust_binder: use compat_ptr_ioctl
2025-10-30 12:38 ` Greg Kroah-Hartman
@ 2025-10-30 13:25 ` Alice Ryhl
2025-10-30 15:06 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Alice Ryhl @ 2025-10-30 13:25 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Carlos Llamas, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Suren Baghdasaryan, linux-kernel, rust-for-linux
On Thu, Oct 30, 2025 at 01:38:56PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Oct 30, 2025 at 10:41:04AM +0000, Alice Ryhl wrote:
> > This is commit 1832f2d8ff69 ("compat_ioctl: move more drivers to
> > compat_ptr_ioctl") but for Rust Binder.
>
> You might want to spell out why this is happening, not just refer to
> another commit to try to find that information to make it more clear
> here as to how to attempt to review this :)
I can replace the commit message with:
Binder always treats the ioctl argument as a pointer. In this scenario,
the idiomatic way to implement compat_ioctl is to use compat_ptr_ioctl.
Thus update Rust Binder to do that.
Alice
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rust_binder: use compat_ptr_ioctl
2025-10-30 13:25 ` Alice Ryhl
@ 2025-10-30 15:06 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2025-10-30 15:06 UTC (permalink / raw)
To: Alice Ryhl
Cc: Carlos Llamas, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Suren Baghdasaryan, linux-kernel, rust-for-linux
On Thu, Oct 30, 2025 at 01:25:19PM +0000, Alice Ryhl wrote:
> On Thu, Oct 30, 2025 at 01:38:56PM +0100, Greg Kroah-Hartman wrote:
> > On Thu, Oct 30, 2025 at 10:41:04AM +0000, Alice Ryhl wrote:
> > > This is commit 1832f2d8ff69 ("compat_ioctl: move more drivers to
> > > compat_ptr_ioctl") but for Rust Binder.
> >
> > You might want to spell out why this is happening, not just refer to
> > another commit to try to find that information to make it more clear
> > here as to how to attempt to review this :)
>
> I can replace the commit message with:
>
> Binder always treats the ioctl argument as a pointer. In this scenario,
> the idiomatic way to implement compat_ioctl is to use compat_ptr_ioctl.
> Thus update Rust Binder to do that.
Sounds good to me!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-30 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 10:41 [PATCH] rust_binder: use compat_ptr_ioctl Alice Ryhl
2025-10-30 12:38 ` Greg Kroah-Hartman
2025-10-30 13:25 ` Alice Ryhl
2025-10-30 15:06 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).