Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2028619pxa; Mon, 24 Aug 2020 03:04:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziWItoGtqyMC21ZlUd95ZQwhHL9EJfNnrMdi8jKnPSRC/pRdIFCwmnGSairRvGKbQGA46+ X-Received: by 2002:a17:906:299b:: with SMTP id x27mr4958173eje.550.1598263455862; Mon, 24 Aug 2020 03:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598263455; cv=none; d=google.com; s=arc-20160816; b=ezm7Cmw6c+caDsPCSR0L+QmkRusbfluMkys1QMfIYAknrDIqjAoMT51RDzrVmyGmma Pc8y0UFHqmcEWFadVrjU2uAhOUDUpoMDl2j1veua/3FSE2NC+pPdRmarwqU9zoWmQySz BLHz6eYtxsdRGGlNlRDBLLjT28gUl0EDY3ITe8dQDdV1PRidPwSEMipAIR5d8jwJWFAg UoYPZ9+SmKszJK9M7vhaJ91IVHJabzkccukjocB272eqm7+gVwbi3hoDBn9OHtB9HTeA qUeOICghuuvsN7x5s8czPh5OKlc1xfxwl7eL9NrJvyEEzDCz5ZkPRGwkdUlK3Pv0u2Cr 3kLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dQatNk6WkVPIl4af4aWLtPgyhRKzGSo/Ihuiztp63sw=; b=UuhuAhfggT43+u4H2309OANUM6t+djxQiUf+d0fJosybOhDUCWF1BM8uj8saF4YPGl 5FxQO7gIUZtl2P1mrmrnaUpJPU+Ph0n47TUEgy2QP/e//v22KgyuddTualbWFUc/smSa 7yEeRN2s5gnDuSt+UtF8gJz8JnALSKhcrvhfSO+UXQ2HNNGAOx4ezz+begn5KrVNy+zo jfn7o3YR3DGlXrzzMpqYJjl9Fv9hH/qiaqDaa/Htg4qlVGbi05csNF0JxzWQi+7XHxi1 CCV7eGyI2VOa8zPT+HLLFQLgd6rKjP24gtDR2cQEWXQA1WJmdazdnEbWmSvH31Dkg+wS i1iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZamW+jDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s5si3772220eji.321.2020.08.24.03.03.52; Mon, 24 Aug 2020 03:04:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZamW+jDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbgHXKBY (ORCPT + 99 others); Mon, 24 Aug 2020 06:01:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:39108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbgHXIcV (ORCPT ); Mon, 24 Aug 2020 04:32:21 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1FB5A206F0; Mon, 24 Aug 2020 08:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598257940; bh=hwaAYTxU9ShV0QTbj+Oo85m5JIPfVll379yiha5uFyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZamW+jDLFb6u9SMvVXRwHegeT6XlZyE+1i7qlh+q9miQGB4d55d5rn5qV1jTBgk14 RrQxnMqPH5psW+v5yFNSge2I4dneX3eLXd/Ke8fAg3rJLGNHUA47ODs9U5eRs4Tpyl JI7E51PvCRwvJhJrtMCQ5pAYsfgQNp6X90o54RJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Hugh Dickins , Andrew Morton , Srikar Dronamraju , Song Liu , Oleg Nesterov , "Kirill A. Shutemov" , Linus Torvalds Subject: [PATCH 5.8 016/148] uprobes: __replace_page() avoid BUG in munlock_vma_page() Date: Mon, 24 Aug 2020 10:28:34 +0200 Message-Id: <20200824082414.746586028@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200824082413.900489417@linuxfoundation.org> References: <20200824082413.900489417@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins commit c17c3dc9d08b9aad9a55a1e53f205187972f448e upstream. 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). Fixes: 5a52c9df62b4 ("uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT") Reported-by: syzbot Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Reviewed-by: Srikar Dronamraju Acked-by: Song Liu Acked-by: Oleg Nesterov Cc: "Kirill A. Shutemov" Cc: [5.4+] Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2008161338360.20413@eggly.anvils Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -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);