Re: [PATCH] binder: make sure fd closes complete

2021-08-31 Thread Martijn Coenen
eturn to userspace or the file object may never be > dereferenced -- which can lead to hung processes. > > Force the binder thread back to userspace if an fd is closed during > BC_FREE_BUFFER handling. > > Signed-off-by: Todd Kjos Reviewed-by: Martijn Coen

Re: [PATCH -next] binder: change error code from postive to negative in binder_transaction

2020-10-27 Thread Martijn Coenen
Thanks! On Mon, Oct 26, 2020 at 11:52 AM Zhang Qilong wrote: > > Depending on the context, the error return value > here (extra_buffers_size < added_size) should be > negative. > > Signed-off-by: Zhang Qilong Acked-by: Martijn Coenen > --- > drivers/android/binder

Re: [PATCH v3 -next] binder: simplify the return expression of binder_mmap

2020-10-02 Thread Martijn Coenen
Thanks! On Tue, Sep 29, 2020 at 3:30 AM Liu Shixin wrote: > > Simplify the return expression. > > Signed-off-by: Liu Shixin Acked-by: Martijn Coenen > --- > v3: Add the change description. > v2: Get rid of the "ret" and "failure string" variab

[PATCH v3] binder: print warnings when detecting oneway spamming.

2020-08-21 Thread Martijn Coenen
-off-by: Martijn Coenen --- v2: fixed call-site in binder_alloc_selftest v3: include size of struct binder_buffer in calculation, fix comments drivers/android/binder.c| 2 +- drivers/android/binder_alloc.c | 55 +++-- drivers/android/binder_alloc.h

[PATCH v2] ANDROID: binder: print warnings when detecting oneway spamming.

2020-08-20 Thread Martijn Coenen
-off-by: Martijn Coenen --- v2: fixed call-site in binder_alloc_selftest drivers/android/binder.c| 2 +- drivers/android/binder_alloc.c | 49 +++-- drivers/android/binder_alloc.h | 5 ++- drivers/android/binder_alloc_selftest.c | 2 +- 4

Re: [PATCH] binder: print warnings when detecting oneway spamming.

2020-08-20 Thread Martijn Coenen
t tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: > https://github.com/0day-ci/linux/commits/Martijn-Coenen/binder-print-warnings-when-detecting-oneway-spamming

[PATCH] binder: print warnings when detecting oneway spamming.

2020-08-20 Thread Martijn Coenen
-off-by: Martijn Coenen --- drivers/android/binder.c | 2 +- drivers/android/binder_alloc.c | 49 +++--- drivers/android/binder_alloc.h | 5 +++- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c

Re: [PATCH] binder: Modify comments

2020-08-18 Thread Martijn Coenen
On Tue, Aug 18, 2020 at 3:34 AM hui yang wrote: > > From: YangHui > > The function name should is binder_alloc_new_buf() > Reviewed-by: Martijn Coenen > Signed-off-by: YangHui > --- > drivers/android/binder_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 d

Re: [PATCH v2] binder: Prevent context manager from incrementing ref 0

2020-07-28 Thread Martijn Coenen
Thanks a lot for the detailed explanation, I understood now. Martijn On Tue, Jul 28, 2020 at 4:50 PM Jann Horn wrote: > > On Tue, Jul 28, 2020 at 3:50 PM Martijn Coenen wrote: > > On Mon, Jul 27, 2020 at 2:04 PM Jann Horn wrote: > > > - task B opens /dev/binder once,

Re: [PATCH v2] binder: Prevent context manager from incrementing ref 0

2020-07-28 Thread Martijn Coenen
anager to do > that. > > Additionally, print a warning if someone manages to find another way to > trigger a transaction-to-self bug in the future. > > Cc: sta...@vger.kernel.org > Fixes: 457b9a6f09f0 ("Staging: android: add binder driver") > Acked-by: Todd Kjos Rev

[PATCH] binder: Set end of SG buffer area properly.

2019-07-09 Thread Martijn Coenen
: ec74136ded79 ("binder: create node flag to request sender's security context") Signed-off-by: Martijn Coenen Cc: sta...@vger.kernel.org # 5.1+ --- drivers/android/binder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/android/binder.c b/drivers/android

[PATCH v2] ANDROID: binder: Add BINDER_GET_NODE_INFO_FOR_REF ioctl.

2018-09-07 Thread Martijn Coenen
information can then be passed on to the process holding the node, which can in turn decide whether it wants to shut down to reduce resource usage. Signed-off-by: Martijn Coenen --- v2: made sure reserved fields are aligned, and enforce caller zeroes all fields except handle, as suggested by Dan

Re: [PATCH] ANDROID: binder: Latelimit binder_debug().

2018-09-07 Thread Martijn Coenen
> Any progress on this problem? A patch was recently submitted to address this: https://lkml.org/lkml/2018/8/7/802 > >> >>> Without disabling by default or latelimit printk(), the system shall become >>> unusable. >>> >>> $ grep binder: log | wc -l >>> 13214 >>> $ head log >>> [ 1167.389978] bi

Re: [PATCH] ANDROID: binder: Add BINDER_GET_NODE_INFO_FOR_REF ioctl.

2018-09-05 Thread Martijn Coenen
On Wed, Sep 5, 2018 at 11:09 AM, Dan Carpenter wrote: > What's the reserved for? On 64 bit systems there is a 4 byte struct > hole between weak_count and reserved. There's many more pieces of information that we hold for a node. While we don't have a use for most of that now, we may want some of

[PATCH] ANDROID: binder: Add BINDER_GET_NODE_INFO_FOR_REF ioctl.

2018-09-05 Thread Martijn Coenen
information can then be passed on to the process holding the node, which can in turn decide whether it wants to shut down to reduce resource usage. Signed-off-by: Martijn Coenen --- drivers/android/binder.c| 50 + include/uapi/linux/android/binder.h | 8

Re: KASAN: null-ptr-deref Write in binder_update_page_range

2018-08-27 Thread Martijn Coenen
Thanks Minchan! On Thu, Aug 23, 2018 at 7:29 AM, Minchan Kim wrote: > Signed-off-by: Todd Kjos > Signed-off-by: Minchan Kim Reviewed-by: Martijn Coenen > --- > drivers/android/binder_alloc.c | 43 +++--- > 1 file changed, 35 insertions(+), 8 deleti

Re: [PATCH] android: binder: no outgoing transaction when thread todo has transaction

2018-08-13 Thread Martijn Coenen
threads that are waiting for proc work can directly > receive work from another thread, and no work is allowed to be queued > on such a thread without waking up the thread. This patch also enforces > that a thread is not waiting for proc work when a work is directly > enqueued to its to

Re: [PATCH] ANDROID: binder: Latelimit binder_debug().

2018-07-10 Thread Martijn Coenen
On Tue, Jul 10, 2018 at 2:09 PM, Tetsuo Handa wrote: > I don't have benchmark data (I'm not an Android user). But an example log at > https://syzkaller.appspot.com/text?tag=CrashLog&x=12f316fc40 got > about 13214 messages in 124 seconds (over 100 messages per a second). I meant data for the c

Re: [PATCH] ANDROID: binder: Latelimit binder_debug().

2018-07-09 Thread Martijn Coenen
On Mon, Jul 9, 2018 at 3:27 PM, Dmitry Vyukov wrote: > I know almost nothing about binder. How these debug messages are > enabled? I don't see anything like CONFIG_BINDER_VERBOSE_DEBUG in the > config: > https://github.com/google/syzkaller/blob/master/dashboard/config/upstream-kasan.config > Also

Re: [PATCH] ANDROID: binder: Latelimit binder_debug().

2018-07-09 Thread Martijn Coenen
On Mon, Jul 9, 2018 at 3:10 AM, Tetsuo Handa wrote: > While at it, let's add cond_resched() to binder_thread_write(), > binder_transaction() and binder_release_work() loops because they might > take long time. This should be a separate patch, and I would love to see some benchmark data around thi

Re: [PATCH] staging: android/vsoc: stop using 'timespec'

2018-06-22 Thread Martijn Coenen
On Mon, Jun 18, 2018 at 5:09 PM, Arnd Bergmann wrote: > The timespec structure suffers from the y2038 overflow and should not > be used. This changes handle_vsoc_cond_wait() to use ktime_t directly. > > Signed-off-by: Arnd Bergmann Reviewed-by: Martijn Coenen Thanks! > --- >

Re: [PATCH 2/2 v2] staging: android: ashmem: Fix mmap size validation

2018-06-22 Thread Martijn Coenen
hmem as well. Since its size is fixed after creation, preventing anyone from mapping a larger size seems reasonable to me. Reviewed-by: Martijn Coenen > > thanks! > > - Joel > ___ devel mailing list de...@linuxdriverproject.org http:

Re: [PATCH] ANDROID: binder: remove 32-bit binder interface.

2018-05-14 Thread Martijn Coenen
On Mon, May 14, 2018 at 4:00 PM, Geert Uytterhoeven wrote: > Patch sent. Thanks for the quick turn-around! > > BTW, sh also doesn't seem to have 64-bit get_user(). > There may be others. I checked quickly, nios2 is the only other arch that explicitly doesn't support it and would result in a bui

[PATCH v2] ANDROID: binder: remove 32-bit binder interface.

2018-05-11 Thread Martijn Coenen
From: Martijn Coenen New devices launching with Android P need to use the 64-bit binder interface, even on 32-bit SoCs [0]. This change removes the Kconfig option to select the 32-bit binder interface. We don't think this will affect existing userspace for the following reasons: 1) The l

Re: [PATCH] ANDROID: binder: remove 32-bit binder interface.

2018-05-11 Thread Martijn Coenen
On Fri, May 11, 2018 at 10:08 AM, Greg KH wrote: > I think using !CONFIG_M68K is a good start. We can blacklist any other > arch that doesn't support this, and that list should be small as I doubt > any new ones will be added without this support. Thanks, I will send a v2. > > thanks, > > greg

Re: [PATCH] ANDROID: binder: remove 32-bit binder interface.

2018-05-11 Thread Martijn Coenen
On Sat, May 5, 2018 at 2:10 PM, kbuild test robot wrote: >drivers/android/binder.o: In function `binder_thread_write': >>> binder.c:(.text+0x6a16): undefined reference to `__get_user_bad' Looks like m68k doesn't support 64-bit get_user(). I could just have binder depend on !CONFIG_M68K, but t

Re: [PATCH] android: binder: Fix a possible data race in binder_alloc_mmap_handler

2018-05-08 Thread Martijn Coenen
On Tue, May 8, 2018 at 2:06 AM, Jia-Ju Bai wrote: > The write operations to "alloc->buffer" are protected by > the lock on line 679 and 730, but the read operation to > this data on line 712 is not protected by the lock. > Thus, there may exist a data race for "alloc->buffer". It's read by the sa

[PATCH] ANDROID: binder: remove 32-bit binder interface.

2018-05-04 Thread Martijn Coenen
tains 32-bit support for devices that are upgrading. This will be removed as well in 2-3 years, at which point we can remove the code from the UAPI as well. [0]: https://android-review.googlesource.com/c/platform/build/+/595193 Signed-off-by: Martijn Coenen --- drivers/android/Kconfig | 13 ---

Re: [PATCH v3 2/5] efi: Add embedded peripheral firmware support

2018-05-04 Thread Martijn Coenen
On Wed, Apr 25, 2018 at 10:55 AM, Luis R. Rodriguez wrote: > Android became the primary user of CONFIG_FW_LOADER_USER_HELPER_FALLBACK. > > It would be good for us to hear from Android folks if their current use of > request_firmware_into_buf() is designed in practice to *never* use the direct > fi

Re: [PATCH v3 2/5] efi: Add embedded peripheral firmware support

2018-05-04 Thread Martijn Coenen
On Thu, May 3, 2018 at 5:21 PM, Luis R. Rodriguez wrote: > Android folks, poke below. otherwise we'll have no option but to seriously > consider Mimi's patch to prevent these calls when IMA appraisal is enforced: Sorry, figuring out who's the right person to answer this, will get back to you ASAP

Re: [PATCH] ANDROID: binder: fix binder work return error is wrongly consumed

2018-05-03 Thread Martijn Coenen
On Wed, May 2, 2018 at 7:30 AM, wrote: > But there is potential risks in the future, future functional extensions > need to consider nesting issues, maybe extending more methods where we > push to thread->todo. I think that using queueing return error transaction > to the head of thread todo list

Re: KASAN: use-after-free Read in binder_release_work

2018-04-23 Thread Martijn Coenen
On Mon, Apr 23, 2018 at 12:17 PM, Dmitry Vyukov wrote: > syzbot does not extract this info from patch emails. Ok so IIUC, Reported-By tags will only be considered when they are actually part of commits in one of the tested trees - makes sense. So does sending "#syz fix: xyz" cause syzbot to look

Re: KASAN: use-after-free Read in binder_release_work

2018-04-23 Thread Martijn Coenen
On Mon, Apr 23, 2018 at 11:49 AM, Dmitry Vyukov wrote: > Since it's already in Greg's queue, it's not worth bothering. We can > fix up things here with these "#syz fix" tags in emails, which > associate fixes with bugs. I meant, when I sent the original patch a month or so ago, could syzbot have

Re: KASAN: use-after-free Read in binder_release_work

2018-04-23 Thread Martijn Coenen
On Mon, Apr 23, 2018 at 11:28 AM, Dmitry Vyukov wrote: > https://syzkaller.appspot.com/bug?extid=09e05aba06723a94d43d > and that happened in binder. But then syzkaller found a reproducer for > it, but it turned out to be in rdma subsystem. It's generally not > possible to properly distinguish diff

Re: KASAN: use-after-free Read in binder_release_work

2018-04-23 Thread Martijn Coenen
On Thu, Apr 19, 2018 at 11:35 PM, Eric Biggers wrote: > Martijn, this is going to be fixed by > https://patchwork.kernel.org/patch/10312345/ > ("ANDROID: binder: prevent transactions into own process"), right? > The syzbot bug ID in that patch is for a bug that is already closed, > so if it's not

Re: [PATCH v2] ANDROID: binder: prevent transactions into own process.

2018-04-23 Thread Martijn Coenen
On Wed, Mar 28, 2018 at 1:34 PM, Martijn Coenen wrote: > On Wed, Mar 28, 2018 at 1:28 PM, Greg KH wrote: >> What is different from "v2" you sent before this? No change information >> from v1? Greg, is this in your queue, or should I just send a v3 to clean this up?

Re: [PATCH] ANDROID: binder: re-order some conditions

2018-03-29 Thread Martijn Coenen
than "sizeo(*hdr)" then that means "offset" can be more than > "buffer->data_size". It's just cleaner to check it in the other order. > > Signed-off-by: Dan Carpenter Acked-by: Martijn Coenen > > diff --git a/drivers/android/binder.c b/dri

Re: [PATCH] ANDROID: binder: prevent transactions into own process.

2018-03-28 Thread Martijn Coenen
On Wed, Mar 28, 2018 at 1:29 PM, Greg KH wrote: > I can mark it for stable, and then when you get the "this did not apply > to this tree" email, you can send a backported patch to me so I know to > take that one then. Ack, thanks. > > thanks, > > greg k-h

Re: [PATCH v2] ANDROID: binder: prevent transactions into own process.

2018-03-28 Thread Martijn Coenen
On Wed, Mar 28, 2018 at 1:28 PM, Greg KH wrote: > What is different from "v2" you sent before this? No change information > from v1? Sorry I messed this up - the first resend did not have "v2" in the subject but did contain v2 change information, the second resend had the v2 subject and did not

[PATCH v2] ANDROID: binder: prevent transactions into own process.

2018-03-28 Thread Martijn Coenen
a06723a94d...@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 764b63a5aade..e578eee31589 100644 --- a/drivers/android/binder.c +++ b/drivers/androi

[v2] ANDROID: binder: prevent transactions into own process.

2018-03-28 Thread Martijn Coenen
a06723a94d...@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen --- Changed in v2: - Use target_proc directly to avoid dereference. drivers/android/binder.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 764b63a5aade..e5

Re: [PATCH] ANDROID: binder: prevent transactions into own process.

2018-03-28 Thread Martijn Coenen
On Wed, Mar 28, 2018 at 10:19 AM, Greg KH wrote: > Does this need to go to older kernels as well? Yes, this should apply cleanly to 4.14 as well. It won't apply to pre-4.14 kernels because of the fine-grained locking changes, but the same issue exists there and I suspect it would cause the same c

[PATCH] ANDROID: binder: prevent transactions into own process.

2018-03-28 Thread Martijn Coenen
a06723a94d...@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index e7e4560e4c6e..57d4ba926ed0 100644 --- a/drivers/android/binder.c +++ b/drivers/androi

Re: KASAN: use-after-free Read in __list_del_entry_valid (3)

2018-03-06 Thread Martijn Coenen
On Tue, Mar 6, 2018 at 9:30 AM, syzbot wrote: > Hello, > > syzbot hit the following crash on upstream commit > 094b58e1040a44f991d7ab628035e69c4d6b79c9 (Mon Mar 5 19:57:06 2018 +) > Merge tag 'linux-kselftest-4.16-rc5' of > git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest I

Re: [PATCH] ANDROID: binder: synchronize_rcu() when using POLLFREE.

2018-02-16 Thread Martijn Coenen
Greg, This is for 4.14 LTS and 4.16. Thanks, Martijn On Fri, Feb 16, 2018 at 9:47 AM, Martijn Coenen wrote: > To prevent races with ep_remove_waitqueue() removing the > waitqueue at the same time. > > Reported-by: syzbot+a2a3c4909716e2714...@syzkaller.appspotmail.com > Signed-

[PATCH] ANDROID: binder: synchronize_rcu() when using POLLFREE.

2018-02-16 Thread Martijn Coenen
To prevent races with ep_remove_waitqueue() removing the waitqueue at the same time. Reported-by: syzbot+a2a3c4909716e2714...@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/android

Re: KASAN: use-after-free Read in remove_wait_queue

2018-02-12 Thread Martijn Coenen
On Mon, Feb 12, 2018 at 7:31 PM, Al Viro wrote: > Any chance of bisecting it? Perhaps my fix introduced another (related) problem, I'm looking into it. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/l

Re: [PATCH] ANDROID: binder: remove waitqueue when thread exits.

2018-01-05 Thread Martijn Coenen
On Fri, Jan 5, 2018 at 1:20 PM, Greg KH wrote: > Should this be a 4.15-final thing, as well as backported to any range of > older kernels? This was found by syzkaller and wouldn't be hit in normal code paths, so I think it's not critical for 4.15. This code was introduced in 4.14, so it should be

[PATCH] ANDROID: binder: remove waitqueue when thread exits.

2018-01-05 Thread Martijn Coenen
oll 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 --- drivers/android/binder.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/android/binde

[PATCH] ANDROID: binder: Remove obsolete proc waitqueue.

2018-01-04 Thread Martijn Coenen
It was no longer being used. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 778caed570c6..06067636 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c

[PATCH v2] MAINTAINERS: update Android driver maintainers.

2017-12-05 Thread Martijn Coenen
Add Todd Kjos and myself, remove Riley (who no longer works at Google). Signed-off-by: Martijn Coenen --- Changes in v2: adds commit message. MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index aa71ab52fd76..da8264fc09d4 100644

[PATCH] MAINTAINERS: update Android driver maintainers.

2017-12-05 Thread Martijn Coenen
Signed-off-by: Martijn Coenen --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index aa71ab52fd76..da8264fc09d4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -859,7 +859,8 @@ F: kernel/configs/android* ANDROID DRIVERS M: Greg

Re: [PATCH v3 1/6] ANDROID: binder: add support for RT prio inheritance.

2017-11-17 Thread Martijn Coenen
On Thu, Nov 16, 2017 at 4:10 PM, Peter Zijlstra wrote: > Well, I go by the one described in all the real-time computing texts; > also found on Wikipedia FWIW: > > https://en.wikipedia.org/wiki/Priority_inheritance Guess I was taking inheritance too literally :-) > >> This behavior is also rela

Re: [PATCH v3 1/6] ANDROID: binder: add support for RT prio inheritance.

2017-11-16 Thread Martijn Coenen
On Thu, Nov 16, 2017 at 12:27 PM, Peter Zijlstra wrote: >> On Wed, Nov 15, 2017 at 2:01 PM, Peter Zijlstra wrote: >> >> + * 1) binder supports a "minimum node priority", meaning that all >> >> transactions >> >> + *into a node must run at this priority at a minimum. This means >> >> that th

Re: [PATCH v3 2/6] ANDROID: binder: add min sched_policy to node.

2017-11-16 Thread Martijn Coenen
On Wed, Nov 15, 2017 at 2:02 PM, Peter Zijlstra wrote: >> Internally, we use the priority map that the kernel >> uses, e.g. [0..99] for real-time policies and [100..139] >> for the SCHED_NORMAL/SCHED_BATCH policies. > > I will break that without consideration if I have to. That really isn't > some

Re: [PATCH v3 4/6] ANDROID: binder: add RT inheritance flag to node.

2017-11-16 Thread Martijn Coenen
On Wed, Nov 15, 2017 at 2:05 PM, Peter Zijlstra wrote: > On Thu, Oct 26, 2017 at 04:07:48PM +0200, Martijn Coenen wrote: >> Allows a binder node to specify whether it wants to >> inherit real-time scheduling policy from a caller. This >> inheritance may not always be desi

Re: [PATCH v3 3/6] ANDROID: binder: improve priority inheritance.

2017-11-16 Thread Martijn Coenen
On Wed, Nov 15, 2017 at 2:03 PM, Peter Zijlstra wrote: > On Thu, Oct 26, 2017 at 04:07:47PM +0200, Martijn Coenen wrote: >> By raising the priority of a thread selected for >> a transaction *before* we wake it up. >> >> Delay restoring the priority when doing a reply &g

Re: [PATCH v3 1/6] ANDROID: binder: add support for RT prio inheritance.

2017-11-16 Thread Martijn Coenen
Thanks Peter for looking at this, more inline. On Wed, Nov 15, 2017 at 2:01 PM, Peter Zijlstra wrote: >> + * 1) binder supports a "minimum node priority", meaning that all >> transactions >> + *into a node must run at this priority at a minimum. This means that >> the >> + *desired prio

[PATCH] ANDROID: binder: Add thread->process_todo flag.

2017-11-15 Thread Martijn Coenen
40411 BM_sendVec_binderize/1024 43119 ns 17357 ns 40432 Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 151 +-- 1 file changed, 107 insertions(+), 44 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder

Re: [PATCH] ANDROID: binder: show high watermark of alloc->pages.

2017-11-13 Thread Martijn Coenen
On Mon, Nov 13, 2017 at 10:49 AM, Greg KH wrote: > Who can use this? A userspace tool? Or something else? The output is part of Android bugreports, it's not parsed automatically but the information is very useful even to manually look at. Since Treble, we have more processes using binder, and s

Re: [PATCH] ANDROID: binder: fix transaction leak.

2017-11-13 Thread Martijn Coenen
On Mon, Nov 13, 2017 at 10:49 AM, Greg KH wrote: > Is this relevant for 4.14 and any older kernels as well? The problem was introduced with fine-grained locking, which is 4.14 and up only. Thanks, Martijn ___ devel mailing list de...@linuxdriverproject

[PATCH] ANDROID: binder: show high watermark of alloc->pages.

2017-11-13 Thread Martijn Coenen
Show the high watermark of the index into the alloc->pages array, to facilitate sizing the buffer on a per-process basis. Signed-off-by: Martijn Coenen --- drivers/android/binder_alloc.c | 4 drivers/android/binder_alloc.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/driv

[PATCH] ANDROID: binder: fix transaction leak.

2017-11-13 Thread Martijn Coenen
If a call to put_user() fails, we failed to properly free a transaction and send a failed reply (if necessary). Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 40 +++- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers

[PATCH v3 6/6] ANDROID: binder: Add tracing for binder priority inheritance.

2017-10-26 Thread Martijn Coenen
This allows to easily trace and visualize priority inheritance in the binder driver. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 4 drivers/android/binder_trace.h | 24 2 files changed, 28 insertions(+) diff --git a/drivers/android/binder.c

[PATCH v3 4/6] ANDROID: binder: add RT inheritance flag to node.

2017-10-26 Thread Martijn Coenen
Allows a binder node to specify whether it wants to inherit real-time scheduling policy from a caller. This inheritance may not always be desirable, for example in cases where the binder call runs untrusted and therefore potentially unbounded code. Signed-off-by: Martijn Coenen --- drivers

[PATCH v3 5/6] ANDROID: binder: don't check prio permissions on restore.

2017-10-26 Thread Martijn Coenen
apply CAP_SYS_NICE or RLIMIT_RT_PRIO, for now it seems reasonable to not check permissions on the restore path. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/android/binder.c b/dr

[PATCH v3 3/6] ANDROID: binder: improve priority inheritance.

2017-10-26 Thread Martijn Coenen
By raising the priority of a thread selected for a transaction *before* we wake it up. Delay restoring the priority when doing a reply until after we wake-up the process receiving the reply. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 74

[PATCH v3 2/6] ANDROID: binder: add min sched_policy to node.

2017-10-26 Thread Martijn Coenen
] for the SCHED_NORMAL/SCHED_BATCH policies. Signed-off-by: Martijn Coenen --- drivers/android/binder.c| 28 + include/uapi/linux/android/binder.h | 41 - 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/drivers

[PATCH v3 0/6] ANDROID: binder: RT priority inheritance

2017-10-26 Thread Martijn Coenen
ers and are merged in Android's common kernel trees. Martijn Coenen (6): ANDROID: binder: add support for RT prio inheritance. ANDROID: binder: add min sched_policy to node. ANDROID: binder: improve priority inheritance. ANDROID: binder: add RT inheritance flag to node. ANDROID: binder:

[PATCH v3 1/6] ANDROID: binder: add support for RT prio inheritance.

2017-10-26 Thread Martijn Coenen
tting T1 change the priority of T2 *before* waking it up. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 217 --- 1 file changed, 188 insertions(+), 29 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c ind

Re: [PATCH] ANDROID: binder: call poll_wait() unconditionally.

2017-10-09 Thread Martijn Coenen
On Mon, Oct 9, 2017 at 2:37 PM, Greg KH wrote: > Does this need to get into 4.14-final, or is 4.15-rc1 ok? I'm a bit > lost as to which patches I applied to what tree... This fixes a race that is somewhat hard to hit, I've only ever seen it with test code that creates the right conditions. But w

[PATCH] ANDROID: binder: call poll_wait() unconditionally.

2017-10-09 Thread Martijn Coenen
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 --- drivers/android/binder.c | 11 +-- 1 file

Re: [PATCH v2 03/13] ANDROID: binder: add support for RT prio inheritance.

2017-10-09 Thread Martijn Coenen
On Fri, Sep 1, 2017 at 9:24 AM, Greg KH wrote: > > I've now applied patches 1, 2, 7, 9, 11, and 12 from this series to my > tree, so feel free to rebase on it for the next round of these patches. Thanks Greg. You should also be able to apply patch 10 from this series ("ANDROID: binder: call poll_

Re: [PATCH] android: binder: fix type mismatch warning

2017-09-22 Thread Martijn Coenen
On Fri, Sep 22, 2017 at 11:12 AM, Arnd Bergmann wrote: > How would waiting help? Once P drops support for v7, all P userspaces (including containerized ones) need to be v8. After a while, the number of non-Android userspaces < P with v7 would become practically zero. But it's really hard to draw

Re: [PATCH] android: binder: fix type mismatch warning

2017-09-22 Thread Martijn Coenen
On Wed, Sep 20, 2017 at 3:37 PM, Arnd Bergmann wrote: > I'm not really worried about shipping Android products, for those > there is no big problem using the compile-time option as they build > everything together. Ack. > The case that gets interesting is a any kind of user that wants to > run a

Re: [PATCH] android: binder: fix type mismatch warning

2017-09-20 Thread Martijn Coenen
On Wed, Sep 20, 2017 at 11:58 AM, Arnd Bergmann wrote: > - On stable mainline kernels (unlike android-common), the v8 > interface has never been available as a build option, and making > it user-selectable will required additional patches to make it > actually build on 32-bit ARM. This is fi

Re: [PATCH] android: binder: fix type mismatch warning

2017-09-20 Thread Martijn Coenen
On Mon, Sep 18, 2017 at 9:49 PM, Arnd Bergmann wrote: > The current Kconfig comment says that v7 of the ABI is also > incompatible with Android 4.5 and later user space. Can someone > confirm that? That is not actually true - v7 does work with all versions of Android (up to and including Oreo). I

Re: [PATCH v2 03/13] ANDROID: binder: add support for RT prio inheritance.

2017-08-31 Thread Martijn Coenen
On Thu, Aug 31, 2017 at 1:32 PM, Peter Zijlstra wrote: > AFAIK people are actively working on fixing that. SCHED_DEADLINE was definitely looked at in the past. We certainly don't use it on our own devices in Android Oreo, and I am not aware of any current plans to use it. But the Android org is b

Re: [PATCH v2 03/13] ANDROID: binder: add support for RT prio inheritance.

2017-08-31 Thread Martijn Coenen
On Thu, Aug 31, 2017 at 10:18 AM, Peter Zijlstra wrote: > You fail to support SCHED_DEADLINE, that's not optional. The reason I didn't include it is that we don't use SCHED_DEADLINE in Android userspace. Can we add support for this in a follow-up patch, or do you consider it necessary for accepti

[PATCH v2 11/13] ANDROID: binder: don't enqueue death notifications to thread todo.

2017-08-31 Thread Martijn Coenen
). Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 68780b8e856c..2d23f8699d40 100644 --- a/drivers/android/binder.c +++ b/drivers/android

[PATCH v2 13/13] ANDROID: binder: Add tracing for binder priority inheritance.

2017-08-31 Thread Martijn Coenen
This allows to easily trace and visualize priority inheritance in the binder driver. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 4 drivers/android/binder_trace.h | 24 2 files changed, 28 insertions(+) diff --git a/drivers/android/binder.c

[PATCH v2 10/13] ANDROID: binder: call poll_wait() unconditionally.

2017-08-31 Thread Martijn Coenen
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 --- drivers/android/binder.c | 11 +-- 1 file

[PATCH v2 12/13] ANDROID: binder: don't queue async transactions to thread.

2017-08-31 Thread Martijn Coenen
dling 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 --- drivers/android/binder.c | 8 +--- 1 fil

[PATCH v2 05/13] ANDROID: binder: improve priority inheritance.

2017-08-31 Thread Martijn Coenen
By raising the priority of a thread selected for a transaction *before* we wake it up. Delay restoring the priority when doing a reply until after we wake-up the process receiving the reply. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 74

[PATCH v2 02/13] ANDROID: binder: push new transactions to waiting threads.

2017-08-31 Thread Martijn Coenen
hread, submit the work to the proc waitqueue instead as we did previously. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 181 +-- 1 file changed, 127 insertions(+), 54 deletions(-) diff --git a/drivers/android/binder.c b/drivers/an

[PATCH v2 04/13] ANDROID: binder: add min sched_policy to node.

2017-08-31 Thread Martijn Coenen
] for the SCHED_NORMAL/SCHED_BATCH policies. Signed-off-by: Martijn Coenen --- drivers/android/binder.c| 28 + include/uapi/linux/android/binder.h | 41 - 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/drivers

[PATCH v2 07/13] ANDROID: binder: Add BINDER_GET_NODE_DEBUG_INFO ioctl

2017-08-31 Thread Martijn Coenen
Cross Signed-off-by: Martijn Coenen --- drivers/android/binder.c| 43 + include/uapi/linux/android/binder.h | 14 2 files changed, 57 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 5edde38a77b3

[PATCH v2 08/13] ANDROID: binder: don't check prio permissions on restore.

2017-08-31 Thread Martijn Coenen
apply CAP_SYS_NICE or RLIMIT_RT_PRIO, for now it seems reasonable to not check permissions on the restore path. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/android/binder.c b/dr

[PATCH v2 09/13] ANDROID: binder: Don't BUG_ON(!spin_is_locked()).

2017-08-31 Thread 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 --- drivers/android/binder.c | 26 ++ 1 file changed, 10 insertions(+), 16

[PATCH v2 06/13] ANDROID: binder: add RT inheritance flag to node.

2017-08-31 Thread Martijn Coenen
Allows a binder node to specify whether it wants to inherit real-time scheduling policy from a caller. This inheritance may not always be desirable, for example in cases where the binder call runs untrusted and therefore potentially unbounded code. Signed-off-by: Martijn Coenen --- drivers

[PATCH v2 01/13] ANDROID: binder: remove proc waitqueue

2017-08-31 Thread Martijn Coenen
longer have to block on different waitqueues. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 255 +-- 1 file changed, 181 insertions(+), 74 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index ba9e613b42d6

[PATCH v2 03/13] ANDROID: binder: add support for RT prio inheritance.

2017-08-31 Thread Martijn Coenen
tting T1 change the priority of T2 *before* waking it up. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 217 --- 1 file changed, 188 insertions(+), 29 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c ind

[PATCH v2 00/13] ANDROID: binder: RT priority inheritance and small fixes.

2017-08-31 Thread Martijn Coenen
for binder priority inheritance' have already been reviewed by Android engineers and are merged in Android's common kernel trees. --- Colin Cross (1): ANDROID: binder: Add BINDER_GET_NODE_DEBUG_INFO ioctl Martijn Coenen (12): ANDROID: binder: remove proc waitqueue ANDROID: binder: pu

Re: [PATCH 03/13] ANDROID: binder: add support for RT prio inheritance.

2017-08-25 Thread Martijn Coenen
Hi Thomas, On Fri, Aug 25, 2017 at 5:08 PM, Thomas Gleixner wrote: > Sorry, but this has not much to do with real priority inheritance. Can you clarify what "real priority inheritance" is, or are you more concerned about this particular implementation of it? > > It's a poor mans pseudo PI imple

[PATCH 12/13] ANDROID: binder: don't queue async transactions to thread.

2017-08-25 Thread Martijn Coenen
dling 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 --- drivers/android/binder.c | 8 +--- 1 fil

[PATCH 03/13] ANDROID: binder: add support for RT prio inheritance.

2017-08-25 Thread Martijn Coenen
Adds support for SCHED_BATCH/SCHED_FIFO/SCHED_RR priority inheritance. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 164 ++- 1 file changed, 135 insertions(+), 29 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android

[PATCH 13/13] ANDROID: binder: Add tracing for binder priority inheritance.

2017-08-25 Thread Martijn Coenen
This allows to easily trace and visualize priority inheritance in the binder driver. Change-Id: I8449ae4b002e55c5e9517a47f3581e05eef051d8 Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 4 drivers/android/binder_trace.h | 24 2 files changed, 28

[PATCH 05/13] ANDROID: binder: improve priority inheritance.

2017-08-25 Thread Martijn Coenen
By raising the priority of a thread selected for a transaction *before* we wake it up. Delay restoring the priority when doing a reply until after we wake-up the process receiving the reply. Signed-off-by: Martijn Coenen --- drivers/android/binder.c | 74

[PATCH 04/13] ANDROID: binder: add min sched_policy to node.

2017-08-25 Thread Martijn Coenen
] for the SCHED_NORMAL/SCHED_BATCH policies. Signed-off-by: Martijn Coenen --- drivers/android/binder.c| 26 ++- include/uapi/linux/android/binder.h | 41 - 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/drivers

[PATCH 09/13] ANDROID: binder: Don't BUG_ON(!spin_is_locked()).

2017-08-25 Thread 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 --- drivers/android/binder.c | 26 ++ 1 file changed, 10 insertions(+), 16

  1   2   >