20 Sep, 2018

1 commit

  • commit da1b9564e85b1d7baf66cbfabcab27e183a1db63 upstream.

    There is RaceFuzzer report like below because we have no lock to close
    below the race between binder_mmap and binder_alloc_new_buf_locked.
    To close the race, let's use memory barrier so that if someone see
    alloc->vma is not NULL, alloc->vma_vm_mm should be never NULL.

    (I didn't add stable mark intentionallybecause standard android
    userspace libraries that interact with binder (libbinder & libhwbinder)
    prevent the mmap/ioctl race. - from Todd)

    "
    Thread interleaving:
    CPU0 (binder_alloc_mmap_handler) CPU1 (binder_alloc_new_buf_locked)
    ===== =====
    // drivers/android/binder_alloc.c
    // #L718 (v4.18-rc3)
    alloc->vma = vma;
    // drivers/android/binder_alloc.c
    // #L346 (v4.18-rc3)
    if (alloc->vma == NULL) {
    ...
    // alloc->vma is not NULL at this point
    return ERR_PTR(-ESRCH);
    }
    ...
    // #L438
    binder_update_page_range(alloc, 0,
    (void *)PAGE_ALIGN((uintptr_t)buffer->data),
    end_page_addr);

    // In binder_update_page_range() #L218
    // But still alloc->vma_vm_mm is NULL here
    if (need_mm && mmget_not_zero(alloc->vma_vm_mm))
    alloc->vma_vm_mm = vma->vm_mm;

    Crash Log:
    ==================================================================
    BUG: KASAN: null-ptr-deref in __atomic_add_unless include/asm-generic/atomic-instrumented.h:89 [inline]
    BUG: KASAN: null-ptr-deref in atomic_add_unless include/linux/atomic.h:533 [inline]
    BUG: KASAN: null-ptr-deref in mmget_not_zero include/linux/sched/mm.h:75 [inline]
    BUG: KASAN: null-ptr-deref in binder_update_page_range+0xece/0x18e0 drivers/android/binder_alloc.c:218
    Write of size 4 at addr 0000000000000058 by task syz-executor0/11184

    CPU: 1 PID: 11184 Comm: syz-executor0 Not tainted 4.18.0-rc3 #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
    Call Trace:
    __dump_stack lib/dump_stack.c:77 [inline]
    dump_stack+0x16e/0x22c lib/dump_stack.c:113
    kasan_report_error mm/kasan/report.c:352 [inline]
    kasan_report+0x163/0x380 mm/kasan/report.c:412
    check_memory_region_inline mm/kasan/kasan.c:260 [inline]
    check_memory_region+0x140/0x1a0 mm/kasan/kasan.c:267
    kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278
    __atomic_add_unless include/asm-generic/atomic-instrumented.h:89 [inline]
    atomic_add_unless include/linux/atomic.h:533 [inline]
    mmget_not_zero include/linux/sched/mm.h:75 [inline]
    binder_update_page_range+0xece/0x18e0 drivers/android/binder_alloc.c:218
    binder_alloc_new_buf_locked drivers/android/binder_alloc.c:443 [inline]
    binder_alloc_new_buf+0x467/0xc30 drivers/android/binder_alloc.c:513
    binder_transaction+0x125b/0x4fb0 drivers/android/binder.c:2957
    binder_thread_write+0xc08/0x2770 drivers/android/binder.c:3528
    binder_ioctl_write_read.isra.39+0x24f/0x8e0 drivers/android/binder.c:4456
    binder_ioctl+0xa86/0xf34 drivers/android/binder.c:4596
    vfs_ioctl fs/ioctl.c:46 [inline]
    do_vfs_ioctl+0x154/0xd40 fs/ioctl.c:686
    ksys_ioctl+0x94/0xb0 fs/ioctl.c:701
    __do_sys_ioctl fs/ioctl.c:708 [inline]
    __se_sys_ioctl fs/ioctl.c:706 [inline]
    __x64_sys_ioctl+0x43/0x50 fs/ioctl.c:706
    do_syscall_64+0x167/0x4b0 arch/x86/entry/common.c:290
    entry_SYSCALL_64_after_hwframe+0x49/0xbe
    "

    Signed-off-by: Todd Kjos
    Signed-off-by: Minchan Kim
    Reviewed-by: Martijn Coenen
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Minchan Kim
     

02 May, 2018

1 commit

  • commit 7aa135fcf26377f92dc0680a57566b4c7f3e281b upstream.

    This can't happen with normal nodes (because you can't get a ref
    to a node you own), but it could happen with the context manager;
    to make the behavior consistent with regular nodes, reject
    transactions into the context manager by the process owning it.

    Reported-by: syzbot+09e05aba06723a94d43d@syzkaller.appspotmail.com
    Signed-off-by: Martijn Coenen
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     

25 Feb, 2018

4 commits

  • commit 8ca86f1639ec5890d400fff9211aca22d0a392eb upstream.

    The format specifier "%p" can leak kernel addresses. Use
    "%pK" instead. There were 4 remaining cases in binder.c.

    Signed-off-by: Todd Kjos
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     
  • commit f88982679f54f75daa5b8eff3da72508f1e7422f upstream.

    If the kzalloc() in binder_get_thread() fails, binder_poll()
    dereferences the resulting NULL pointer.

    Fix it by returning POLLERR if the memory allocation failed.

    This bug was found by syzkaller using fault injection.

    Reported-by: syzbot
    Fixes: 457b9a6f09f0 ("Staging: android: add binder driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers
    Signed-off-by: Greg Kroah-Hartman

    Eric Biggers
     
  • commit 5eeb2ca02a2f6084fc57ae5c244a38baab07033a upstream.

    To prevent races with ep_remove_waitqueue() removing the
    waitqueue at the same time.

    Reported-by: syzbot+a2a3c4909716e271487e@syzkaller.appspotmail.com
    Signed-off-by: Martijn Coenen
    Cc: stable # 4.14+
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     
  • commit e46a3b3ba7509cb7fda0e07bc7c63a2cd90f579b upstream.

    binder_send_failed_reply() is called when a synchronous
    transaction fails. It reports an error to the thread that
    is waiting for the completion. Given that the transaction
    is synchronous, there should never be more than 1 error
    response to that thread -- this was being asserted with
    a WARN().

    However, when exercising the driver with syzbot tests, cases
    were observed where multiple "synchronous" requests were
    sent without waiting for responses, so it is possible that
    multiple errors would be reported to the thread. This testing
    was conducted with panic_on_warn set which forced the crash.

    This is easily reproduced by sending back-to-back
    "synchronous" transactions without checking for any
    response (eg, set read_size to 0):

    bwr.write_buffer = (uintptr_t)&bc1;
    bwr.write_size = sizeof(bc1);
    bwr.read_buffer = (uintptr_t)&br;
    bwr.read_size = 0;
    ioctl(fd, BINDER_WRITE_READ, &bwr);
    sleep(1);
    bwr2.write_buffer = (uintptr_t)&bc2;
    bwr2.write_size = sizeof(bc2);
    bwr2.read_buffer = (uintptr_t)&br;
    bwr2.read_size = 0;
    ioctl(fd, BINDER_WRITE_READ, &bwr2);
    sleep(1);

    The first transaction is sent to the servicemanager and the reply
    fails because no VMA is set up by this client. After
    binder_send_failed_reply() is called, the BINDER_WORK_RETURN_ERROR
    is sitting on the thread's todo list since the read_size was 0 and
    the client is not waiting for a response.

    The 2nd transaction is sent and the BINDER_WORK_RETURN_ERROR has not
    been consumed, so the thread's reply_error.cmd is still set (normally
    cleared when the BINDER_WORK_RETURN_ERROR is handled). Therefore
    when the servicemanager attempts to reply to the 2nd failed
    transaction, the error is already set and it triggers this warning.

    This is a user error since it is not waiting for the synchronous
    transaction to complete. If it ever does check, it will see an
    error.

    Changed the WARN() to a pr_warn().

    Signed-off-by: Todd Kjos
    Reported-by: syzbot
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     

04 Feb, 2018

2 commits

  • commit aac6830ec1cb681544212838911cdc57f2638216 upstream.

    VM_IOREMAP is used to access hardware through a mechanism called
    I/O mapped memory. Android binder is a IPC machanism which will
    not access I/O memory.

    And VM_IOREMAP has alignment requiement which may not needed in
    binder.
    __get_vm_area_node()
    {
    ...
    if (flags & VM_IOREMAP)
    align = 1ul << clamp_t(int, fls_long(size),
    PAGE_SHIFT, IOREMAP_MAX_ORDER);
    ...
    }

    This patch will save some kernel vm area, especially for 32bit os.

    In 32bit OS, kernel vm area is only 240MB. We may got below
    error when launching a app:

    [ 4482.440053] binder_alloc: binder_alloc_mmap_handler: 15728 8ce67000-8cf65000 get_vm_area failed -12
    [ 4483.218817] binder_alloc: binder_alloc_mmap_handler: 15745 8ce67000-8cf65000 get_vm_area failed -12

    Signed-off-by: Ganesh Mahendran
    Acked-by: Martijn Coenen
    Acked-by: Todd Kjos
    Signed-off-by: Greg Kroah-Hartman

    Ganesh Mahendran
     
  • commit f5cb779ba16334b45ba8946d6bfa6d9834d1527f upstream.

    binder_poll() passes the thread->wait waitqueue that
    can be slept on for work. When a thread that uses
    epoll explicitly exits using BINDER_THREAD_EXIT,
    the waitqueue is freed, but it is never removed
    from the corresponding epoll data structure. When
    the process subsequently exits, the epoll cleanup
    code tries to access the waitlist, which results in
    a use-after-free.

    Prevent this by using POLLFREE when the thread exits.

    Signed-off-by: Martijn Coenen
    Reported-by: syzbot
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     

03 Jan, 2018

1 commit

  • commit 7f3dc0088b98533f17128058fac73cd8b2752ef1 upstream.

    proc->files cleanup is initiated by binder_vma_close. Therefore
    a reference on the binder_proc is not enough to prevent the
    files_struct from being released while the binder_proc still has
    a reference. This can lead to an attempt to dereference the
    stale pointer obtained from proc->files prior to proc->files
    cleanup. This has been seen once in task_get_unused_fd_flags()
    when __alloc_fd() is called with a stale "files".

    The fix is to protect proc->files with a mutex to prevent cleanup
    while in use.

    Signed-off-by: Todd Kjos
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     

10 Dec, 2017

1 commit


02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

21 Oct, 2017

2 commits

  • Don't access next->data in kernel debug message when the
    next buffer is null.

    Acked-by: Arve Hjønnevåg
    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     
  • Use binder_alloc struct's mm_struct rather than getting
    a reference to the mm struct through get_task_mm to
    avoid a potential deadlock between lru lock, task lock and
    dentry lock, since a thread can be holding the task lock
    and the dentry lock while trying to acquire the lru lock.

    Acked-by: Arve Hjønnevåg
    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     

20 Oct, 2017

1 commit

  • Because we're not guaranteed that subsequent calls
    to poll() will have a poll_table_struct parameter
    with _qproc set. When _qproc is not set, poll_wait()
    is a noop, and we won't be woken up correctly.

    Signed-off-by: Martijn Coenen
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     

15 Oct, 2017

1 commit

  • Pull char/misc driver fixes from Greg KH:
    "Here are 4 patches to resolve some char/misc driver issues found these
    past weeks.

    One of them is a mei bugfix and another is a new mei device id. There
    is also a hyper-v fix for a reported issue, and a binder issue fix for
    a problem reported by a few people.

    All of these have been in my tree for a while, I don't know if
    linux-next is really testing much this month. But 0-day is happy with
    them :)"

    * tag 'char-misc-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
    binder: fix use-after-free in binder_transaction()
    Drivers: hv: vmbus: Fix bugs in rescind handling
    mei: me: add gemini lake devices id
    mei: always use domain runtime pm callbacks.

    Linus Torvalds
     

04 Oct, 2017

2 commits

  • User-space normally keeps the node alive when creating a transaction
    since it has a reference to the target. The local strong ref keeps it
    alive if the sending process dies before the target process processes
    the transaction. If the source process is malicious or has a reference
    counting bug, this can fail.

    In this case, when we attempt to decrement the node in the failure
    path, the node has already been freed.

    This is fixed by taking a tmpref on the node while constructing
    the transaction. To avoid re-acquiring the node lock and inner
    proc lock to increment the proc's tmpref, a helper is used that
    does the ref increments on both the node and proc.

    Signed-off-by: Todd Kjos
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     
  • Drop the global lru lock in isolate callback before calling
    zap_page_range which calls cond_resched, and re-acquire the global lru
    lock before returning. Also change return code to LRU_REMOVED_RETRY.

    Use mmput_async when fail to acquire mmap sem in an atomic context.

    Fix "BUG: sleeping function called from invalid context"
    errors when CONFIG_DEBUG_ATOMIC_SLEEP is enabled.

    Also restore mmput_async, which was initially introduced in commit
    ec8d7c14ea14 ("mm, oom_reaper: do not mmput synchronously from the oom
    reaper context"), and was removed in commit 212925802454 ("mm: oom: let
    oom_reap_task and exit_mmap run concurrently").

    Link: http://lkml.kernel.org/r/20170914182231.90908-1-sherryy@android.com
    Fixes: f2517eb76f1f2 ("android: binder: Add global lru shrinker to binder")
    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman
    Reported-by: Kyle Yan
    Acked-by: Arve Hjønnevåg
    Acked-by: Michal Hocko
    Cc: Martijn Coenen
    Cc: Todd Kjos
    Cc: Riley Andrews
    Cc: Ingo Molnar
    Cc: Vlastimil Babka
    Cc: Hillf Danton
    Cc: Peter Zijlstra
    Cc: Andrea Arcangeli
    Cc: Thomas Gleixner
    Cc: Andy Lutomirski
    Cc: Oleg Nesterov
    Cc: Hoeun Ryu
    Cc: Christopher Lameter
    Cc: Vegard Nossum
    Cc: Frederic Weisbecker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sherry Yang
     

18 Sep, 2017

3 commits

  • commit 7a4408c6bd3e ("binder: make sure accesses to proc/thread are
    safe") made a change to enqueue tcomplete to thread->todo before
    enqueuing the transaction. However, in err_dead_proc_or_thread case,
    the tcomplete is directly freed, without dequeued. It may cause the
    thread->todo list to be corrupted.

    So, dequeue it before freeing.

    Fixes: 7a4408c6bd3e ("binder: make sure accesses to proc/thread are safe")
    Signed-off-by: Xu YiPing
    Signed-off-by: Todd Kjos
    Signed-off-by: Greg Kroah-Hartman

    Xu YiPing
     
  • commit 372e3147df70 ("binder: guarantee txn complete / errors delivered
    in-order") incorrectly defined a local ret value. This ret value will
    be invalid when out of the if block

    Fixes: 372e3147df70 ("binder: refactor binder ref inc/dec for thread safety")
    Signed-off-by: Xu YiPing
    Signed-off-by: Todd Kjos
    Signed-off-by: Greg Kroah-Hartman

    Xu YiPing
     
  • Allowing binder to expose the 64-bit API on 32-bit kernels caused a
    build warning:

    drivers/android/binder.c: In function 'binder_transaction_buffer_release':
    drivers/android/binder.c:2220:15: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    fd_array = (u32 *)(parent_buffer + fda->parent_offset);
    ^
    drivers/android/binder.c: In function 'binder_translate_fd_array':
    drivers/android/binder.c:2445:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
    fd_array = (u32 *)(parent_buffer + fda->parent_offset);
    ^
    drivers/android/binder.c: In function 'binder_fixup_parent':
    drivers/android/binder.c:2511:18: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

    This adds extra type casts to avoid the warning.

    However, there is another problem with the Kconfig option: turning
    it on or off creates two incompatible ABI versions, a kernel that
    has this enabled cannot run user space that was built without it
    or vice versa. A better solution might be to leave the option hidden
    until the binder code is fixed to deal with both ABI versions.

    Fixes: e8d2ed7db7c3 ("Revert "staging: Fix build issues with new binder API"")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

01 Sep, 2017

8 commits

  • This can cause issues with processes using the poll()
    interface:

    1) client sends two oneway transactions
    2) the second one gets queued on async_todo
    (because the server didn't handle the first one
    yet)
    3) server returns from poll(), picks up the
    first transaction and does transaction work
    4) server is done with the transaction, sends
    BC_FREE_BUFFER, and the second transaction gets
    moved to thread->todo
    5) libbinder's handlePolledCommands() only handles
    the commands in the current data buffer, so
    doesn't see the new transaction
    6) the server continues running and issues a new
    outgoing transaction. Now, it suddenly finds
    the incoming oneway transaction on its thread
    todo, and returns that to userspace.
    7) userspace does not expect this to happen; it
    may be holding a lock while making the outgoing
    transaction, and if handling the incoming
    trasnaction requires taking the same lock,
    userspace will deadlock.

    By queueing the async transaction to the proc
    workqueue, we make sure it's only picked up when
    a thread is ready for proc work.

    Signed-off-by: Martijn Coenen
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     
  • This allows userspace to request death notifications without
    having to worry about getting an immediate callback on the same
    thread; one scenario where this would be problematic is if the
    death recipient handler grabs a lock that was already taken
    earlier (eg as part of a nested transaction).

    Signed-off-by: Martijn Coenen
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     
  • Because is_spin_locked() always returns false on UP
    systems.

    Use assert_spin_locked() instead, and remove the
    WARN_ON() instances, since those were easy to verify.

    Signed-off-by: Martijn Coenen
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     
  • The BINDER_GET_NODE_DEBUG_INFO ioctl will return debug info on
    a node. Each successive call reusing the previous return value
    will return the next node. The data will be used by
    libmemunreachable to mark the pointers with kernel references
    as reachable.

    Signed-off-by: Colin Cross
    Signed-off-by: Martijn Coenen
    Signed-off-by: Greg Kroah-Hartman

    Colin Cross
     
  • Instead of pushing new transactions to the process
    waitqueue, select a thread that is waiting on proc
    work to handle the transaction. This will make it
    easier to improve priority inheritance in future
    patches, by setting the priority before we wake up
    a thread.

    If we can't find a waiting thread, submit the work
    to the proc waitqueue instead as we did previously.

    Signed-off-by: Martijn Coenen
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     
  • Removes the process waitqueue, so that threads
    can only wait on the thread waitqueue. Whenever
    there is process work to do, pick a thread and
    wake it up. Having the caller pick a thread is
    helpful for things like priority inheritance.

    This also fixes an issue with using epoll(),
    since we no longer have to block on different
    waitqueues.

    Signed-off-by: Martijn Coenen
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     
  • Add the number of active, lru, and free pages for
    each binder process in binder stats

    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     
  • Fix crash introduced by 74310e06be4d74dcf67cd108366710dee5c576d5
    (android: binder: Move buffer out of area shared with user space)
    when close is called after open without mmap in between.

    Reported-by: kernel test robot
    Fixes: 74310e06be4d ("android: binder: Move buffer out of area shared with user space")
    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     

28 Aug, 2017

6 commits

  • Add tracepoints in binder transaction allocator to
    record lru hits and alloc/free page.

    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     
  • Hold on to the pages allocated and mapped for transaction
    buffers until the system is under memory pressure. When
    that happens, use linux shrinker to free pages. Without
    using shrinker, patch "android: binder: Move buffer out
    of area shared with user space" will cause a significant
    slow down for small transactions that fit into the first
    page because free list buffer header used to be inlined
    with buffer data.

    In addition to prevent the performance regression for
    small transactions, this patch improves the performance
    for transactions that take up more than one page.

    Modify alloc selftest to work with the shrinker change.

    Test: Run memory intensive applications (Chrome and Camera)
    to trigger shrinker callbacks. Binder frees memory as expected.
    Test: Run binderThroughputTest with high memory pressure
    option enabled.

    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     
  • 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.

    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     
  • binder_alloc_selftest tests that alloc_new_buf handles page allocation and
    deallocation properly when allocate and free buffers. The test allocates 5
    buffers of various sizes to cover all possible page alignment cases, and
    frees the buffers using a list of exhaustive freeing order.

    Test: boot the device with ANDROID_BINDER_IPC_SELFTEST config option
    enabled. Allocator selftest passes.

    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     
  • Use helper functions buffer_next and buffer_prev instead
    of list_entry to get the next and previous buffers.

    Signed-off-by: Sherry Yang
    Signed-off-by: Greg Kroah-Hartman

    Sherry Yang
     
  • This reverts commit d0bdff0db809 ("staging: Fix build issues with new
    binder API"), because commit e38361d032f1 ("ARM: 8091/2: add get_user()
    support for 8 byte types") has added the 64bit __get_user_asm_*
    implementation.

    Signed-off-by: Jisheng Zhang
    Signed-off-by: Greg Kroah-Hartman

    Jisheng Zhang
     

23 Aug, 2017

3 commits

  • commit 26549d177410 ("binder: guarantee txn complete / errors delivered
    in-order") passed the locally declared and undefined cmd
    to binder_stat_br() which results in a bogus cmd field in a trace
    event and BR stats are incremented incorrectly.

    Change to use e->cmd which has been initialized.

    Signed-off-by: Todd Kjos
    Reported-by: Dan Carpenter
    Fixes: 26549d177410 ("binder: guarantee txn complete / errors delivered in-order")
    Signed-off-by: Greg Kroah-Hartman

    Todd Kjos
     
  • On binder_init() the devices string is duplicated and smashed into individual
    device names which are passed along. However, the original duplicated string
    wasn't freed in case binder_init() failed. Let's free it on error.

    Signed-off-by: Christian Brauner
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Christian Brauner
     
  • These will be required going forward.

    Signed-off-by: Martijn Coenen
    Cc: stable # 4.11+
    Signed-off-by: Greg Kroah-Hartman

    Martijn Coenen
     

17 Jul, 2017

3 commits