Commit 4a2ebb93 authored by Eric W. Biederman's avatar Eric W. Biederman

userns: Convert binder ipc to use kuids

Cc: Arve Hjønnevåg <arve@android.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent d2b31ca6
...@@ -47,7 +47,7 @@ static HLIST_HEAD(binder_dead_nodes); ...@@ -47,7 +47,7 @@ static HLIST_HEAD(binder_dead_nodes);
static struct dentry *binder_debugfs_dir_entry_root; static struct dentry *binder_debugfs_dir_entry_root;
static struct dentry *binder_debugfs_dir_entry_proc; static struct dentry *binder_debugfs_dir_entry_proc;
static struct binder_node *binder_context_mgr_node; static struct binder_node *binder_context_mgr_node;
static uid_t binder_context_mgr_uid = -1; static kuid_t binder_context_mgr_uid = INVALID_UID;
static int binder_last_id; static int binder_last_id;
static struct workqueue_struct *binder_deferred_workqueue; static struct workqueue_struct *binder_deferred_workqueue;
...@@ -356,7 +356,7 @@ struct binder_transaction { ...@@ -356,7 +356,7 @@ struct binder_transaction {
unsigned int flags; unsigned int flags;
long priority; long priority;
long saved_priority; long saved_priority;
uid_t sender_euid; kuid_t sender_euid;
}; };
static void static void
...@@ -2427,7 +2427,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -2427,7 +2427,7 @@ static int binder_thread_read(struct binder_proc *proc,
} }
tr.code = t->code; tr.code = t->code;
tr.flags = t->flags; tr.flags = t->flags;
tr.sender_euid = t->sender_euid; tr.sender_euid = from_kuid(current_user_ns(), t->sender_euid);
if (t->from) { if (t->from) {
struct task_struct *sender = t->from->proc->tsk; struct task_struct *sender = t->from->proc->tsk;
...@@ -2705,12 +2705,12 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2705,12 +2705,12 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
ret = -EBUSY; ret = -EBUSY;
goto err; goto err;
} }
if (binder_context_mgr_uid != -1) { if (uid_valid(binder_context_mgr_uid)) {
if (binder_context_mgr_uid != current->cred->euid) { if (!uid_eq(binder_context_mgr_uid, current->cred->euid)) {
pr_err("binder: BINDER_SET_" pr_err("binder: BINDER_SET_"
"CONTEXT_MGR bad uid %d != %d\n", "CONTEXT_MGR bad uid %d != %d\n",
current->cred->euid, from_kuid(&init_user_ns, current->cred->euid),
binder_context_mgr_uid); from_kuid(&init_user_ns, binder_context_mgr_uid));
ret = -EPERM; ret = -EPERM;
goto err; goto err;
} }
......
...@@ -952,9 +952,6 @@ config UIDGID_CONVERTED ...@@ -952,9 +952,6 @@ config UIDGID_CONVERTED
depends on UFS_FS = n depends on UFS_FS = n
depends on XFS_FS = n depends on XFS_FS = n
# The rare drivers that won't build
depends on ANDROID_BINDER_IPC = n
config UIDGID_STRICT_TYPE_CHECKS config UIDGID_STRICT_TYPE_CHECKS
bool "Require conversions between uid/gids and their internal representation" bool "Require conversions between uid/gids and their internal representation"
depends on UIDGID_CONVERTED depends on UIDGID_CONVERTED
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment