From: Carlos Llamas <cmllamas@google.com>
To: Li Li <dualli@chromium.org>
Cc: "Cc:" <dualli@google.com>,
corbet@lwn.net, davem@davemloft.net, edumazet@google.com,
"Jakub Kicinski" <kuba@kernel.org>,
pabeni@redhat.com, donald.hunter@gmail.com,
"Greg KH" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
tkjos@android.com, maco@android.com,
"Joel Fernandes (Google)" <joel@joelfernandes.org>,
brauner@kernel.org, "Suren Baghdasaryan" <surenb@google.com>,
omosnace@redhat.com, shuah@kernel.org, arnd@arndb.de,
masahiroy@kernel.org, "Bagas Sanjaya" <bagasdotme@gmail.com>,
"Simon Horman" <horms@kernel.org>,
tweek@google.com, LKML <linux-kernel@vger.kernel.org>,
linux-doc@vger.kernel.org, netdev@vger.kernel.org,
selinux@vger.kernel.org, "Hridya Valsaraju" <hridya@google.com>,
smoreland@google.com, ynaffit@google.com,
"Android Kernel Team" <kernel-team@android.com>
Subject: Re: Fwd: [PATCH v16 2/3] binder: report txn errors via generic netlink
Date: Wed, 12 Mar 2025 20:14:09 +0000 [thread overview]
Message-ID: <Z9HrEdbI5JYu0pwS@google.com> (raw)
In-Reply-To: <CANBPYPg5i5PhqV0-1foaKwNOaoKNoit6-cLUAqNu=2S0AUp==w@mail.gmail.com>
On Wed, Mar 12, 2025 at 11:49:02AM -0700, Li Li wrote:
> > > + mutex_lock(&binder_procs_lock);
> > > + hlist_for_each_entry(proc, &binder_procs, proc_node) {
> > > + if (proc->pid == pid)
> > > + break;
> >
> > Wait... can't there be multiple binder_proc instances matching the same
> > pid? I know that binder_proc is a bit of a misnomer but what should you
> > do in such case? Shouldn't you set the flags in _all_ matching pids?
> >
> > Furthermore, there could be a single task talking on multiple contexts,
> > so you could be returning the 'proc' that doesn't match the context that
> > you are looking for right?
> >
>
> You're right. I should update this logic to search the process within a
> certain binder_context only.
Also, note the comment about multiple 'struct binder_proc' matching the
same desired pid.
> > > +static void binder_netlink_report(struct binder_context *context, u32 err,
> > > + u32 pid, u32 tid, u32 to_pid, u32 to_tid,
> >
> > Instead of all these parameters, is there a way to pass the transaction
> > itself? Isn't this info already populated there? I think it even holds
> > the info you are looking for from the 'binder_transaction_data' below.
> >
>
> The binder_transaction_data doesn't include all of pid, tid, to_pid and to_tid.
I'm not referring to binder_transaction_data, I mean 'struct
binder_transaction'. I _think_ this should have all you need?
> > > + ret = genlmsg_multicast(&binder_nl_family, skb, 0, BINDER_NLGRP_REPORT, GFP_KERNEL);
> >
> > Thanks for switching to multicast. On this topic, we can only have a
> > single global configuration at a time correct? e.g. context vs per-proc.
> > So all listeners would ahve to work with the same setup?
> >
>
> We only have a single global configuration, which can include both
> context and proc setup.
> Yes, all listeners work with the same setup as we have only one
> multicast group defined.
> The user space code can demux it by checking the context field of the
> netlink messages.
Ack. I understand the demux solution. I was wondering if we'll need to
OR the different configurations (per-proc and flags) from each listener
in that case.
> > > +TRACE_EVENT(binder_netlink_report,
> > > + TP_PROTO(const char *name, u32 err, u32 pid, u32 tid, u32 to_pid,
> > > + u32 to_tid, u32 reply, struct binder_transaction_data *tr),
> >
> > Similarly here I think you could get away with passing 'struct
> > binder_transaction' instead of all the individual fields.
> >
>
> Same as above, the pid/tid fields are not in the struct
> binder_transaction (or redacted for oneway txns).
There is something off here. You have t->from_{pid|tid} and also
t->to_{proc|thead} that you can use. Isn't this what you are looking
for?
--
Carlos Llamas
next prev parent reply other threads:[~2025-03-12 20:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 20:02 [PATCH v16 0/3] binder: report txn errors via generic netlink Li Li
2025-03-03 20:02 ` [PATCH v16 1/3] lsm, selinux: Add setup_report permission to binder Li Li
2025-03-07 21:47 ` Paul Moore
2025-03-11 16:37 ` Li Li
2025-03-03 20:02 ` [PATCH v16 2/3] binder: report txn errors via generic netlink Li Li
2025-03-11 4:12 ` Carlos Llamas
[not found] ` <CANBPYPhR-C3VTv=ZHc1LJ0c7OG8-K2iGS62vXHmg9gcX0y89Cw@mail.gmail.com>
2025-03-12 18:49 ` Fwd: " Li Li
2025-03-12 20:14 ` Carlos Llamas [this message]
2025-03-12 20:56 ` Li Li
2025-03-03 20:02 ` [PATCH v16 3/3] binder: generic netlink binder_features flag Li Li
2025-03-11 3:37 ` Carlos Llamas
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=Z9HrEdbI5JYu0pwS@google.com \
--to=cmllamas@google.com \
--cc=arnd@arndb.de \
--cc=arve@android.com \
--cc=bagasdotme@gmail.com \
--cc=brauner@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=dualli@chromium.org \
--cc=dualli@google.com \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=horms@kernel.org \
--cc=hridya@google.com \
--cc=joel@joelfernandes.org \
--cc=kernel-team@android.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=masahiroy@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=pabeni@redhat.com \
--cc=selinux@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=smoreland@google.com \
--cc=surenb@google.com \
--cc=tkjos@android.com \
--cc=tweek@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).