2019-08-06 18:42:32

by Hridya Valsaraju

[permalink] [raw]
Subject: [PATCH v2 0/2] Add default binderfs devices

Binderfs was created to help provide private binder devices to
containers in their own IPC namespace. Currently, every time a new binderfs
instance is mounted, its private binder devices need to be created via
IOCTL calls. This patch series eliminates the effort for creating
the default binder devices for each binderfs instance by creating them
automatically.

Hridya Valsaraju (2):
binder: Add default binder devices through binderfs when configured
binder: Validate the default binderfs device names.

drivers/android/binder.c | 5 +++--
drivers/android/binder_internal.h | 2 ++
drivers/android/binderfs.c | 37 ++++++++++++++++++++++++++++---
3 files changed, 39 insertions(+), 5 deletions(-)

--
2.22.0.770.g0f2c4a37fd-goog


2019-08-06 19:12:06

by Hridya Valsaraju

[permalink] [raw]
Subject: [PATCH v2 2/2] binder: Validate the default binderfs device names.

Length of a binderfs device name cannot exceed BINDERFS_MAX_NAME.
This patch adds a check in binderfs_init() to ensure the same
for the default binder devices that will be created in every
binderfs instance.

Co-developed-by: Christian Brauner <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Signed-off-by: Hridya Valsaraju <[email protected]>
---
drivers/android/binderfs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 886b4e0f482f..52c8bd361906 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -572,6 +572,18 @@ static struct file_system_type binder_fs_type = {
int __init init_binderfs(void)
{
int ret;
+ const char *name;
+ size_t len;
+
+ /* Verify that the default binderfs device names are valid. */
+ name = binder_devices_param;
+ for (len = strcspn(name, ","); len > 0; len = strcspn(name, ",")) {
+ if (len > BINDERFS_MAX_NAME)
+ return -E2BIG;
+ name += len;
+ if (*name == ',')
+ name++;
+ }

/* Allocate new major number for binderfs. */
ret = alloc_chrdev_region(&binderfs_dev, 0, BINDERFS_MAX_MINOR,
--
2.22.0.770.g0f2c4a37fd-goog