rust_binder: report EINVAL for unknown handles
Subsystems (3)
Alice Ryhl
maintainerPATCH 1/1 rust_binder: report EINVAL for unknown handles
Currently unknown handles are reported as ENOENT, which userspace doesn't treat as a fatal error. However, providing the wrong handle is a fatal API violation, and indicates UAF in the userspace process.
Thus, change it to EINVAL to match C Binder and make userspace treat it as a fatal error.
--- drivers/android/binder/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder/process.rs +1 -1
@@ -958,7 +958,7 @@ pub(crate) fn get_node_from_handle(&self, handle: u32, strong: bool) -> Result<N .lock() .by_handle .get_mut (&handle) - .ok_or (ENOENT )? + .ok_or (EINVAL )? .node_ref () .clone (strong) }
---
base-commit: 917fcbf033154a6c8d83cfa6c88f012b71eb37b2
change-id: 20261029-binder-unknown-einval-10407d1ebb1e
Best regards,
Signature · 1 line
Alice Ryhl <[email protected]>
Quoted 32 lines · Alice Ryhl
Currently unknown handles are reported as ENOENT, which userspace doesn't treat as a fatal error. However, providing the wrong handle is a fatal API violation, and indicates UAF in the userspace process.
Thus, change it to EINVAL to match C Binder and make userspace treat it as a fatal error.
Fixes eafedbc7c050 ("rust_binder: add Rust Binder driver")Signed-off-by Alice Ryhl <[email protected]>--- drivers/android/binder/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/android/binder/process.rs +1
-2@@ -958,7 +958,7 @@ pub(crate) fn get_node_from_handle(&self, handle: u32, strong: bool) -> Result<N .lock() .by_handle .get_mut (&handle) - .ok_or (ENOENT )? + .ok_or (EINVAL )? .node_ref () .clone (strong) } ---base-commit:
917fcbf033154a6c8d83cfa6c88f012b71eb37b2
change-id: 20261029-binder-unknown-einval-10407d1ebb1e
Quoted 4 lines
Best regards,
Signature · 1 line
Alice Ryhl <[email protected]>
LGTM,