binder: add flag to clear buffer on txn complete
PATCH 1/1 binder: add flag to clear buffer on txn complete
Add a per-transaction flag to indicate that the buffer must be cleared when the transaction is complete to prevent copies of sensitive data from being preserved in memory.
--- drivers/android/binder.c | 1 + drivers/android/binder_alloc.c | 48 +++++++++++++++++++++++++++++ drivers/android/binder_alloc.h | 4 ++- include/uapi/linux/android/binder.h | 1 + 4 files changed, 53 insertions(+), 1 deletion(-)
drivers/android/binder.c +1 -0
@@ -3146,6 +3146,7 @@ static void binder_transaction(struct binder_proc *proc, t->buffer->debug_id = t->debug_id; t->buffer->transaction = t; t->buffer->target_node = target_node; + t->buffer->clear_on_free = !!(t->flags &TF_CLEAR_BUF );trace_binder_transaction_alloc_buf (t->buffer); if (binder_alloc_copy_user_to_buffer(
drivers/android/binder_alloc.c +48 -0
72 lines not on this page · raw message
drivers/android/binder_alloc.h +3 -1
@@ -23,6 +23,7 @@ struct binder_transaction;* @entry: entry alloc->buffers * @rb_node: node for allocated_buffers/free_buffers rb trees * @free: %true if buffer is free +* @clear_on_free: %true if buffer must be zeroed after use * @allow_user_free: %true if user is allowed to free buffer * @async_transaction: %true if buffer is in use for an async txn * @debug_id: unique ID for debugging
@@ -41,9 +42,10 @@ struct binder_buffer {struct rb_node rb_node;/* free entry by size or allocated entry */ /* by address */ unsigned free:1; + unsigned clear_on_free:1; unsigned allow_user_free:1; unsigned async_transaction:1; - unsigned debug_id:29; + unsigned debug_id:28;struct binder_transaction *transaction;
include/uapi/linux/android/binder.h +1 -0
@@ -248,6 +248,7 @@ enum transaction_flags {TF_ROOT_OBJECT =0x04 ,/* contents are the component's root object */ TF_STATUS_CODE =0x08 ,/* contents are a 32-bit status code */ TF_ACCEPT_FDS =0x10 ,/* allow replies with file descriptors */ + TF_CLEAR_BUF = 0x20, /* clear buffer on txn complete */ }; struct binder_transaction_data {
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
Greg KH
maintainerQuoted 7 lines · Todd Kjos
Add a per-transaction flag to indicate that the buffer must be cleared when the transaction is complete to prevent copies of sensitive data from being preserved in memory.
Signed-off-by Todd Kjos <[email protected]>---
DOes this need to be backported to stable kernels as well?
thanks,
greg k-h
Quoted 11 lines · Greg KH
Quoted 7 lines · Todd Kjos
Add a per-transaction flag to indicate that the buffer must be cleared when the transaction is complete to prevent copies of sensitive data from being preserved in memory.
Signed-off-by Todd Kjos <[email protected]>---
DOes this need to be backported to stable kernels as well?
It doesn't technically qualify for stable since it is a new feature -- not a bug fix. We will want it for Android S launch devices (5.4+), so it would be handy to have it in 5.4.y and later.
Quoted 8 lines
thanks,
greg k-h
--
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].