lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1454306642-73580-1-git-send-email-puck.chen@hisilicon.com>
Date:	Mon, 1 Feb 2016 14:04:02 +0800
From:	Chen Feng <puck.chen@...ilicon.com>
To:	<gregkh@...uxfoundation.org>, <arve@...roid.com>,
	<riandrews@...roid.com>, <devel@...verdev.osuosl.org>,
	<linux-kernel@...r.kernel.org>, <wangjing6@...wei.com>,
	<weidong2@...ilicon.com>, <zhaojunmin@...wei.com>,
	<puck.chen@...ilicon.com>
CC:	<suzhuangluan@...ilicon.com>, <puck.chen@...mail.com>,
	<w.f@...wei.com>, <linuxarm@...wei.com>
Subject: [PATCH v3] android: binder: Sanity check at binder ioctl

Sanity check at binder ioctl function,
Only allow the shared mm_struct to use the same binder-object
to do binder operate.

And add proc->vma_vm_mm = current->mm at the open function.
The libbinder do ioctl before mmap called.

V2: Fix compile error for error commit
V3: Change the condition to proc->vma_vm_mm

Signed-off-by: Chen Feng <puck.chen@...ilicon.com>
Signed-off-by: Wei  Dong <weidong2@...ilicon.com>
Signed-off-by: Junmin Zhao <zhaojunmin@...wei.com>
Reviewed-by: Zhuangluan Su <suzhuangluan@...ilicon.com>
---
 drivers/android/binder.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index a39e85f..f080a8b 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -2737,6 +2737,10 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	/*pr_info("binder_ioctl: %d:%d %x %lx\n",
 			proc->pid, current->pid, cmd, arg);*/
 
+	if (unlikely(current->mm != proc->vma_vm_mm)) {
+		pr_err("current mm mismatch proc mm\n");
+		return -EINVAL;
+	}
 	trace_binder_ioctl(cmd, arg);
 
 	ret = wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2);
@@ -2951,6 +2955,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
 		return -ENOMEM;
 	get_task_struct(current);
 	proc->tsk = current;
+	proc->vma_vm_mm = current->mm;
 	INIT_LIST_HEAD(&proc->todo);
 	init_waitqueue_head(&proc->wait);
 	proc->default_priority = task_nice(current);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ