Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1719548
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 3/5] android: binder: Move buffer out of area shared with user space |
| Date | 2017-08-24 22:40 +0200 |
| Message-ID | <ui750-2Q6-19@gated-at.bofh.it> (permalink) |
| References | <uhG4N-2mD-3@gated-at.bofh.it> <uhG4N-2mD-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Aug 23, 2017 at 08:46:41AM -0700, Sherry Yang wrote:
> Binder driver allocates buffer meta data in a region that is mapped
> in user space. These meta data contain pointers in the kernel.
>
> This patch allocates buffer meta data on the kernel heap that is
> not mapped in user space, and uses a pointer to refer to the data mapped.
>
This feels like it has a security impact, right? The original code is
an info leak?
> @@ -664,7 +679,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc,
>
> return 0;
>
> -err_alloc_small_buf_failed:
> +err_alloc_buf_struct_failed:
> kfree(alloc->pages);
> alloc->pages = NULL;
> err_alloc_pages_failed:
Not really really related to your patch, I was just looking at the
error handling here. It looks like this with your patch applied.
682 err_alloc_buf_struct_failed:
683 kfree(alloc->pages);
684 alloc->pages = NULL;
685 err_alloc_pages_failed:
686 mutex_lock(&binder_alloc_mmap_lock);
687 vfree(alloc->buffer);
The vfree() here is supposed to release the resources from get_vm_area().
Why do people not use free_vm_area() instead? It feels like we're
freeing "area->addr" but leaking "area" itself but perhaps I have
misunderstood something.
688 alloc->buffer = NULL;
689 err_get_vm_area_failed:
690 err_already_mapped:
691 mutex_unlock(&binder_alloc_mmap_lock);
692 pr_err("%s: %d %lx-%lx %s failed %d\n", __func__,
693 alloc->pid, vma->vm_start, vma->vm_end, failure_string, ret);
694 return ret;
regards,
dan carpenter
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 3/5] android: binder: Move buffer out of area shared with user space Sherry Yang <sherryy@android.com> - 2017-08-23 17:50 +0200 Re: [PATCH v2 3/5] android: binder: Move buffer out of area shared with user space Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-24 22:40 +0200
csiph-web