patch "binder: add flag to clear buffer on txn complete" added to char-misc-next
Subsystems (2)
This is a note to let you know that I've just added the patch titled
binder: add flag to clear buffer on txn complete
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-next branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will also be merged in the next major kernel release during the merge window.
If you have any questions about this process, please let me know.
From 0f966cba95c78029f491b433ea95ff38f414a761 Mon Sep 17 00:00:00 2001
From: Todd Kjos <[email protected]>
Date: Fri, 20 Nov 2020 15:37:43 -0800
Subject: 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
@@ -2756,6 +2756,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