All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Feng <puck.chen@hisilicon.com>
To: <gregkh@linuxfoundation.org>, <arve@android.com>,
	<riandrews@android.com>, <devel@driverdev.osuosl.org>,
	<linux-kernel@vger.kernel.org>, <wangjing6@huawei.com>,
	<weidong2@hisilicon.com>, <zhaojunmin@huawei.com>,
	<kernel-team@android.com>, <kirill.shutemov@linux.intel.com>,
	<oleg@redhat.com>, <hpa@zytor.com>, <luto@amacapital.net>,
	<dave.hansen@linux.intel.com>, <mingo@elte.hu>,
	<minchan@kernel.org>, <tglx@linutronix.de>,
	<akpm@linux-foundation.org>, <oleg@redhat.com>, <hpa@zytor.com>
Cc: <suzhuangluan@hisilicon.com>, <puck.chen@foxmail.com>,
	<w.f@huawei.com>, <linuxarm@huawei.com>
Subject: Re: [PATCH v3] android: binder: Sanity check at binder ioctl
Date: Tue, 2 Feb 2016 20:36:54 +0800	[thread overview]
Message-ID: <56B0A2E6.3090107@hisilicon.com> (raw)
In-Reply-To: <1454306642-73580-1-git-send-email-puck.chen@hisilicon.com>

Add android kernel team.

On 2016/2/1 14:04, Chen Feng wrote:
> 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@hisilicon.com>
> Signed-off-by: Wei  Dong <weidong2@hisilicon.com>
> Signed-off-by: Junmin Zhao <zhaojunmin@huawei.com>
> Reviewed-by: Zhuangluan Su <suzhuangluan@hisilicon.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);
> 

      reply	other threads:[~2016-02-02 12:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01  6:04 [PATCH v3] android: binder: Sanity check at binder ioctl Chen Feng
2016-02-02 12:36 ` Chen Feng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B0A2E6.3090107@hisilicon.com \
    --to=puck.chen@hisilicon.com \
    --cc=akpm@linux-foundation.org \
    --cc=arve@android.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=kernel-team@android.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=luto@amacapital.net \
    --cc=minchan@kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=puck.chen@foxmail.com \
    --cc=riandrews@android.com \
    --cc=suzhuangluan@hisilicon.com \
    --cc=tglx@linutronix.de \
    --cc=w.f@huawei.com \
    --cc=wangjing6@huawei.com \
    --cc=weidong2@hisilicon.com \
    --cc=zhaojunmin@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.