From: Carlos Llamas <cmllamas@google.com>
To: "Tiffany Y. Yang" <ynaffit@google.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Martijn Coenen" <maco@android.com>,
"Joel Fernandes" <joel@joelfernandes.org>,
"Christian Brauner" <brauner@kernel.org>,
"Suren Baghdasaryan" <surenb@google.com>,
linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH v2] binder: use buffer offsets in debug logs
Date: Mon, 24 Mar 2025 18:48:10 +0000 [thread overview]
Message-ID: <Z-Go6qOLxT0ZfxyD@google.com> (raw)
In-Reply-To: <20250324180716.1012478-3-ynaffit@google.com>
On Mon, Mar 24, 2025 at 06:07:18PM +0000, Tiffany Y. Yang wrote:
> Identify buffer addresses using vma offsets instead of full user
> addresses in debug logs.
>
> Signed-off-by: Tiffany Y. Yang <ynaffit@google.com>
> ---
> drivers/android/binder.c | 31 ++++++++++++++++---------------
> 1 file changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index d1aa6d24450a..994ae205aa07 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -3261,20 +3261,20 @@ static void binder_transaction(struct binder_proc *proc,
>
> if (reply)
> binder_debug(BINDER_DEBUG_TRANSACTION,
> - "%d:%d BC_REPLY %d -> %d:%d, data %016llx-%016llx size %lld-%lld-%lld\n",
> + "%d:%d BC_REPLY %d -> %d:%d, buffer offset %lx-%lx size %lld-%lld-%lld\n",
> proc->pid, thread->pid, t->debug_id,
> target_proc->pid, target_thread->pid,
> - (u64)tr->data.ptr.buffer,
> - (u64)tr->data.ptr.offsets,
> + (unsigned long)tr->data.ptr.buffer - proc->alloc.buffer,
> + (unsigned long)tr->data.ptr.offsets - proc->alloc.buffer,
These could be pointers to anywhere in user memory, not necessarily the
alloc->buffer. So there will be cases where this substraction doesn't
make sense. However, you are correct that we shouldn't log these addrs
so maybe just don't? wdyt?
> (u64)tr->data_size, (u64)tr->offsets_size,
> (u64)extra_buffers_size);
> else
> binder_debug(BINDER_DEBUG_TRANSACTION,
> - "%d:%d BC_TRANSACTION %d -> %d - node %d, data %016llx-%016llx size %lld-%lld-%lld\n",
> + "%d:%d BC_TRANSACTION %d -> %d - node %d, buffer offset %lx-%lx size %lld-%lld-%lld\n",
> proc->pid, thread->pid, t->debug_id,
> target_proc->pid, target_node->debug_id,
> - (u64)tr->data.ptr.buffer,
> - (u64)tr->data.ptr.offsets,
> + (unsigned long)tr->data.ptr.buffer - proc->alloc.buffer,
> + (unsigned long)tr->data.ptr.offsets - proc->alloc.buffer,
same here.
Regards,
--
Carlos Llamas
next prev parent reply other threads:[~2025-03-24 18:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 18:07 [PATCH v2] binder: use buffer offsets in debug logs Tiffany Y. Yang
2025-03-24 18:23 ` Greg Kroah-Hartman
2025-03-24 18:48 ` Carlos Llamas [this message]
2025-03-25 0:41 ` Tiffany Y. Yang
2025-03-25 20:45 ` Carlos Llamas
2025-03-27 21:11 ` Tiffany Y. Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z-Go6qOLxT0ZfxyD@google.com \
--to=cmllamas@google.com \
--cc=arve@android.com \
--cc=brauner@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=joel@joelfernandes.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=surenb@google.com \
--cc=tkjos@android.com \
--cc=ynaffit@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.