ANDROID: rust_binder: don't use default implementations

Our Rust compiler currently generates incorrect CFI tags when using
dynamic calls to default implementations. So stop using default
implementations in traits until that it is fixed.

Bug: 335105888
Change-Id: I128f4b991a76714ab0f961f0484f74821851fe40
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
Alice Ryhl 2024-04-16 07:56:04 +00:00
parent bee37573f9
commit 741b6ae073
3 changed files with 20 additions and 17 deletions

View File

@ -482,6 +482,9 @@ impl DeliverToRead for Node {
Ok(true)
}
fn cancel(self: DArc<Self>) {}
fn on_thread_selected(&self, _thread: &Thread) {}
fn should_sync_wakeup(&self) -> bool {
false
}
@ -840,6 +843,9 @@ impl DeliverToRead for NodeDeath {
Ok(cmd != BR_DEAD_BINDER)
}
fn cancel(self: DArc<Self>) {}
fn on_thread_selected(&self, _thread: &Thread) {}
fn should_sync_wakeup(&self) -> bool {
false
}

View File

@ -64,11 +64,11 @@ trait DeliverToRead: ListArcSafe + Send + Sync {
/// Cancels the given work item. This is called instead of [`DeliverToRead::do_work`] when work
/// won't be delivered.
fn cancel(self: DArc<Self>) {}
fn cancel(self: DArc<Self>);
/// Called when a work item is delivered directly to a specific thread, rather than to the
/// process work list.
fn on_thread_selected(&self, _thread: &thread::Thread) {}
fn on_thread_selected(&self, _thread: &thread::Thread);
/// Should we use `wake_up_interruptible_sync` or `wake_up_interruptible` when scheduling this
/// work item?
@ -76,11 +76,6 @@ trait DeliverToRead: ListArcSafe + Send + Sync {
/// Generally only set to true for non-oneway transactions.
fn should_sync_wakeup(&self) -> bool;
/// Get the debug name of this type.
fn debug_name(&self) -> &'static str {
core::any::type_name::<Self>()
}
fn debug_print(&self, m: &mut SeqFile, prefix: &str, transaction_prefix: &str) -> Result<()>;
}
@ -176,6 +171,9 @@ impl DeliverToRead for DeliverCode {
Ok(true)
}
fn cancel(self: DArc<Self>) {}
fn on_thread_selected(&self, _thread: &thread::Thread) {}
fn should_sync_wakeup(&self) -> bool {
false
}

View File

@ -1475,17 +1475,13 @@ impl Thread {
let initial_len = writer.len();
while writer.len() >= size_of::<bindings::binder_transaction_data_secctx>() + 4 {
match getter(self, wait && initial_len == writer.len()) {
Ok(Some(work)) => {
let work_ty = work.debug_name();
match work.into_arc().do_work(self, &mut writer) {
Ok(true) => {}
Ok(false) => break,
Err(err) => {
pr_warn!("Failure inside do_work of type {}.", work_ty);
return Err(err);
}
Ok(Some(work)) => match work.into_arc().do_work(self, &mut writer) {
Ok(true) => {}
Ok(false) => break,
Err(err) => {
return Err(err);
}
}
},
Ok(None) => {
break;
}
@ -1634,6 +1630,9 @@ impl DeliverToRead for ThreadError {
Ok(true)
}
fn cancel(self: DArc<Self>) {}
fn on_thread_selected(&self, _thread: &Thread) {}
fn should_sync_wakeup(&self) -> bool {
false
}