mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] rust_binder: Update bitmaps to use kernel::impl_flags!
@ 2026-07-16 13:02 Jahnavi MN via B4 Relay
  2026-07-16 13:02 ` [PATCH 1/3] rust_binder: Update defer_work " Jahnavi MN via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jahnavi MN via B4 Relay @ 2026-07-16 13:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Christian Brauner, Carlos Llamas, Alice Ryhl, Benno Lossin,
	Gary Guo
  Cc: linux-kernel, rust-for-linux, Jahnavi MN

In the current Rust Binder driver, internal state variables (thread
looper states, deferred work, and transaction configurations) are
represented as raw integers and manipulated using manual bitwise
operations.

This approach lacks type safety. Because the compiler treats all
integers identically, it is possible to pass a thread looper flag
into a function expecting a transaction flag without triggering
compile-time warnings. These cross-contamination errors compile
cleanly but can cause runtime bugs or undefined behavior.

This patch series resolves this issue by migrating these raw integer
bitmaps (`defer_work`, `looper_flags`, `flags`) to strongly-typed
bitmasks using the `kernel::impl_flags!` macro. Functions now accept
specific, distinct types rather than generic integers, preventing
flags from being mixed up. This transition also replaces manual
bitwise arithmetic with readable, safe methods.

Based on top of:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git

Signed-off-by: Jahnavi MN <jahnavimn@google.com>
---
Jahnavi MN (3):
      rust_binder: Update defer_work bitmaps to use kernel::impl_flags!
      rust_binder: Update looper_flags bitmaps to use kernel::impl_flags!
      rust_binder: Update transaction flags to use kernel::impl_flags!

 drivers/android/binder/process.rs     | 34 +++++++++++------
 drivers/android/binder/thread.rs      | 69 +++++++++++++++++++++--------------
 drivers/android/binder/transaction.rs | 56 +++++++++++++++++++++-------
 3 files changed, 105 insertions(+), 54 deletions(-)
---
base-commit: 775553d19b163446c38c5ff24dd0a01065376932
change-id: 20260715-b4-rust_binder_impl_flags-e53b4ebca85d

Best regards,
-- 
Jahnavi MN <jahnavimn@google.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-17 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-16 13:02 [PATCH 0/3] rust_binder: Update bitmaps to use kernel::impl_flags! Jahnavi MN via B4 Relay
2026-07-16 13:02 ` [PATCH 1/3] rust_binder: Update defer_work " Jahnavi MN via B4 Relay
2026-07-17 13:22   ` Greg Kroah-Hartman
2026-07-16 13:02 ` [PATCH 2/3] rust_binder: Update looper_flags " Jahnavi MN via B4 Relay
2026-07-16 13:02 ` [PATCH 3/3] rust_binder: Update transaction flags " Jahnavi MN via B4 Relay
2026-07-17  6:49 ` [PATCH 0/3] rust_binder: Update bitmaps " Alice Ryhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox