* linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree @ 2022-08-18 22:28 Stephen Rothwell 2022-08-19 6:36 ` Greg KH 0 siblings, 1 reply; 9+ messages in thread From: Stephen Rothwell @ 2022-08-18 22:28 UTC (permalink / raw) To: Greg KH, Arnd Bergmann, Andrew Morton Cc: Greg Kroah-Hartman, Liam Howlett, Linux Kernel Mailing List, Linux Next Mailing List [-- Attachment #1: Type: text/plain, Size: 873 bytes --] Hi all, Today's linux-next merge of the char-misc.current tree got a conflict in: drivers/android/binder_alloc.c between commit: b3bb668f3dc6 ("binder_alloc: add missing mmap_lock calls when using the VMA") from the mm-hotfixes tree and commit: d6f35446d076 ("binder_alloc: Add missing mmap_lock calls when using the VMA") from the char-misc.current tree. I fixed it up (I used the latter as it was committed later even though the author times were the same) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-18 22:28 linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree Stephen Rothwell @ 2022-08-19 6:36 ` Greg KH 2022-08-19 8:40 ` Stephen Rothwell 0 siblings, 1 reply; 9+ messages in thread From: Greg KH @ 2022-08-19 6:36 UTC (permalink / raw) To: Stephen Rothwell Cc: Arnd Bergmann, Andrew Morton, Liam Howlett, Linux Kernel Mailing List, Linux Next Mailing List On Fri, Aug 19, 2022 at 08:28:18AM +1000, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the char-misc.current tree got a conflict in: > > drivers/android/binder_alloc.c > > between commit: > > b3bb668f3dc6 ("binder_alloc: add missing mmap_lock calls when using the VMA") > > from the mm-hotfixes tree and commit: > > d6f35446d076 ("binder_alloc: Add missing mmap_lock calls when using the VMA") > > from the char-misc.current tree. > > I fixed it up (I used the latter as it was committed later even though > the author times were the same) and can carry the fix as necessary. This > is now fixed as far as linux-next is concerned, but any non trivial > conflicts should be mentioned to your upstream maintainer when your tree > is submitted for merging. You may also want to consider cooperating > with the maintainer of the conflicting tree to minimise any particularly > complex conflicts. These should be identical, if not, something went wrong :( thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-19 6:36 ` Greg KH @ 2022-08-19 8:40 ` Stephen Rothwell 2022-08-19 8:55 ` Greg KH 0 siblings, 1 reply; 9+ messages in thread From: Stephen Rothwell @ 2022-08-19 8:40 UTC (permalink / raw) To: Greg KH Cc: Arnd Bergmann, Andrew Morton, Liam Howlett, Linux Kernel Mailing List, Linux Next Mailing List [-- Attachment #1: Type: text/plain, Size: 4940 bytes --] Hi Greg, On Fri, 19 Aug 2022 08:36:21 +0200 Greg KH <greg@kroah.com> wrote: > > On Fri, Aug 19, 2022 at 08:28:18AM +1000, Stephen Rothwell wrote: > > > > Today's linux-next merge of the char-misc.current tree got a conflict in: > > > > drivers/android/binder_alloc.c > > > > between commit: > > > > b3bb668f3dc6 ("binder_alloc: add missing mmap_lock calls when using the VMA") > > > > from the mm-hotfixes tree and commit: > > > > d6f35446d076 ("binder_alloc: Add missing mmap_lock calls when using the VMA") > > > > from the char-misc.current tree. > > > > I fixed it up (I used the latter as it was committed later even though > > the author times were the same) and can carry the fix as necessary. This > > is now fixed as far as linux-next is concerned, but any non trivial > > conflicts should be mentioned to your upstream maintainer when your tree > > is submitted for merging. You may also want to consider cooperating > > with the maintainer of the conflicting tree to minimise any particularly > > complex conflicts. > > These should be identical, if not, something went wrong :( Something went wrong :-) $ git range-diff b3bb668f3dc6^..b3bb668f3dc6 d6f35446d076^..d6f35446d076 1: b3bb668f3dc6 ! 1: d6f35446d076 binder_alloc: add missing mmap_lock calls when using the VMA @@ Metadata Author: Liam Howlett <liam.howlett@oracle.com> ## Commit message ## - binder_alloc: add missing mmap_lock calls when using the VMA + binder_alloc: Add missing mmap_lock calls when using the VMA - Take the mmap_read_lock() when using the VMA in binder_alloc_print_pages() - and when checking for a VMA in binder_alloc_new_buf_locked(). + Take the mmap_read_lock() when using the VMA in + binder_alloc_print_pages() and when checking for a VMA in + binder_alloc_new_buf_locked(). It is worth noting binder_alloc_new_buf_locked() drops the VMA read lock - after it verifies a VMA exists, but may be taken again deeper in the call - stack, if necessary. + after it verifies a VMA exists, but may be taken again deeper in the + call stack, if necessary. - Link: https://lkml.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com - Fixes: a43cfc87caaf ("android: binder: stop saving a pointer to the VMA") - Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> + Fixes: a43cfc87caaf (android: binder: stop saving a pointer to the VMA) + Cc: stable <stable@kernel.org> Reported-by: Ondrej Mosnacek <omosnace@redhat.com> - Reported-by: <syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com> - Acked-by: Carlos Llamas <cmllamas@google.com> + Reported-by: syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com Tested-by: Ondrej Mosnacek <omosnace@redhat.com> - Cc: Minchan Kim <minchan@kernel.org> - Cc: Christian Brauner (Microsoft) <brauner@kernel.org> - Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> - Cc: Hridya Valsaraju <hridya@google.com> - Cc: Joel Fernandes <joel@joelfernandes.org> - Cc: Martijn Coenen <maco@android.com> - Cc: Suren Baghdasaryan <surenb@google.com> - Cc: Todd Kjos <tkjos@android.com> - Cc: Matthew Wilcox (Oracle) <willy@infradead.org> - Cc: "Arve Hjønnevåg" <arve@android.com> - Signed-off-by: Andrew Morton <akpm@linux-foundation.org> + Acked-by: Carlos Llamas <cmllamas@google.com> + Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> + Link: https://lore.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com + Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ## drivers/android/binder_alloc.c ## @@ drivers/android/binder_alloc.c: static struct binder_buffer *binder_alloc_new_buf_locked( @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m - } + + mmap_read_lock(alloc->vma_vm_mm); -+ if (binder_alloc_get_vma(alloc) == NULL) ++ if (binder_alloc_get_vma(alloc) == NULL) { ++ mmap_read_unlock(alloc->vma_vm_mm); + goto uninitialized; + } + ++ mmap_read_unlock(alloc->vma_vm_mm); + for (i = 0; i < alloc->buffer_size / PAGE_SIZE; i++) { + page = &alloc->pages[i]; + if (!page->page_ptr) @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m + active++; + else + lru++; - } ++ } + +uninitialized: -+ mmap_read_unlock(alloc->vma_vm_mm); mutex_unlock(&alloc->mutex); seq_printf(m, " pages: %d:%d:%d\n", active, lru, free); seq_printf(m, " pages high watermark: %zu\n", alloc->pages_high); -- Cheers, Stephen Rothwell [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-19 8:40 ` Stephen Rothwell @ 2022-08-19 8:55 ` Greg KH 2022-08-19 13:35 ` Liam Howlett 0 siblings, 1 reply; 9+ messages in thread From: Greg KH @ 2022-08-19 8:55 UTC (permalink / raw) To: Stephen Rothwell Cc: Arnd Bergmann, Andrew Morton, Liam Howlett, Linux Kernel Mailing List, Linux Next Mailing List On Fri, Aug 19, 2022 at 06:40:27PM +1000, Stephen Rothwell wrote: > Hi Greg, > > On Fri, 19 Aug 2022 08:36:21 +0200 Greg KH <greg@kroah.com> wrote: > > > > On Fri, Aug 19, 2022 at 08:28:18AM +1000, Stephen Rothwell wrote: > > > > > > Today's linux-next merge of the char-misc.current tree got a conflict in: > > > > > > drivers/android/binder_alloc.c > > > > > > between commit: > > > > > > b3bb668f3dc6 ("binder_alloc: add missing mmap_lock calls when using the VMA") > > > > > > from the mm-hotfixes tree and commit: > > > > > > d6f35446d076 ("binder_alloc: Add missing mmap_lock calls when using the VMA") > > > > > > from the char-misc.current tree. > > > > > > I fixed it up (I used the latter as it was committed later even though > > > the author times were the same) and can carry the fix as necessary. This > > > is now fixed as far as linux-next is concerned, but any non trivial > > > conflicts should be mentioned to your upstream maintainer when your tree > > > is submitted for merging. You may also want to consider cooperating > > > with the maintainer of the conflicting tree to minimise any particularly > > > complex conflicts. > > > > These should be identical, if not, something went wrong :( > > Something went wrong :-) > > $ git range-diff b3bb668f3dc6^..b3bb668f3dc6 d6f35446d076^..d6f35446d076 > 1: b3bb668f3dc6 ! 1: d6f35446d076 binder_alloc: add missing mmap_lock calls when using the VMA > @@ Metadata > Author: Liam Howlett <liam.howlett@oracle.com> > > ## Commit message ## > - binder_alloc: add missing mmap_lock calls when using the VMA > + binder_alloc: Add missing mmap_lock calls when using the VMA > > - Take the mmap_read_lock() when using the VMA in binder_alloc_print_pages() > - and when checking for a VMA in binder_alloc_new_buf_locked(). > + Take the mmap_read_lock() when using the VMA in > + binder_alloc_print_pages() and when checking for a VMA in > + binder_alloc_new_buf_locked(). > > It is worth noting binder_alloc_new_buf_locked() drops the VMA read lock > - after it verifies a VMA exists, but may be taken again deeper in the call > - stack, if necessary. > + after it verifies a VMA exists, but may be taken again deeper in the > + call stack, if necessary. > > - Link: https://lkml.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com > - Fixes: a43cfc87caaf ("android: binder: stop saving a pointer to the VMA") > - Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> > + Fixes: a43cfc87caaf (android: binder: stop saving a pointer to the VMA) > + Cc: stable <stable@kernel.org> > Reported-by: Ondrej Mosnacek <omosnace@redhat.com> > - Reported-by: <syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com> > - Acked-by: Carlos Llamas <cmllamas@google.com> > + Reported-by: syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com > Tested-by: Ondrej Mosnacek <omosnace@redhat.com> > - Cc: Minchan Kim <minchan@kernel.org> > - Cc: Christian Brauner (Microsoft) <brauner@kernel.org> > - Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > - Cc: Hridya Valsaraju <hridya@google.com> > - Cc: Joel Fernandes <joel@joelfernandes.org> > - Cc: Martijn Coenen <maco@android.com> > - Cc: Suren Baghdasaryan <surenb@google.com> > - Cc: Todd Kjos <tkjos@android.com> > - Cc: Matthew Wilcox (Oracle) <willy@infradead.org> > - Cc: "Arve Hjønnevåg" <arve@android.com> > - Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > + Acked-by: Carlos Llamas <cmllamas@google.com> > + Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> > + Link: https://lore.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com > + Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > ## drivers/android/binder_alloc.c ## > @@ drivers/android/binder_alloc.c: static struct binder_buffer *binder_alloc_new_buf_locked( > @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m > - } > + > + mmap_read_lock(alloc->vma_vm_mm); > -+ if (binder_alloc_get_vma(alloc) == NULL) > ++ if (binder_alloc_get_vma(alloc) == NULL) { > ++ mmap_read_unlock(alloc->vma_vm_mm); > + goto uninitialized; > + } > + > ++ mmap_read_unlock(alloc->vma_vm_mm); > + for (i = 0; i < alloc->buffer_size / PAGE_SIZE; i++) { > + page = &alloc->pages[i]; > + if (!page->page_ptr) > @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m > + active++; > + else > + lru++; > - } > ++ } > + > +uninitialized: > -+ mmap_read_unlock(alloc->vma_vm_mm); > mutex_unlock(&alloc->mutex); > seq_printf(m, " pages: %d:%d:%d\n", active, lru, free); > seq_printf(m, " pages high watermark: %zu\n", alloc->pages_high); > Oh wow, ok, I'll go drop my version and assume that Andrew's is the more correct one and let it come through his tree. thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-19 8:55 ` Greg KH @ 2022-08-19 13:35 ` Liam Howlett 2022-08-19 15:44 ` Greg KH 2022-08-19 20:35 ` Andrew Morton 0 siblings, 2 replies; 9+ messages in thread From: Liam Howlett @ 2022-08-19 13:35 UTC (permalink / raw) To: Greg KH Cc: Stephen Rothwell, Arnd Bergmann, Andrew Morton, Linux Kernel Mailing List, Linux Next Mailing List * Greg KH <greg@kroah.com> [220819 04:55]: > On Fri, Aug 19, 2022 at 06:40:27PM +1000, Stephen Rothwell wrote: > > Hi Greg, > > > > On Fri, 19 Aug 2022 08:36:21 +0200 Greg KH <greg@kroah.com> wrote: > > > > > > On Fri, Aug 19, 2022 at 08:28:18AM +1000, Stephen Rothwell wrote: > > > > > > > > Today's linux-next merge of the char-misc.current tree got a conflict in: > > > > > > > > drivers/android/binder_alloc.c > > > > > > > > between commit: > > > > > > > > b3bb668f3dc6 ("binder_alloc: add missing mmap_lock calls when using the VMA") > > > > > > > > from the mm-hotfixes tree and commit: > > > > > > > > d6f35446d076 ("binder_alloc: Add missing mmap_lock calls when using the VMA") > > > > > > > > from the char-misc.current tree. > > > > > > > > I fixed it up (I used the latter as it was committed later even though > > > > the author times were the same) and can carry the fix as necessary. This > > > > is now fixed as far as linux-next is concerned, but any non trivial > > > > conflicts should be mentioned to your upstream maintainer when your tree > > > > is submitted for merging. You may also want to consider cooperating > > > > with the maintainer of the conflicting tree to minimise any particularly > > > > complex conflicts. > > > > > > These should be identical, if not, something went wrong :( > > > > Something went wrong :-) > > > > $ git range-diff b3bb668f3dc6^..b3bb668f3dc6 d6f35446d076^..d6f35446d076 > > 1: b3bb668f3dc6 ! 1: d6f35446d076 binder_alloc: add missing mmap_lock calls when using the VMA > > @@ Metadata > > Author: Liam Howlett <liam.howlett@oracle.com> > > > > ## Commit message ## > > - binder_alloc: add missing mmap_lock calls when using the VMA > > + binder_alloc: Add missing mmap_lock calls when using the VMA > > > > - Take the mmap_read_lock() when using the VMA in binder_alloc_print_pages() > > - and when checking for a VMA in binder_alloc_new_buf_locked(). > > + Take the mmap_read_lock() when using the VMA in > > + binder_alloc_print_pages() and when checking for a VMA in > > + binder_alloc_new_buf_locked(). > > > > It is worth noting binder_alloc_new_buf_locked() drops the VMA read lock > > - after it verifies a VMA exists, but may be taken again deeper in the call > > - stack, if necessary. > > + after it verifies a VMA exists, but may be taken again deeper in the > > + call stack, if necessary. > > > > - Link: https://lkml.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com > > - Fixes: a43cfc87caaf ("android: binder: stop saving a pointer to the VMA") > > - Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> > > + Fixes: a43cfc87caaf (android: binder: stop saving a pointer to the VMA) > > + Cc: stable <stable@kernel.org> > > Reported-by: Ondrej Mosnacek <omosnace@redhat.com> > > - Reported-by: <syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com> > > - Acked-by: Carlos Llamas <cmllamas@google.com> > > + Reported-by: syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com > > Tested-by: Ondrej Mosnacek <omosnace@redhat.com> > > - Cc: Minchan Kim <minchan@kernel.org> > > - Cc: Christian Brauner (Microsoft) <brauner@kernel.org> > > - Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > - Cc: Hridya Valsaraju <hridya@google.com> > > - Cc: Joel Fernandes <joel@joelfernandes.org> > > - Cc: Martijn Coenen <maco@android.com> > > - Cc: Suren Baghdasaryan <surenb@google.com> > > - Cc: Todd Kjos <tkjos@android.com> > > - Cc: Matthew Wilcox (Oracle) <willy@infradead.org> > > - Cc: "Arve Hjønnevåg" <arve@android.com> > > - Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > > + Acked-by: Carlos Llamas <cmllamas@google.com> > > + Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> > > + Link: https://lore.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com > > + Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > > ## drivers/android/binder_alloc.c ## > > @@ drivers/android/binder_alloc.c: static struct binder_buffer *binder_alloc_new_buf_locked( > > @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m > > - } > > + > > + mmap_read_lock(alloc->vma_vm_mm); > > -+ if (binder_alloc_get_vma(alloc) == NULL) > > ++ if (binder_alloc_get_vma(alloc) == NULL) { > > ++ mmap_read_unlock(alloc->vma_vm_mm); > > + goto uninitialized; > > + } > > + > > ++ mmap_read_unlock(alloc->vma_vm_mm); > > + for (i = 0; i < alloc->buffer_size / PAGE_SIZE; i++) { > > + page = &alloc->pages[i]; > > + if (!page->page_ptr) > > @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m > > + active++; > > + else > > + lru++; > > - } > > ++ } > > + > > +uninitialized: > > -+ mmap_read_unlock(alloc->vma_vm_mm); > > mutex_unlock(&alloc->mutex); > > seq_printf(m, " pages: %d:%d:%d\n", active, lru, free); > > seq_printf(m, " pages high watermark: %zu\n", alloc->pages_high); > > > > Oh wow, ok, I'll go drop my version and assume that Andrew's is the more > correct one and let it come through his tree. > b3bb668f3dc6 is the older v1 of the patch [1]. d6f35446d076 from mm-hotfixes is the correct v2 version [2], although I don't think that's currently in mm-hotfixes-unstable. It looks like version 1 is now in mm-hotfixes-unstable as well. 1: https://lore.kernel.org/linux-mm/20220809160618.1052539-1-Liam.Howlett@oracle.com/ 2: https://lore.kernel.org/linux-mm/20220810160209.1630707-1-Liam.Howlett@oracle.com/ Thanks, Liam ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-19 13:35 ` Liam Howlett @ 2022-08-19 15:44 ` Greg KH 2022-08-19 20:35 ` Andrew Morton 1 sibling, 0 replies; 9+ messages in thread From: Greg KH @ 2022-08-19 15:44 UTC (permalink / raw) To: Liam Howlett Cc: Stephen Rothwell, Arnd Bergmann, Andrew Morton, Linux Kernel Mailing List, Linux Next Mailing List On Fri, Aug 19, 2022 at 01:35:04PM +0000, Liam Howlett wrote: > * Greg KH <greg@kroah.com> [220819 04:55]: > > On Fri, Aug 19, 2022 at 06:40:27PM +1000, Stephen Rothwell wrote: > > > Hi Greg, > > > > > > On Fri, 19 Aug 2022 08:36:21 +0200 Greg KH <greg@kroah.com> wrote: > > > > > > > > On Fri, Aug 19, 2022 at 08:28:18AM +1000, Stephen Rothwell wrote: > > > > > > > > > > Today's linux-next merge of the char-misc.current tree got a conflict in: > > > > > > > > > > drivers/android/binder_alloc.c > > > > > > > > > > between commit: > > > > > > > > > > b3bb668f3dc6 ("binder_alloc: add missing mmap_lock calls when using the VMA") > > > > > > > > > > from the mm-hotfixes tree and commit: > > > > > > > > > > d6f35446d076 ("binder_alloc: Add missing mmap_lock calls when using the VMA") > > > > > > > > > > from the char-misc.current tree. > > > > > > > > > > I fixed it up (I used the latter as it was committed later even though > > > > > the author times were the same) and can carry the fix as necessary. This > > > > > is now fixed as far as linux-next is concerned, but any non trivial > > > > > conflicts should be mentioned to your upstream maintainer when your tree > > > > > is submitted for merging. You may also want to consider cooperating > > > > > with the maintainer of the conflicting tree to minimise any particularly > > > > > complex conflicts. > > > > > > > > These should be identical, if not, something went wrong :( > > > > > > Something went wrong :-) > > > > > > $ git range-diff b3bb668f3dc6^..b3bb668f3dc6 d6f35446d076^..d6f35446d076 > > > 1: b3bb668f3dc6 ! 1: d6f35446d076 binder_alloc: add missing mmap_lock calls when using the VMA > > > @@ Metadata > > > Author: Liam Howlett <liam.howlett@oracle.com> > > > > > > ## Commit message ## > > > - binder_alloc: add missing mmap_lock calls when using the VMA > > > + binder_alloc: Add missing mmap_lock calls when using the VMA > > > > > > - Take the mmap_read_lock() when using the VMA in binder_alloc_print_pages() > > > - and when checking for a VMA in binder_alloc_new_buf_locked(). > > > + Take the mmap_read_lock() when using the VMA in > > > + binder_alloc_print_pages() and when checking for a VMA in > > > + binder_alloc_new_buf_locked(). > > > > > > It is worth noting binder_alloc_new_buf_locked() drops the VMA read lock > > > - after it verifies a VMA exists, but may be taken again deeper in the call > > > - stack, if necessary. > > > + after it verifies a VMA exists, but may be taken again deeper in the > > > + call stack, if necessary. > > > > > > - Link: https://lkml.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com > > > - Fixes: a43cfc87caaf ("android: binder: stop saving a pointer to the VMA") > > > - Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> > > > + Fixes: a43cfc87caaf (android: binder: stop saving a pointer to the VMA) > > > + Cc: stable <stable@kernel.org> > > > Reported-by: Ondrej Mosnacek <omosnace@redhat.com> > > > - Reported-by: <syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com> > > > - Acked-by: Carlos Llamas <cmllamas@google.com> > > > + Reported-by: syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com > > > Tested-by: Ondrej Mosnacek <omosnace@redhat.com> > > > - Cc: Minchan Kim <minchan@kernel.org> > > > - Cc: Christian Brauner (Microsoft) <brauner@kernel.org> > > > - Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > - Cc: Hridya Valsaraju <hridya@google.com> > > > - Cc: Joel Fernandes <joel@joelfernandes.org> > > > - Cc: Martijn Coenen <maco@android.com> > > > - Cc: Suren Baghdasaryan <surenb@google.com> > > > - Cc: Todd Kjos <tkjos@android.com> > > > - Cc: Matthew Wilcox (Oracle) <willy@infradead.org> > > > - Cc: "Arve Hjønnevåg" <arve@android.com> > > > - Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > > > + Acked-by: Carlos Llamas <cmllamas@google.com> > > > + Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> > > > + Link: https://lore.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com > > > + Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > > > > ## drivers/android/binder_alloc.c ## > > > @@ drivers/android/binder_alloc.c: static struct binder_buffer *binder_alloc_new_buf_locked( > > > @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m > > > - } > > > + > > > + mmap_read_lock(alloc->vma_vm_mm); > > > -+ if (binder_alloc_get_vma(alloc) == NULL) > > > ++ if (binder_alloc_get_vma(alloc) == NULL) { > > > ++ mmap_read_unlock(alloc->vma_vm_mm); > > > + goto uninitialized; > > > + } > > > + > > > ++ mmap_read_unlock(alloc->vma_vm_mm); > > > + for (i = 0; i < alloc->buffer_size / PAGE_SIZE; i++) { > > > + page = &alloc->pages[i]; > > > + if (!page->page_ptr) > > > @@ drivers/android/binder_alloc.c: void binder_alloc_print_pages(struct seq_file *m > > > + active++; > > > + else > > > + lru++; > > > - } > > > ++ } > > > + > > > +uninitialized: > > > -+ mmap_read_unlock(alloc->vma_vm_mm); > > > mutex_unlock(&alloc->mutex); > > > seq_printf(m, " pages: %d:%d:%d\n", active, lru, free); > > > seq_printf(m, " pages high watermark: %zu\n", alloc->pages_high); > > > > > > > Oh wow, ok, I'll go drop my version and assume that Andrew's is the more > > correct one and let it come through his tree. > > > > b3bb668f3dc6 is the older v1 of the patch [1]. d6f35446d076 from > mm-hotfixes is the correct v2 version [2], although I don't think that's > currently in mm-hotfixes-unstable. It looks like version 1 is now in > mm-hotfixes-unstable as well. > > 1: https://lore.kernel.org/linux-mm/20220809160618.1052539-1-Liam.Howlett@oracle.com/ > 2: https://lore.kernel.org/linux-mm/20220810160209.1630707-1-Liam.Howlett@oracle.com/ I'll let you and Andrew fight this one out :) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-19 13:35 ` Liam Howlett 2022-08-19 15:44 ` Greg KH @ 2022-08-19 20:35 ` Andrew Morton 2022-08-19 22:02 ` Liam Howlett 1 sibling, 1 reply; 9+ messages in thread From: Andrew Morton @ 2022-08-19 20:35 UTC (permalink / raw) To: Liam Howlett Cc: Greg KH, Stephen Rothwell, Arnd Bergmann, Linux Kernel Mailing List, Linux Next Mailing List On Fri, 19 Aug 2022 13:35:04 +0000 Liam Howlett <liam.howlett@oracle.com> wrote: > b3bb668f3dc6 is the older v1 of the patch [1]. d6f35446d076 from > mm-hotfixes is the correct v2 version [2], although I don't think that's > currently in mm-hotfixes-unstable. It looks like version 1 is now in > mm-hotfixes-unstable as well. > > 1: https://lore.kernel.org/linux-mm/20220809160618.1052539-1-Liam.Howlett@oracle.com/ > 2: https://lore.kernel.org/linux-mm/20220810160209.1630707-1-Liam.Howlett@oracle.com/ I moved "binder_alloc: add missing mmap_lock calls when using the VMA" into mm-hotfixes-stable this week. It's the v2. I intend to send this Linuswards today or tomorrow. Below. So I think we're all good. commit b3bb668f3dc6a97a91c47a4cebb0e3f33554c08c Author: Liam Howlett <liam.howlett@oracle.com> Date: Wed Aug 10 16:02:25 2022 +0000 binder_alloc: add missing mmap_lock calls when using the VMA Take the mmap_read_lock() when using the VMA in binder_alloc_print_pages() and when checking for a VMA in binder_alloc_new_buf_locked(). It is worth noting binder_alloc_new_buf_locked() drops the VMA read lock after it verifies a VMA exists, but may be taken again deeper in the call stack, if necessary. Link: https://lkml.kernel.org/r/20220810160209.1630707-1-Liam.Howlett@oracle.com Fixes: a43cfc87caaf ("android: binder: stop saving a pointer to the VMA") Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Reported-by: Ondrej Mosnacek <omosnace@redhat.com> Reported-by: <syzbot+a7b60a176ec13cafb793@syzkaller.appspotmail.com> Acked-by: Carlos Llamas <cmllamas@google.com> Tested-by: Ondrej Mosnacek <omosnace@redhat.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Christian Brauner (Microsoft) <brauner@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Hridya Valsaraju <hridya@google.com> Cc: Joel Fernandes <joel@joelfernandes.org> Cc: Martijn Coenen <maco@android.com> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Todd Kjos <tkjos@android.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: "Arve Hjønnevåg" <arve@android.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 1014beb12802..d247742bb42e 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -402,12 +402,15 @@ static struct binder_buffer *binder_alloc_new_buf_locked( size_t size, data_offsets_size; int ret; + mmap_read_lock(alloc->vma_vm_mm); if (!binder_alloc_get_vma(alloc)) { + mmap_read_unlock(alloc->vma_vm_mm); binder_alloc_debug(BINDER_DEBUG_USER_ERROR, "%d: binder_alloc_buf, no vma\n", alloc->pid); return ERR_PTR(-ESRCH); } + mmap_read_unlock(alloc->vma_vm_mm); data_offsets_size = ALIGN(data_size, sizeof(void *)) + ALIGN(offsets_size, sizeof(void *)); @@ -929,17 +932,23 @@ void binder_alloc_print_pages(struct seq_file *m, * Make sure the binder_alloc is fully initialized, otherwise we might * read inconsistent state. */ - if (binder_alloc_get_vma(alloc) != NULL) { - for (i = 0; i < alloc->buffer_size / PAGE_SIZE; i++) { - page = &alloc->pages[i]; - if (!page->page_ptr) - free++; - else if (list_empty(&page->lru)) - active++; - else - lru++; - } + + mmap_read_lock(alloc->vma_vm_mm); + if (binder_alloc_get_vma(alloc) == NULL) + goto uninitialized; + + for (i = 0; i < alloc->buffer_size / PAGE_SIZE; i++) { + page = &alloc->pages[i]; + if (!page->page_ptr) + free++; + else if (list_empty(&page->lru)) + active++; + else + lru++; } + +uninitialized: + mmap_read_unlock(alloc->vma_vm_mm); mutex_unlock(&alloc->mutex); seq_printf(m, " pages: %d:%d:%d\n", active, lru, free); seq_printf(m, " pages high watermark: %zu\n", alloc->pages_high); ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-19 20:35 ` Andrew Morton @ 2022-08-19 22:02 ` Liam Howlett 2022-08-19 22:55 ` Andrew Morton 0 siblings, 1 reply; 9+ messages in thread From: Liam Howlett @ 2022-08-19 22:02 UTC (permalink / raw) To: Andrew Morton Cc: Greg KH, Stephen Rothwell, Arnd Bergmann, Linux Kernel Mailing List, Linux Next Mailing List * Andrew Morton <akpm@linux-foundation.org> [220819 16:35]: > On Fri, 19 Aug 2022 13:35:04 +0000 Liam Howlett <liam.howlett@oracle.com> wrote: > > > b3bb668f3dc6 is the older v1 of the patch [1]. d6f35446d076 from > > mm-hotfixes is the correct v2 version [2], although I don't think that's > > currently in mm-hotfixes-unstable. It looks like version 1 is now in > > mm-hotfixes-unstable as well. > > > > 1: https://lore.kernel.org/linux-mm/20220809160618.1052539-1-Liam.Howlett@oracle.com/ > > 2: https://lore.kernel.org/linux-mm/20220810160209.1630707-1-Liam.Howlett@oracle.com/ > > I moved "binder_alloc: add missing mmap_lock calls when using the VMA" > into mm-hotfixes-stable this week. > > It's the v2. I intend to send this Linuswards today or tomorrow. Below. > > So I think we're all good. > > > commit b3bb668f3dc6a97a91c47a4cebb0e3f33554c08c ... Sounds good, as long as it isn't the above commit which is v1, but d6f35446d076 which is v2 :) Thanks, Liam ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree 2022-08-19 22:02 ` Liam Howlett @ 2022-08-19 22:55 ` Andrew Morton 0 siblings, 0 replies; 9+ messages in thread From: Andrew Morton @ 2022-08-19 22:55 UTC (permalink / raw) To: Liam Howlett Cc: Greg KH, Stephen Rothwell, Arnd Bergmann, Linux Kernel Mailing List, Linux Next Mailing List On Fri, 19 Aug 2022 22:02:53 +0000 Liam Howlett <liam.howlett@oracle.com> wrote: > > I moved "binder_alloc: add missing mmap_lock calls when using the VMA" > > into mm-hotfixes-stable this week. > > > > It's the v2. I intend to send this Linuswards today or tomorrow. Below. > > > > So I think we're all good. > > > > > > commit b3bb668f3dc6a97a91c47a4cebb0e3f33554c08c > > ... > > Sounds good, as long as it isn't the above commit which is v1, but > d6f35446d076 which is v2 :) Well dang, I somehow messed that up. I have the v2 now. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-08-19 22:55 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-08-18 22:28 linux-next: manual merge of the char-misc.current tree with the mm-hotfixes tree Stephen Rothwell 2022-08-19 6:36 ` Greg KH 2022-08-19 8:40 ` Stephen Rothwell 2022-08-19 8:55 ` Greg KH 2022-08-19 13:35 ` Liam Howlett 2022-08-19 15:44 ` Greg KH 2022-08-19 20:35 ` Andrew Morton 2022-08-19 22:02 ` Liam Howlett 2022-08-19 22:55 ` Andrew Morton
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.