mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kassey Li <quic_yingangl@quicinc.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <gregkh@google.com>, <cmllamas@google.com>, <surenb@google.com>,
	<arve@android.com>, <joel@joelfernandes.org>,
	<brauner@kernel.org>, <tkjos@android.com>, <maco@android.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] binder: add mutex_lock for mmap and NULL when free
Date: Sat, 7 Oct 2023 19:43:50 +0800	[thread overview]
Message-ID: <a04f2f27-e746-2b28-ec58-66041def9645@quicinc.com> (raw)
In-Reply-To: <2023100735-dullness-cameo-2666@gregkh>



On 2023/10/7 19:37, Greg KH wrote:
> On Sat, Oct 07, 2023 at 07:34:05PM +0800, Kassey Li wrote:
>>
>>
>> On 2023/10/7 19:18, Greg KH wrote:
>>> On Sat, Oct 07, 2023 at 07:07:40PM +0800, Kassey Li wrote:
>>>>
>>>>
>>>> On 2023/10/7 14:44, Greg KH wrote:
>>>>> On Sat, Oct 07, 2023 at 11:40:46AM +0800, Kassey Li wrote:
>>>>>> Enforce alloc->mutex in binder_alloc_mmap_handler when add
>>>>>> the entry to list.
>>>>>>
>>>>>> Assign the freed pages/page_ptr to NULL to catch possible
>>>>>> use after free with NULL pointer access.
>>>>>>
>>>>>> Signed-off-by: Kassey Li <quic_yingangl@quicinc.com>
>>>>>> ---
>>>>>>     drivers/android/binder_alloc.c | 5 ++++-
>>>>>>     1 file changed, 4 insertions(+), 1 deletion(-)
>>>>>
>>>>> What commit id does this fix?
>>>>
>>>>     there is no specific commit id this change going to fix.
>>>>
>>>>     it is a follow up for commit
>>>> 	19c987241ca1216a51118b2bd0185b8bc5081783  binder: separate out binder_alloc
>>>> functions (mutex lock added for list access in alloc/free)
>>>> 	f2517eb76f1f2f7f89761f9db2b202e89931738c  android: binder: Add global lru
>>>> shrinker to binder (set page->page_ptr = NULL;)
>>>>
>>>>     the background to raise this change that we are easy hit below crash in
>>>> monkey test:
>>>>
>>>> where a wrong end is passing to
>>>> binder_update_page_range, thus calculate a weird index
>>>> for
>>>>     page = &alloc->pages[index]
>>>
>>> Obviously it is a fix for some commit, please list that here.
>>
>>   ok, please kindly review this patch description according your suggest, i
>> can re-send v2 patch again.
>>
>> commit 16aaeb8556ff4eb75823c56773ee82b06bac44a0 (HEAD -> master)
>> Author: Kassey Li <quic_yingangl@quicinc.com>
>> Date:   Thu Sep 28 10:42:52 2023 +0800
>>
>>      binder: add mutex_lock for mmap and NULL when free
>>
>>      -Enforce alloc->mutex in binder_alloc_mmap_handler when add
>>      the entry to list.
>>
>>      -Assign the freed pages/page_ptr to NULL to catch possible
>>      use after free with NULL pointer access.
> 
> Odd indentation :(

thanks for the quick suggest and review, based on this version, will do 
below and send patch v2.

./scripts/checkpatch.pl 
0001-binder-add-mutex_lock-for-mmap-and-NULL-when-free.patch
total: 0 errors, 0 warnings, 26 lines checked

0001-binder-add-mutex_lock-for-mmap-and-NULL-when-free.patch has no 
obvious style problems and is ready for submission.

> 
>>      Fixes: 19c987241ca1 ("binder: separate out binder_alloc functions")
>>      Fixes: f2517eb76f1f ("android: binder: Add global lru shrinker to
>> binder")
>>      Signed-off-by: Kassey Li <quic_yingangl@quicinc.com>
> 
> Looks better than before, thanks.
> 
> greg k-h

      reply	other threads:[~2023-10-07 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07  3:40 Kassey Li
2023-10-07  6:44 ` Greg KH
2023-10-07 11:07   ` Kassey Li
2023-10-07 11:18     ` Greg KH
2023-10-07 11:34       ` Kassey Li
2023-10-07 11:37         ` Greg KH
2023-10-07 11:43           ` Kassey Li [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=a04f2f27-e746-2b28-ec58-66041def9645@quicinc.com \
    --to=quic_yingangl@quicinc.com \
    --cc=arve@android.com \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=gregkh@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=surenb@google.com \
    --cc=tkjos@android.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®