From nobody Sun Feb 8 19:30:33 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 570CB1DE3AF for ; Thu, 12 Dec 2024 22:41:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734043285; cv=none; b=L7tEhrMtOpHQSDNfmP6WdzUvSt3eRxcYMI7+FncpKo6x2vYS7nAiyEvljhYb5WT6EGt2knDHCnOd0ywMwBwBifz2nCtaR0cnKAEFQ8vWmlaFitedGrmoXenSjuEVmkhuhxve9jhNHTUoP4JRndkubUDUQpU/eT+4ShPUWbu+q3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734043285; c=relaxed/simple; bh=QnID2Nngias2laFlMVHINRNQrpY+Vv1z4BU4mytckzw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=matSNKjDyaJxSAXVZva04J4XYasPi4sF80vD63hIBGWJYZwQmSg6opp96SuKxzQz/1YYFTFeRmsBmSaaqDTTSdOH5+6jqUe8b+eAJ06f8pOlFh9RZWDSU284o1/AVBYm/CiMneb9yIuqaaRJ4kXJF7Eoakq0/sSXYbA1VQMQbrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=mc5sO8/3; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mc5sO8/3" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-216395e151bso7702395ad.0 for ; Thu, 12 Dec 2024 14:41:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734043283; x=1734648083; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rTbCEHQ6hia/KRivi/ryuMVv6+i9eA+M0miy6FoyLNI=; b=mc5sO8/3S6Wp08VWV37d0JDfLVG2ESqb4yYByKOyUXCchu6TnKx3FYCHDJNYxn8JMo ztUeVaUcnL+gcS/QxnW0mJYhzRJA9OcWJmmZTi9AqV2pSGjLa3fIm5H/4wzJyvKSF+9m hyin09IheCPJ4YhK+dcD5AOor90w/DVh1WKcQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734043283; x=1734648083; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rTbCEHQ6hia/KRivi/ryuMVv6+i9eA+M0miy6FoyLNI=; b=LtnTmkuVGh1sGUZEpQ8bjCLAM16U1t09R7zPe/tlUpJTGYzdVhUOVmKu9pSFe29owT Jw/HWQIUNm9QHoL2K8EK+lF50RL9O6qEvjiIhTGjXsVmcJRO7PSh5sr9X9c/l6JAuasp YegU+qoPEDciQ/GmAfQewUavGjZC5asyFK1y+VRAbbDJvKZU08yxXaR0ciudQ28D7slF 0xiAyJdxdUC2SbSWoaUDv1UOJd6cCsF4y5Qw6hqPNI3NytsYvP8g6EmCUzqmEuCcAiDh sDBz5odIdowPH1S+l7vr+/HTyq5MKYAlq7p/uMOdG7wJICIWswqNWUK6t+k9qeWzE/KY 5dVw== X-Forwarded-Encrypted: i=1; AJvYcCVXqp2YA0R/2EgXVesh9k2Ed+TZa4JZSC6nAzq5c0C3Cs1qPgBDEpRcF342JACJjyYwxTGNufcErAcTwIs=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3SADt62gu3fRq8rSG25tjys1yAfdrSwKueSmWdYqa9yLBsebu 4lg4bnhs+Lk365by2GioETqcxvFLEDgvjQKWXLPVJU8MvemUCKN47psUg4eeOg== X-Gm-Gg: ASbGnctu2ovRBxeo9ccKmUZy4rfv5QqaAUG7ctulwwm9Z+DmJEHnZaky1X2y7WyxEDD rPXq9IlFbs8kFANmW2LYcs7LjlFI2vCws/sJK4cUGVDI9+wKYTSgUm2NEy2e+fQrbaDhAL9Qwux edkhn3vRclzEDuE/nvhzScsf7ugDgEL+9LiYalceRr5EY19RUQuaO4M4zKioi25sMNcMO8w0pSY X5gyTxv2e/4+4mz/JAsFfUzWTFCCdpIuemFJphrSYomqb1rdVAs7+v0UALT4kfXLKTHQOrSlYiP GzHEYqzulI5ywjA6c+GCI5IfXF7DCwxJ8mK34k6kjiHbMA== X-Google-Smtp-Source: AGHT+IE7mpoXxnTF8cVAExncDjTsgRkgtqF/AwV3t/7KpNuP4yvLpiYHGewaXEWkm9gaAI1GF97u+Q== X-Received: by 2002:a17:902:f546:b0:216:4fad:35d0 with SMTP id d9443c01a7336-2178c7d5224mr66505915ad.9.1734043283528; Thu, 12 Dec 2024 14:41:23 -0800 (PST) Received: from li-cloudtop.c.googlers.com.com (200.23.125.34.bc.googleusercontent.com. [34.125.23.200]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-216281f45a2sm98579785ad.250.2024.12.12.14.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 14:41:23 -0800 (PST) From: Li Li To: dualli@google.com, corbet@lwn.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, donald.hunter@gmail.com, gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com, maco@android.com, joel@joelfernandes.org, brauner@kernel.org, cmllamas@google.com, surenb@google.com, arnd@arndb.de, masahiroy@kernel.org, bagasdotme@gmail.com, horms@kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, netdev@vger.kernel.org, hridya@google.com, smoreland@google.com Cc: kernel-team@android.com Subject: [PATCH net-next v10 1/2] binderfs: add new binder devices to binder_devices Date: Thu, 12 Dec 2024 14:41:13 -0800 Message-ID: <20241212224114.888373-2-dualli@chromium.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241212224114.888373-1-dualli@chromium.org> References: <20241212224114.888373-1-dualli@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li Li When binderfs is not enabled, the binder driver parses the kernel config to create all binder devices. All of the new binder devices are stored in the list binder_devices. When binderfs is enabled, the binder driver creates new binder devices dynamically when userspace applications call BINDER_CTL_ADD ioctl. But the devices created in this way are not stored in the same list. This patch fixes that. Signed-off-by: Li Li Acked-by: Carlos Llamas --- drivers/android/binder.c | 5 +++++ drivers/android/binder_internal.h | 8 ++++++++ drivers/android/binderfs.c | 2 ++ 3 files changed, 15 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index ef353ca13c35..0a16acd29653 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -6928,6 +6928,11 @@ const struct binder_debugfs_entry binder_debugfs_ent= ries[] =3D { {} /* terminator */ }; =20 +void binder_add_device(struct binder_device *device) +{ + hlist_add_head(&device->hlist, &binder_devices); +} + static int __init init_binder_device(const char *name) { int ret; diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_int= ernal.h index f8d6be682f23..1f21ad3963b1 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -582,4 +582,12 @@ struct binder_object { }; }; =20 +/** + * Add a binder device to binder_devices + * @device: the new binder device to add to the global list + * + * Not reentrant as the list is not protected by any locks + */ +void binder_add_device(struct binder_device *device); + #endif /* _LINUX_BINDER_INTERNAL_H */ diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index ad1fa7abc323..bc6bae76ccaf 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -207,6 +207,8 @@ static int binderfs_binder_device_create(struct inode *= ref_inode, fsnotify_create(root->d_inode, dentry); inode_unlock(d_inode(root)); =20 + binder_add_device(device); + return 0; =20 err: --=20 2.47.1.613.gc27f4b7a9f-goog From nobody Sun Feb 8 19:30:33 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 151321DE8BF for ; Thu, 12 Dec 2024 22:41:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734043289; cv=none; b=cDrQN+qbvWqrDwizxe1cHwYpSVALSTxwQT9TsgAUzewJdEr+F0oh0ZiUbIMMPZ514lxN6w4cLzXOhTrAozOc2rSdB7mRELHGgYNfsUgrayHtIBK65otTsHB+UIVpMkQBB+zIlit7U6nN+o9FY2E+Jq1RIXa4LKnLcoRiQd95ZvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734043289; c=relaxed/simple; bh=DnuqRQ2ao0SSp7ydGhGUtb0kXzmR2XDZlEZ5pdIbxC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mp+reNkBC4Qju+SuCK0SOzTMbRh27RDUv7XtTL+5V8MmNSeLDubflwjoymUFIfWrbBYSI2QZ6DfBhBEPCYNpnfyJBZfYrI0vzzOMrtqhc/qPMLFzGrZ7ljFP+N36g/yXWTkwDi5QqzD+7oN7fL6HJ1ne/hol3x2sKNZZ1LSIsQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Ifd4uRFz; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Ifd4uRFz" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-21675fd60feso13385625ad.2 for ; Thu, 12 Dec 2024 14:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734043285; x=1734648085; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v1Tzhy9gJOgwX4hYFCKR+1bmO4u8v5t2gaKspYX31cc=; b=Ifd4uRFzyrptr6UNupIUhNpFp7tESkku7K0DUFkXwmM8N1EUlGMYCo6Yaz9az8t6YS zOtfXNjEDu3pg5EWjkjPK7lGpZcyFqZRuVLjuCWWnHjOeljEYfYlnYU0G6+BxhzM7uOq npCUWZ/KZtFOpDBU6Di1fch2yqVelIm9EjaxI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734043285; x=1734648085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v1Tzhy9gJOgwX4hYFCKR+1bmO4u8v5t2gaKspYX31cc=; b=QoyonIPm5nNA9F9Qr6UHLug2UTL+VVmalahOOje4R5QtKg1w6AJaaSCsimpKSACLoE W0bdPdHPJLaW7w05R8J3CdQM21uODu1bTkC/mUKpo+o6+01+YaU4uWA2XMg+PiQoqf1n jlocAZ5ezmKT07MZO7Sz985zJkqMoUt/oMw1jmQnWVYG6oDCbzxPXL+eyEfzw+7QpOfI iMvboRVn9LWcF+BaGNEc2GG7neje8swDwK/KiLI8zEqkwlb49mpxCLU8hUmt2dF/ithS +2zF4Av9l3nc5feyLDGGJzBMg32gfsqFe4chwqCaA4oa0xlvKYbHS0xd02yOefkk6Zo5 bA7A== X-Forwarded-Encrypted: i=1; AJvYcCVAuJkcEIsF1+I2eDpMG1vUd8uVZStUdzEL+Y6QpcybfxJ8CFb/jVtG1xL3sJfo3u2Wz3lrOMtEQ9NTbDc=@vger.kernel.org X-Gm-Message-State: AOJu0YwgAZFxbaC86jRXLT1gtS/PC/y3X0Qvj5NBsNtMbQRV8fDnvUFf YTIbqDuNSbMbOR09sw5mCcAPcDBIBHh3QF1rePw4b+iDLznep04SXPgpNSdU6Q== X-Gm-Gg: ASbGncugbTyhyBJsMvAfVzKctAcqUnkZYUJ23FSB1SjKu/7L8mjyknFlp1Gd8EuASMv rNIgTz4zG9IQ2AhL3ALfdqugYBH/G3EDGSZr2FIWzZ+aA+0FLZN+trDr1z+Yi2LykCr6GVYJOY4 irFFMSB2MK2jptVjCo8Hya0Nxt2VflCNwKpO3NW4xi+oaJ2qLjK1Loj4pkyz5ftv+SVce+qJfkI YxNc+ZmAFCl+eWux4FaMaEQOoJPGVUve54+ARS/re7VArnYKu/14YdvILzioh8JCTnX6c/rZzEq v2QwGpxdUXrtp1gn0JS6TL1gUA/uLIU2rH4DiK+IPoOzCw== X-Google-Smtp-Source: AGHT+IHDkloNL47qyhWcGmgVRmx3Y9Fvt8uPXQQjfbKOtdxXwCv4qofLm9bIHoz9zYhgFKdDZAcAfA== X-Received: by 2002:a17:902:da87:b0:216:25a2:2ebe with SMTP id d9443c01a7336-218929bfc2amr6919165ad.19.1734043285168; Thu, 12 Dec 2024 14:41:25 -0800 (PST) Received: from li-cloudtop.c.googlers.com.com (200.23.125.34.bc.googleusercontent.com. [34.125.23.200]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-216281f45a2sm98579785ad.250.2024.12.12.14.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 14:41:24 -0800 (PST) From: Li Li To: dualli@google.com, corbet@lwn.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, donald.hunter@gmail.com, gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com, maco@android.com, joel@joelfernandes.org, brauner@kernel.org, cmllamas@google.com, surenb@google.com, arnd@arndb.de, masahiroy@kernel.org, bagasdotme@gmail.com, horms@kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, netdev@vger.kernel.org, hridya@google.com, smoreland@google.com Cc: kernel-team@android.com Subject: [PATCH net-next v10 2/2] binder: report txn errors via generic netlink Date: Thu, 12 Dec 2024 14:41:14 -0800 Message-ID: <20241212224114.888373-3-dualli@chromium.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241212224114.888373-1-dualli@chromium.org> References: <20241212224114.888373-1-dualli@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li Li Introduce 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 transactions. The binder netlink sources and headers are automatically generated from the corresponding binder_netlink YAML spec. Don't modify them directly. Signed-off-by: Li Li --- Documentation/admin-guide/binder_genl.rst | 110 ++++++++ Documentation/admin-guide/index.rst | 1 + .../netlink/specs/binder_netlink.yaml | 108 ++++++++ drivers/android/Kconfig | 1 + drivers/android/Makefile | 2 +- drivers/android/binder.c | 237 +++++++++++++++++- drivers/android/binder_internal.h | 21 +- drivers/android/binder_netlink.c | 39 +++ drivers/android/binder_netlink.h | 19 ++ drivers/android/binder_trace.h | 35 +++ include/uapi/linux/android/binder_netlink.h | 55 ++++ 11 files changed, 622 insertions(+), 6 deletions(-) create mode 100644 Documentation/admin-guide/binder_genl.rst create mode 100644 Documentation/netlink/specs/binder_netlink.yaml create mode 100644 drivers/android/binder_netlink.c create mode 100644 drivers/android/binder_netlink.h create mode 100644 include/uapi/linux/android/binder_netlink.h diff --git a/Documentation/admin-guide/binder_genl.rst b/Documentation/admi= n-guide/binder_genl.rst new file mode 100644 index 000000000000..71b4c6596c5b --- /dev/null +++ b/Documentation/admin-guide/binder_genl.rst @@ -0,0 +1,110 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Generic Netlink for the Android Binder Driver (Binder Netlink) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The Generic Netlink subsystem in the Linux kernel provides a generic way f= or +the Linux kernel to communicate with the user space applications via binder +driver. It is used to report binder transaction errors and warnings to user +space administration process. The driver allows multiple binder devices and +their corresponding binder contexts. Each context has an independent Gener= ic +Netlink for security reason. To prevent untrusted user applications from +accessing the netlink data, the kernel driver uses unicast mode instead of +multicast. + +Basically, the user space code uses the BINDER_NETLINK_CMD_REPORT_SETUP +command to request what kind of binder transactions should be reported by +the driver. The driver then echoes the attributes in a reply message to +acknowledge the request. The BINDER_NETLINK_CMD_REPORT_SETUP command also +registers the current user space process to receive the reports. When the +user space process exits, the previous request will be reset automatically. + +Currently the driver reports these binder transaction errors and warnings. +1. "FAILED" transactions that fail to reach the target process; +2. "ASYNC_FROZEN" transactions that are delayed due to the target process +being frozen by cgroup freezer; or +3. "SPAM" transactions that are considered spamming according to existing +logic in binder_alloc.c. + +When the specified binder transactions happen, the driver uses the +BINDER_NETLINK_CMD_REPORT command to send a generic netlink message to the +registered process, containing the payload defined in binder_netlink.yaml. + +More details about the flags, attributes and operations can be found at the +the doc sections in Documentations/netlink/specs/binder_netlink.yaml and t= he +kernel-doc comments of the new source code in binder.{h|c}. + +Using Binder Netlink +-------------------- + +The Binder Netlink can be used in the same way as any other generic netlink +drivers. Userspace application uses a raw netlink socket to send commands +to and receive packets from the kernel driver. + +.. note:: + If the userspace application that talks to the driver exits, the kernel + driver will automatically reset the configuration to the default and + stop sending more reports, which would otherwise fail. + +Usage example (user space pseudo code): + +:: + /* + * send() below is overloaded to pack netlink commands and attributes + * to nlattr/genlmsghdr/nlmsghdr and then send to the netlink socket. + * + * recv() below is overloaded to receive the raw netlink message from + * the netlink socket, parse nlmsghdr/genlmsghdr to find the netlink + * command and then return the nlattr payload. + */ + + // open netlink socket + int fd =3D socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); + + // bind netlink socket + bind(fd, struct socketaddr); + + // get the family id of the binder netlink + send(fd, CTRL_CMD_GETFAMILY, CTRL_ATTR_FAMILY_NAME, + BINDER_NETLINK_FAMILY_NAME); + void *data =3D recv(CTRL_CMD_NEWFAMILY); + if (!has_nla_type(data, CTRL_ATTR_FAMILY_ID)) { + // Binder Netlink isn't available on this version of Linux kernel + return; + } + __u16 id =3D nla(data)[CTRL_ATTR_FAMILY_ID]; + + // enable per-context binder report + send(fd, id, BINDER_NETLINK_CMD_REPORT_SETUP, "binder", 0, + BINDER_NETLINK_FLAG_FAILED | BINDER_NETLINK_FLAG_DELAYED); + + // confirm the per-context configuration + data =3D recv(fd, BINDER_NETLINK_CMD_REPLY); + char *context =3D nla(data)[BINDER_NETLINK_A_CMD_CONTEXT]; + __u32 pid =3D nla(data)[BINDER_NETLINK_A_CMD_PID]; + __u32 flags =3D nla(data)[BINDER_NETLINK_A_CMD_FLAGS]; + + // set optional per-process report, overriding the per-context one + send(fd, id, BINDER_NETLINK_CMD_REPORT_SETUP, "binder", getpid(), + BINDER_NETLINK_FLAG_SPAM | BINDER_REPORT_OVERRIDE); + + // confirm the optional per-process configuration + data =3D recv(fd, BINDER_NETLINK_CMD_REPLY); + context =3D nla(data)[BINDER_NETLINK_A_CMD_CONTEXT]; + pid =3D nla(data)[BINDER_NETLINK_A_CMD_PID]; + flags =3D nla(data)[BINDER_NETLINK_A_CMD_FLAGS]; + + // wait and read all binder reports + while (running) { + data =3D recv(fd, BINDER_NETLINK_CMD_REPORT); + auto *attr =3D nla(data)[BINDER_NETLINK_A_REPORT_XXX]; + + // process binder report + do_something(*attr); + } + + // clean up + send(fd, id, BINDER_NETLINK_CMD_REPORT_SETUP, 0, 0); + send(fd, id, BINDER_NETLINK_CMD_REPORT_SETUP, getpid(), 0); + close(fd); diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guid= e/index.rst index e85b1adf5908..b3b5cfadffe5 100644 --- a/Documentation/admin-guide/index.rst +++ b/Documentation/admin-guide/index.rst @@ -79,6 +79,7 @@ configure specific aspects of kernel behavior to your lik= ing. aoe/index auxdisplay/index bcache + binder_genl binderfs binfmt-misc blockdev/index diff --git a/Documentation/netlink/specs/binder_netlink.yaml b/Documentatio= n/netlink/specs/binder_netlink.yaml new file mode 100644 index 000000000000..7eef013e6f07 --- /dev/null +++ b/Documentation/netlink/specs/binder_netlink.yaml @@ -0,0 +1,108 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cla= use) + +name: binder_netlink +protocol: genetlink +uapi-header: linux/android/binder_netlink.h +doc: Netlink protocol to report binder transaction errors and warnings. + +definitions: + - + type: flags + name: flag + doc: Define what kind of binder transactions should be reported. + entries: [ failed, async-frozen, spam, override ] + +attribute-sets: + - + name: cmd + doc: The supported attributes of "report-setup" command. + attributes: + - + name: context + type: string + doc: The binder context to enable binder netlink report. + - + name: pid + type: u32 + doc: The binder proc to enable binder netlink report. + - + name: flags + type: u32 + enum: flag + doc: What kind of binder transactions should be reported. + - + name: report + doc: The supported attributes of "report" command + attributes: + - + name: context + type: string + doc: The binder context where the binder netlink report happens. + - + name: err + type: u32 + doc: Copy of binder_driver_return_protocol returned to the sender. + - + name: from_pid + type: u32 + doc: Sender pid of the corresponding binder transaction. + - + name: from_tid + type: u32 + doc: Sender tid of the corresponding binder transaction. + - + name: to_pid + type: u32 + doc: Target pid of the corresponding binder transaction. + - + name: to_tid + type: u32 + doc: Target tid of the corresponding binder transaction. + - + name: reply + type: u32 + doc: 1 means the transaction is a reply, 0 otherwise. + - + name: flags + type: u32 + doc: Copy of binder_transaction_data->flags. + - + name: code + type: u32 + doc: Copy of binder_transaction_data->code. + - + name: data_size + type: u32 + doc: Copy of binder_transaction_data->data_size. + +operations: + list: + - + name: report-setup + doc: Set flags from user space. + attribute-set: cmd + + do: + request: ¶ms + attributes: + - context + - pid + - flags + reply: *params + - + name: report + doc: Send the requested reports to user space. + attribute-set: report + + event: + attributes: + - context + - err + - from_pid + - from_tid + - to_pid + - to_tid + - reply + - flags + - code + - data_size diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index 07aa8ae0a058..e2fa620934e2 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -4,6 +4,7 @@ menu "Android" config ANDROID_BINDER_IPC bool "Android Binder IPC Driver" depends on MMU + depends on NET default n help Binder is used in Android for both communication between processes, diff --git a/drivers/android/Makefile b/drivers/android/Makefile index c9d3d0c99c25..b8874dba884e 100644 --- a/drivers/android/Makefile +++ b/drivers/android/Makefile @@ -2,5 +2,5 @@ ccflags-y +=3D -I$(src) # needed for trace events =20 obj-$(CONFIG_ANDROID_BINDERFS) +=3D binderfs.o -obj-$(CONFIG_ANDROID_BINDER_IPC) +=3D binder.o binder_alloc.o +obj-$(CONFIG_ANDROID_BINDER_IPC) +=3D binder.o binder_alloc.o binder_netli= nk.o obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) +=3D binder_alloc_selftest.o diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 0a16acd29653..44932659051c 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -72,6 +72,7 @@ =20 #include =20 +#include "binder_netlink.h" #include "binder_internal.h" #include "binder_trace.h" =20 @@ -2990,6 +2991,111 @@ static void binder_set_txn_from_error(struct binder= _transaction *t, int id, binder_thread_dec_tmpref(from); } =20 +/** + * binder_find_proc() - set binder report flags + * @pid: the target process + */ +static struct binder_proc *binder_find_proc(int pid) +{ + struct binder_proc *proc; + + mutex_lock(&binder_procs_lock); + hlist_for_each_entry(proc, &binder_procs, proc_node) { + if (proc->pid =3D=3D pid) { + mutex_unlock(&binder_procs_lock); + return proc; + } + } + mutex_unlock(&binder_procs_lock); + + return NULL; +} + +/** + * binder_netlink_enabled() - check if binder netlink reports are enabled + * @proc: the binder_proc to check + * @mask: the categories of binder netlink reports + * + * Returns true if certain binder netlink reports are enabled for this bin= der + * proc (when per-process overriding takes effect) or context. + */ +static bool binder_netlink_enabled(struct binder_proc *proc, u32 mask) +{ + struct binder_context *context =3D proc->context; + + if (!context->report_portid) + return false; + + if (proc->report_flags & BINDER_NETLINK_FLAG_OVERRIDE) + return (proc->report_flags & mask) !=3D 0; + else + return (context->report_flags & mask) !=3D 0; +} + +/** + * binder_netlink_report() - report one binder netlink event + * @context: the binder context + * @err: copy of binder_driver_return_protocol returned to the sender + * @pid: sender process + * @tid: sender thread + * @to_pid: target process + * @to_tid: target thread + * @reply: whether the binder transaction is a reply + * @tr: the binder transaction data + * + * Packs the report data into a binder netlink message and send it. + */ +static void binder_netlink_report(struct binder_context *context, u32 err, + u32 pid, u32 tid, u32 to_pid, u32 to_tid, + u32 reply, + struct binder_transaction_data *tr) +{ + int ret; + struct sk_buff *skb; + void *hdr; + + trace_binder_netlink_report(context->name, err, pid, tid, to_pid, + to_tid, reply, tr); + + skb =3D genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL); + if (!skb) { + pr_err("Failed to alloc binder netlink message\n"); + return; + } + + hdr =3D genlmsg_put(skb, 0, atomic_inc_return(&context->report_seq), + &binder_netlink_nl_family, 0, BINDER_NETLINK_CMD_REPORT); + if (!hdr) + goto free_skb; + + if (nla_put_string(skb, BINDER_NETLINK_A_REPORT_CONTEXT, context->name) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_ERR, err) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_FROM_PID, pid) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_FROM_TID, tid) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_TO_PID, to_pid) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_TO_TID, to_tid) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_REPLY, reply) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_FLAGS, tr->flags) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_CODE, tr->code) || + nla_put_u32(skb, BINDER_NETLINK_A_REPORT_DATA_SIZE, tr->data_size)) + goto cancel_skb; + + genlmsg_end(skb, hdr); + + ret =3D genlmsg_unicast(&init_net, skb, context->report_portid); + if (ret < 0) + pr_err("Failed to send binder netlink message to %d: %d\n", + context->report_portid, ret); + return; + +cancel_skb: + pr_err("Failed to add attributes to binder netlink message\n"); + genlmsg_cancel(skb, hdr); +free_skb: + pr_err("Free binder netlink report message on error\n"); + nlmsg_free(skb); +} + static void binder_transaction(struct binder_proc *proc, struct binder_thread *thread, struct binder_transaction_data *tr, int reply, @@ -3684,10 +3790,17 @@ static void binder_transaction(struct binder_proc *= proc, return_error_line =3D __LINE__; goto err_copy_data_failed; } - if (t->buffer->oneway_spam_suspect) + if (t->buffer->oneway_spam_suspect) { tcomplete->type =3D BINDER_WORK_TRANSACTION_ONEWAY_SPAM_SUSPECT; - else + if (binder_netlink_enabled(proc, BINDER_NETLINK_FLAG_SPAM)) + binder_netlink_report(context, BR_ONEWAY_SPAM_SUSPECT, + proc->pid, thread->pid, + target_proc ? target_proc->pid : 0, + target_thread ? target_thread->pid : 0, + reply, tr); + } else { tcomplete->type =3D BINDER_WORK_TRANSACTION_COMPLETE; + } t->work.type =3D BINDER_WORK_TRANSACTION; =20 if (reply) { @@ -3737,8 +3850,15 @@ static void binder_transaction(struct binder_proc *p= roc, * process and is put in a pending queue, waiting for the target * process to be unfrozen. */ - if (return_error =3D=3D BR_TRANSACTION_PENDING_FROZEN) + if (return_error =3D=3D BR_TRANSACTION_PENDING_FROZEN) { tcomplete->type =3D BINDER_WORK_TRANSACTION_PENDING; + if (binder_netlink_enabled(proc, BINDER_NETLINK_FLAG_ASYNC_FROZEN)) + binder_netlink_report(context, return_error, + proc->pid, thread->pid, + target_proc ? target_proc->pid : 0, + target_thread ? target_thread->pid : 0, + reply, tr); + } binder_enqueue_thread_work(thread, tcomplete); if (return_error && return_error !=3D BR_TRANSACTION_PENDING_FROZEN) @@ -3800,6 +3920,13 @@ static void binder_transaction(struct binder_proc *p= roc, binder_dec_node_tmpref(target_node); } =20 + if (binder_netlink_enabled(proc, BINDER_NETLINK_FLAG_FAILED)) + binder_netlink_report(context, return_error, + proc->pid, thread->pid, + target_proc ? target_proc->pid : 0, + target_thread ? target_thread->pid : 0, + reply, tr); + binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, "%d:%d transaction %s to %d:%d failed %d/%d/%d, size %lld-%lld line= %d\n", proc->pid, thread->pid, reply ? "reply" : @@ -6137,6 +6264,11 @@ static int binder_release(struct inode *nodp, struct= file *filp) =20 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); =20 + if (proc->pid =3D=3D proc->context->report_portid) { + proc->context->report_portid =3D 0; + proc->context->report_flags =3D 0; + } + return 0; } =20 @@ -6335,6 +6467,99 @@ binder_defer_work(struct binder_proc *proc, enum bin= der_deferred_state defer) mutex_unlock(&binder_deferred_lock); } =20 +/** + * binder_netlink_nl_report_setup_doit() - netlink .doit handler + * @skb: the metadata struct passed from netlink driver + * @info: the generic netlink struct passed from netlink driver + * + * Implements the .doit function to process binder netlink commands. + */ +int binder_netlink_nl_report_setup_doit(struct sk_buff *skb, struct genl_i= nfo *info) +{ + int portid; + u32 pid; + u32 flags; + void *hdr; + struct binder_proc *proc; + struct binder_device *device; + struct binder_context *context =3D NULL; + + hlist_for_each_entry(device, &binder_devices, hlist) { + if (!nla_strcmp(info->attrs[BINDER_NETLINK_A_CMD_CONTEXT], + device->context.name)) { + context =3D &device->context; + break; + } + } + + if (!context) { + NL_SET_ERR_MSG(info->extack, "Unknown binder context"); + return -EINVAL; + } + + portid =3D nlmsg_hdr(skb)->nlmsg_pid; + pid =3D nla_get_u32(info->attrs[BINDER_NETLINK_A_CMD_PID]); + flags =3D nla_get_u32(info->attrs[BINDER_NETLINK_A_CMD_FLAGS]); + + if (context->report_portid && context->report_portid !=3D portid) { + NL_SET_ERR_MSG_FMT(info->extack, + "No permission to set flags from %d", + portid); + return -EPERM; + } + + if (!pid) { + /* Set the global flags for the whole binder context */ + context->report_flags =3D flags; + } else { + /* Set the per-process flags */ + proc =3D binder_find_proc(pid); + if (!proc) { + NL_SET_ERR_MSG_FMT(info->extack, + "Invalid binder report pid %u", + pid); + return -EINVAL; + } + + proc->report_flags =3D flags; + } + + skb =3D genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL); + if (!skb) { + pr_err("Failed to alloc binder netlink reply message\n"); + return -ENOMEM; + } + + hdr =3D genlmsg_iput(skb, info); + if (!hdr) + goto free_skb; + + if (nla_put_string(skb, BINDER_NETLINK_A_CMD_CONTEXT, context->name) || + nla_put_u32(skb, BINDER_NETLINK_A_CMD_PID, pid) || + nla_put_u32(skb, BINDER_NETLINK_A_CMD_FLAGS, flags)) + goto cancel_skb; + + genlmsg_end(skb, hdr); + + if (genlmsg_reply(skb, info)) { + pr_err("Failed to send binder netlink reply message\n"); + return -EFAULT; + } + + if (!context->report_portid) + context->report_portid =3D portid; + + return 0; + +cancel_skb: + pr_err("Failed to add reply attributes to binder netlink message\n"); + genlmsg_cancel(skb, hdr); +free_skb: + pr_err("Free binder netlink reply message on error\n"); + nlmsg_free(skb); + return -EMSGSIZE; +} + static void print_binder_transaction_ilocked(struct seq_file *m, struct binder_proc *proc, const char *prefix, @@ -7014,6 +7239,12 @@ static int __init binder_init(void) if (ret) goto err_init_binder_device_failed; =20 + ret =3D genl_register_family(&binder_netlink_nl_family); + if (ret) { + pr_err("Failed to register binder netlink family\n"); + goto err_init_binder_device_failed; + } + return ret; =20 err_init_binder_device_failed: diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_int= ernal.h index 1f21ad3963b1..c67eba88f89a 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -12,21 +12,35 @@ #include #include #include +#include #include #include "binder_alloc.h" #include "dbitmap.h" =20 +/** + * struct binder_context - information about a binder domain + * @binder_context_mgr_node: the context manager + * @context_mgr_node_lock: the lock protecting the above context manager= node + * @binder_context_mgr_uid: the uid of the above context manager + * @name: the name of the binder device + * @report_portid: the netlink socket to receive binder reports + * @report_flags: the categories of binder transactions that wo= uld + * be reported (see enum binder_report_flag). + * @report_seq: the seq number of the generic netlink report + */ struct binder_context { struct binder_node *binder_context_mgr_node; struct mutex context_mgr_node_lock; kuid_t binder_context_mgr_uid; const char *name; + u32 report_portid; + u32 report_flags; + atomic_t report_seq; }; =20 /** * struct binder_device - information about a binder device node - * @hlist: list of binder devices (only used for devices requeste= d via - * CONFIG_ANDROID_BINDER_DEVICES) + * @hlist: list of binder devices * @miscdev: information about a binder character device node * @context: binder context information * @binderfs_inode: This is the inode of the root dentry of the super block @@ -415,6 +429,8 @@ struct binder_ref { * @binderfs_entry: process-specific binderfs log file * @oneway_spam_detection_enabled: process enabled oneway spam detection * or not + * @report_flags: the categories of binder transactions that would + * be reported (see enum binder_genl_flag). * * Bookkeeping structure for binder processes */ @@ -453,6 +469,7 @@ struct binder_proc { spinlock_t outer_lock; struct dentry *binderfs_entry; bool oneway_spam_detection_enabled; + u32 report_flags; }; =20 /** diff --git a/drivers/android/binder_netlink.c b/drivers/android/binder_netl= ink.c new file mode 100644 index 000000000000..2081b4319268 --- /dev/null +++ b/drivers/android/binder_netlink.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/binder_netlink.yaml */ +/* YNL-GEN kernel source */ + +#include +#include + +#include "binder_netlink.h" + +#include + +/* BINDER_NETLINK_CMD_REPORT_SETUP - do */ +static const struct nla_policy binder_netlink_report_setup_nl_policy[BINDE= R_NETLINK_A_CMD_FLAGS + 1] =3D { + [BINDER_NETLINK_A_CMD_CONTEXT] =3D { .type =3D NLA_NUL_STRING, }, + [BINDER_NETLINK_A_CMD_PID] =3D { .type =3D NLA_U32, }, + [BINDER_NETLINK_A_CMD_FLAGS] =3D NLA_POLICY_MASK(NLA_U32, 0xf), +}; + +/* Ops table for binder_netlink */ +static const struct genl_split_ops binder_netlink_nl_ops[] =3D { + { + .cmd =3D BINDER_NETLINK_CMD_REPORT_SETUP, + .doit =3D binder_netlink_nl_report_setup_doit, + .policy =3D binder_netlink_report_setup_nl_policy, + .maxattr =3D BINDER_NETLINK_A_CMD_FLAGS, + .flags =3D GENL_CMD_CAP_DO, + }, +}; + +struct genl_family binder_netlink_nl_family __ro_after_init =3D { + .name =3D BINDER_NETLINK_FAMILY_NAME, + .version =3D BINDER_NETLINK_FAMILY_VERSION, + .netnsok =3D true, + .parallel_ops =3D true, + .module =3D THIS_MODULE, + .split_ops =3D binder_netlink_nl_ops, + .n_split_ops =3D ARRAY_SIZE(binder_netlink_nl_ops), +}; diff --git a/drivers/android/binder_netlink.h b/drivers/android/binder_netl= ink.h new file mode 100644 index 000000000000..022cff5f7c38 --- /dev/null +++ b/drivers/android/binder_netlink.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/binder_netlink.yaml */ +/* YNL-GEN kernel header */ + +#ifndef _LINUX_BINDER_NETLINK_GEN_H +#define _LINUX_BINDER_NETLINK_GEN_H + +#include +#include + +#include + +int binder_netlink_nl_report_setup_doit(struct sk_buff *skb, + struct genl_info *info); + +extern struct genl_family binder_netlink_nl_family; + +#endif /* _LINUX_BINDER_NETLINK_GEN_H */ diff --git a/drivers/android/binder_trace.h b/drivers/android/binder_trace.h index fe38c6fc65d0..8976fb5ee2db 100644 --- a/drivers/android/binder_trace.h +++ b/drivers/android/binder_trace.h @@ -423,6 +423,41 @@ TRACE_EVENT(binder_return, "unknown") ); =20 +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), + TP_ARGS(name, err, pid, tid, to_pid, to_tid, reply, tr), + TP_STRUCT__entry( + __field(const char *, name) + __field(u32, err) + __field(u32, pid) + __field(u32, tid) + __field(u32, to_pid) + __field(u32, to_tid) + __field(u32, reply) + __field(u32, flags) + __field(u32, code) + __field(binder_size_t, data_size) + ), + TP_fast_assign( + __entry->name =3D name; + __entry->err =3D err; + __entry->pid =3D pid; + __entry->tid =3D tid; + __entry->to_pid =3D to_pid; + __entry->to_tid =3D to_tid; + __entry->reply =3D reply; + __entry->flags =3D tr->flags; + __entry->code =3D tr->code; + __entry->data_size =3D tr->data_size; + ), + TP_printk("%s: %d %d:%d -> %d:%d %s flags=3D0x08%x code=3D%d %llu", + __entry->name, __entry->err, __entry->pid, __entry->tid, + __entry->to_pid, __entry->to_tid, + __entry->reply ? "reply" : "", + __entry->flags, __entry->code, __entry->data_size) +); + #endif /* _BINDER_TRACE_H */ =20 #undef TRACE_INCLUDE_PATH diff --git a/include/uapi/linux/android/binder_netlink.h b/include/uapi/lin= ux/android/binder_netlink.h new file mode 100644 index 000000000000..2b1460387597 --- /dev/null +++ b/include/uapi/linux/android/binder_netlink.h @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Cl= ause) */ +/* Do not edit directly, auto-generated from: */ +/* Documentation/netlink/specs/binder_netlink.yaml */ +/* YNL-GEN uapi header */ + +#ifndef _UAPI_LINUX_ANDROID_BINDER_NETLINK_H +#define _UAPI_LINUX_ANDROID_BINDER_NETLINK_H + +#define BINDER_NETLINK_FAMILY_NAME "binder_netlink" +#define BINDER_NETLINK_FAMILY_VERSION 1 + +/* + * Define what kind of binder transactions should be reported. + */ +enum binder_netlink_flag { + BINDER_NETLINK_FLAG_FAILED =3D 1, + BINDER_NETLINK_FLAG_ASYNC_FROZEN =3D 2, + BINDER_NETLINK_FLAG_SPAM =3D 4, + BINDER_NETLINK_FLAG_OVERRIDE =3D 8, +}; + +enum { + BINDER_NETLINK_A_CMD_CONTEXT =3D 1, + BINDER_NETLINK_A_CMD_PID, + BINDER_NETLINK_A_CMD_FLAGS, + + __BINDER_NETLINK_A_CMD_MAX, + BINDER_NETLINK_A_CMD_MAX =3D (__BINDER_NETLINK_A_CMD_MAX - 1) +}; + +enum { + BINDER_NETLINK_A_REPORT_CONTEXT =3D 1, + BINDER_NETLINK_A_REPORT_ERR, + BINDER_NETLINK_A_REPORT_FROM_PID, + BINDER_NETLINK_A_REPORT_FROM_TID, + BINDER_NETLINK_A_REPORT_TO_PID, + BINDER_NETLINK_A_REPORT_TO_TID, + BINDER_NETLINK_A_REPORT_REPLY, + BINDER_NETLINK_A_REPORT_FLAGS, + BINDER_NETLINK_A_REPORT_CODE, + BINDER_NETLINK_A_REPORT_DATA_SIZE, + + __BINDER_NETLINK_A_REPORT_MAX, + BINDER_NETLINK_A_REPORT_MAX =3D (__BINDER_NETLINK_A_REPORT_MAX - 1) +}; + +enum { + BINDER_NETLINK_CMD_REPORT_SETUP =3D 1, + BINDER_NETLINK_CMD_REPORT, + + __BINDER_NETLINK_CMD_MAX, + BINDER_NETLINK_CMD_MAX =3D (__BINDER_NETLINK_CMD_MAX - 1) +}; + +#endif /* _UAPI_LINUX_ANDROID_BINDER_NETLINK_H */ --=20 2.47.1.613.gc27f4b7a9f-goog