1. 17 7月, 2017 12 次提交
  2. 02 3月, 2017 2 次提交
  3. 25 2月, 2017 1 次提交
  4. 23 2月, 2017 1 次提交
  5. 10 2月, 2017 8 次提交
    • M
      binder: Add support for file-descriptor arrays · def95c73
      Martijn Coenen 提交于
      This patch introduces a new binder_fd_array object,
      that allows us to support one or more file descriptors
      embedded in a buffer that is scatter-gathered.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      def95c73
    • M
      binder: Add support for scatter-gather · 7980240b
      Martijn Coenen 提交于
      Previously all data passed over binder needed
      to be serialized, with the exception of Binder
      objects and file descriptors.
      
      This patchs adds support for scatter-gathering raw
      memory buffers into a binder transaction, avoiding
      the need to first serialize them into a Parcel.
      
      To remain backwards compatibile with existing
      binder clients, it introduces two new command
      ioctls for this purpose - BC_TRANSACTION_SG and
      BC_REPLY_SG. These commands may only be used with
      the new binder_transaction_data_sg structure,
      which adds a field for the total size of the
      buffers we are scatter-gathering.
      
      Because memory buffers may contain pointers to
      other buffers, we allow callers to specify
      a parent buffer and an offset into it, to indicate
      this is a location pointing to the buffer that
      we are fixing up. The kernel will then take care
      of fixing up the pointer to that buffer as well.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      [jstultz: Fold in small fix from Amit Pundir <amit.pundir@linaro.org>]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7980240b
    • M
      binder: Add extra size to allocator · 4bfac80a
      Martijn Coenen 提交于
      The binder_buffer allocator currently only allocates
      space for the data and offsets buffers of a Parcel.
      This change allows for requesting an additional chunk
      of data in the buffer, which can for example be used
      to hold additional meta-data about the transaction
      (eg a security context).
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4bfac80a
    • M
      binder: Refactor binder_transact() · a056af42
      Martijn Coenen 提交于
      Moved handling of fixup for binder objects,
      handles and file descriptors into separate
      functions.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a056af42
    • M
      binder: Support multiple /dev instances · ac4812c5
      Martijn Coenen 提交于
      Add a new module parameter 'devices', that can be
      used to specify the names of the binder device
      nodes we want to populate in /dev.
      
      Each device node has its own context manager, and
      is therefore logically separated from all the other
      device nodes.
      
      The config option CONFIG_ANDROID_BINDER_DEVICES can
      be used to set the default value of the parameter.
      
      This approach was favored over using IPC namespaces,
      mostly because we require a single process to be a
      part of multiple binder contexts, which seemed harder
      to achieve with namespaces.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      [jstultz: minor checkpatch warning fix]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ac4812c5
    • M
      binder: Deal with contexts in debugfs · 14db3181
      Martijn Coenen 提交于
      Properly print the context in debugfs entries.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      14db3181
    • M
      binder: Support multiple context managers · 342e5c90
      Martijn Coenen 提交于
      Move the context manager state into a separate
      struct context, and allow for each process to have
      its own context associated with it.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      [jstultz: Minor checkpatch fix]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      342e5c90
    • M
      binder: Split flat_binder_object · feba3900
      Martijn Coenen 提交于
      flat_binder_object is used for both handling
      binder objects and file descriptors, even though
      the two are mostly independent. Since we'll
      have more fixup objects in binder in the future,
      instead of extending flat_binder_object again,
      split out file descriptors to their own object
      while retaining backwards compatibility to
      existing user-space clients. All binder objects
      just share a header.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Martijn Coenen <maco@google.com>
      Cc: Arve Hjønnevåg <arve@android.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Serban Constantinescu <serban.constantinescu@arm.com>
      Cc: Dmitry Shmidt <dimitrysh@google.com>
      Cc: Rom Lemarchand <romlem@google.com>
      Cc: Android Kernel Team <kernel-team@android.com>
      Signed-off-by: NMartijn Coenen <maco@google.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      feba3900
  6. 25 10月, 2016 2 次提交
  7. 18 8月, 2016 1 次提交
  8. 15 8月, 2016 2 次提交
    • B
      android: binder: Remove deprecated create_singlethread_workqueue · 1beba52d
      Bhaktipriya Shridhar 提交于
      The workqueue is being used to run deferred work for the android binder.
      
      The "binder_deferred_workqueue" queues only a single work item and hence
      does not require ordering. Also, this workqueue is not being used on a
      memory recliam path. Hence, the singlethreaded workqueue has been
      replaced with the use of system_wq.
      
      System workqueues have been able to handle high level of concurrency
      for a long time now and hence it's not required to have a singlethreaded
      workqueue just to gain concurrency. Unlike a dedicated per-cpu workqueue
      created with create_singlethread_workqueue(), system_wq allows multiple
      work items to overlap executions even on the same CPU; however, a
      per-cpu workqueue doesn't have any CPU locality or global ordering
      guarantee unless the target CPU is explicitly specified and thus the
      increase of local concurrency shouldn't make any difference.
      Signed-off-by: NBhaktipriya Shridhar <bhaktipriya96@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1beba52d
    • J
      android: binder: fix dangling pointer comparison · 7b142d8f
      Jann Horn 提交于
      If /dev/binder is opened and the opener process then e.g. calls execve,
      proc->vma_vm_mm will still point to the location of the now-freed
      mm_struct. If the process then calls ioctl(binder_fd, ...), the dangling
      proc->vma_vm_mm pointer will be compared to current->mm.
      
      Let the binder take a reference to the mm_struct to avoid this.
      
      v2: use the right refcounter
      
      Fixes: a906d693 ("android: binder: Sanity check at binder ioctl")
      Signed-off-by: NJann Horn <jannh@google.com>
      Reviewed-by: NChen Feng <puck.chen@hisilicon.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7b142d8f
  9. 21 2月, 2016 1 次提交
  10. 12 2月, 2016 2 次提交
  11. 08 2月, 2016 1 次提交
  12. 11 9月, 2015 1 次提交
  13. 02 3月, 2015 1 次提交
    • A
      android: binder: fix binder mmap failures · f4c72c70
      Andrey Ryabinin 提交于
      binder_update_page_range() initializes only addr and size
      fields in 'struct vm_struct tmp_area;' and passes it to
      map_vm_area().
      
      Before 71394fe5 ("mm: vmalloc: add flag preventing guard hole allocation")
      this was because map_vm_area() didn't use any other fields
      in vm_struct except addr and size.
      
      Now get_vm_area_size() (used in map_vm_area()) reads vm_struct's
      flags to determine whether vm area has guard hole or not.
      
      binder_update_page_range() don't initialize flags field, so
      this causes following binder mmap failures:
      -----------[ cut here ]------------
      WARNING: CPU: 0 PID: 1971 at mm/vmalloc.c:130
      vmap_page_range_noflush+0x119/0x144()
      CPU: 0 PID: 1971 Comm: healthd Not tainted 4.0.0-rc1-00399-g7da3fdc-dirty #157
      Hardware name: ARM-Versatile Express
      [<c001246d>] (unwind_backtrace) from [<c000f7f9>] (show_stack+0x11/0x14)
      [<c000f7f9>] (show_stack) from [<c049a221>] (dump_stack+0x59/0x7c)
      [<c049a221>] (dump_stack) from [<c001cf21>] (warn_slowpath_common+0x55/0x84)
      [<c001cf21>] (warn_slowpath_common) from [<c001cfe3>]
      (warn_slowpath_null+0x17/0x1c)
      [<c001cfe3>] (warn_slowpath_null) from [<c00c66c5>]
      (vmap_page_range_noflush+0x119/0x144)
      [<c00c66c5>] (vmap_page_range_noflush) from [<c00c716b>] (map_vm_area+0x27/0x48)
      [<c00c716b>] (map_vm_area) from [<c038ddaf>]
      (binder_update_page_range+0x12f/0x27c)
      [<c038ddaf>] (binder_update_page_range) from [<c038e857>]
      (binder_mmap+0xbf/0x1ac)
      [<c038e857>] (binder_mmap) from [<c00c2dc7>] (mmap_region+0x2eb/0x4d4)
      [<c00c2dc7>] (mmap_region) from [<c00c3197>] (do_mmap_pgoff+0x1e7/0x250)
      [<c00c3197>] (do_mmap_pgoff) from [<c00b35b5>] (vm_mmap_pgoff+0x45/0x60)
      [<c00b35b5>] (vm_mmap_pgoff) from [<c00c1f39>] (SyS_mmap_pgoff+0x5d/0x80)
      [<c00c1f39>] (SyS_mmap_pgoff) from [<c000ce81>] (ret_fast_syscall+0x1/0x5c)
      ---[ end trace 48c2c4b9a1349e54 ]---
      binder: 1982: binder_alloc_buf failed to map page at f0e00000 in kernel
      binder: binder_mmap: 1982 b6bde000-b6cdc000 alloc small buf failed -12
      
      Use map_kernel_range_noflush() instead of map_vm_area() as this is better
      API for binder's purposes and it allows to get rid of 'vm_struct tmp_area' at all.
      
      Fixes: 71394fe5 ("mm: vmalloc: add flag preventing guard hole allocation")
      Signed-off-by: NAndrey Ryabinin <a.ryabinin@samsung.com>
      Reported-by: NAmit Pundir <amit.pundir@linaro.org>
      Tested-by: NAmit Pundir <amit.pundir@linaro.org>
      Acked-by: NDavid Rientjes <rientjes@google.com>
      Tested-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4c72c70
  14. 26 1月, 2015 1 次提交
    • S
      Add security hooks to binder and implement the hooks for SELinux. · 79af7307
      Stephen Smalley 提交于
      Add security hooks to the binder and implement the hooks for SELinux.
      The security hooks enable security modules such as SELinux to implement
      controls over binder IPC.  The security hooks include support for
      controlling what process can become the binder context manager
      (binder_set_context_mgr), controlling the ability of a process
      to invoke a binder transaction/IPC to another process (binder_transaction),
      controlling the ability of a process to transfer a binder reference to
      another process (binder_transfer_binder), and controlling the ability
      of a process to transfer an open file to another process (binder_transfer_file).
      
      These hooks have been included in the Android kernel trees since Android 4.3.
      
      (Updated to reflect upstream relocation and changes to the binder driver,
      changes to the LSM audit data structures, coding style cleanups, and
      to add inline documentation for the hooks).
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Acked-by: NNick Kralevich <nnk@google.com>
      Acked-by: NJeffrey Vander Stoep <jeffv@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79af7307
  15. 20 10月, 2014 2 次提交
  16. 09 9月, 2014 2 次提交