All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Song Liu <songliubraving@fb.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] uprobes: __replace_page() avoid BUG in munlock_vma_page()
Date: Sun, 16 Aug 2020 13:44:25 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.11.2008161338360.20413@eggly.anvils> (raw)

syzbot crashed on the VM_BUG_ON_PAGE(PageTail) in munlock_vma_page(),
when called from uprobes __replace_page().  Which of many ways to fix it?
Settled on not calling when PageCompound (since Head and Tail are equals
in this context, PageCompound the usual check in uprobes.c, and the prior
use of FOLL_SPLIT_PMD will have cleared PageMlocked already).

Reported-by: syzbot <syzkaller@googlegroups.com>
Fixes: 5a52c9df62b4 ("uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT")
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: stable@vger.kernel.org # v5.4+
---
This one is not a 5.9-rc regression, but still good to fix.

 kernel/events/uprobes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- v5.9-rc/kernel/events/uprobes.c	2020-08-12 19:46:50.851196584 -0700
+++ linux/kernel/events/uprobes.c	2020-08-16 13:18:35.292821674 -0700
@@ -205,7 +205,7 @@ static int __replace_page(struct vm_area
 		try_to_free_swap(old_page);
 	page_vma_mapped_walk_done(&pvmw);
 
-	if (vma->vm_flags & VM_LOCKED)
+	if ((vma->vm_flags & VM_LOCKED) && !PageCompound(old_page))
 		munlock_vma_page(old_page);
 	put_page(old_page);
 

             reply	other threads:[~2020-08-16 20:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16 20:44 Hugh Dickins [this message]
2020-08-16 20:44 ` [PATCH] uprobes: __replace_page() avoid BUG in munlock_vma_page() Hugh Dickins
2020-08-17  5:43 ` Song Liu
2020-08-17  7:17   ` Hugh Dickins
2020-08-17  7:17     ` Hugh Dickins
2020-08-17 16:06     ` Song Liu
2020-08-17 14:07 ` Oleg Nesterov
2020-08-17 14:40 ` Srikar Dronamraju

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=alpine.LSU.2.11.2008161338360.20413@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleg@redhat.com \
    --cc=songliubraving@fb.com \
    --cc=srikar@linux.vnet.ibm.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 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.