[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241021182821.1259487-1-dualli@chromium.org>
Date: Mon, 21 Oct 2024 11:28:19 -0700
From: Li Li <dualli@...omium.org>
To: dualli@...gle.com,
corbet@....net,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
donald.hunter@...il.com,
gregkh@...uxfoundation.org,
arve@...roid.com,
tkjos@...roid.com,
maco@...roid.com,
joel@...lfernandes.org,
brauner@...nel.org,
cmllamas@...gle.com,
surenb@...gle.com,
arnd@...db.de,
masahiroy@...nel.org,
linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org,
netdev@...r.kernel.org,
hridya@...gle.com,
smoreland@...gle.com
Cc: kernel-team@...roid.com
Subject: [PATCH v3 0/1] binder: report txn errors via generic netlink (genl)
From: Li Li <dualli@...gle.com>
It's a known issue that neither the frozen processes nor the system
administration process of the OS can correctly deal with failed binder
transactions. The reason is that there's no reliable way for the user
space administration process to fetch the binder errors from the kernel
binder driver.
Android is such an OS suffering from this issue. Since cgroup freezer
was used to freeze user applications to save battery, innocent frozen
apps have to be killed when they receive sync binder transactions or
when their async binder buffer is running out.
This patch introduces the Linux generic netlink messages into the binder
driver so that the Linux/Android system administration process can
listen to important events and take corresponding actions, like stopping
a broken app from attacking the OS by sending huge amount of spamming
binder transactiions.
The first version uses a global generic netlink for all binder contexts,
raising potential security concerns. There were a few other feedbacks
like request to kernel docs and test code. The thread can be found at
https://lore.kernel.org/lkml/20240812211844.4107494-1-dualli@chromium.org/
The second version fixes those issues and has been tested on the latest
version of AOSP. See https://r.android.com/3305462 for how userspace is
going to use this feature and the test code. It can be found at
https://lore.kernel.org/lkml/20241011064427.1565287-1-dualli@chromium.org/
This version replaces the handcrafted netlink source code with the
netlink protocal specs in YAML. It also fixes the documentation issues.
v1: add a global binder genl socket for all contexts
v2: change to per-context binder genl for security reason
replace the new ioctl with a netlink command
add corresponding doc Documentation/admin-guide/binder_genl.rst
add user space test code in AOSP
v3: use YNL spec (./tools/net/ynl/ynl-regen.sh)
fix documentation index
Li Li (1):
report binder txn errors via generic netlink
Documentation/admin-guide/binder_genl.rst | 92 ++++++
Documentation/admin-guide/index.rst | 1 +
Documentation/netlink/specs/binder_genl.yaml | 59 ++++
drivers/android/Kconfig | 1 +
drivers/android/Makefile | 2 +-
drivers/android/binder.c | 287 ++++++++++++++++++-
drivers/android/binder_genl.c | 38 +++
drivers/android/binder_genl.h | 18 ++
drivers/android/binder_internal.h | 22 ++
drivers/android/binder_trace.h | 37 +++
drivers/android/binderfs.c | 4 +
include/uapi/linux/android/binder.h | 31 ++
include/uapi/linux/android/binder_genl.h | 37 +++
13 files changed, 625 insertions(+), 4 deletions(-)
create mode 100644 Documentation/admin-guide/binder_genl.rst
create mode 100644 Documentation/netlink/specs/binder_genl.yaml
create mode 100644 drivers/android/binder_genl.c
create mode 100644 drivers/android/binder_genl.h
create mode 100644 include/uapi/linux/android/binder_genl.h
--
2.47.0.105.g07ac214952-goog
Powered by blists - more mailing lists