Message ID | 1532931975-25473-1-git-send-email-rppt@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C03014BC for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 30 Jul 2018 06:26:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1EFA28EA0 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 30 Jul 2018 06:26:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E58CB2924D; Mon, 30 Jul 2018 06:26:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 933A628EA0 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 30 Jul 2018 06:26:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 995916B0005; Mon, 30 Jul 2018 02:26:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 945166B0008; Mon, 30 Jul 2018 02:26:29 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80DE26B000A; Mon, 30 Jul 2018 02:26:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f72.google.com (mail-oi0-f72.google.com [209.85.218.72]) by kanga.kvack.org (Postfix) with ESMTP id 4F45F6B0005 for <linux-mm@kvack.org>; Mon, 30 Jul 2018 02:26:29 -0400 (EDT) Received: by mail-oi0-f72.google.com with SMTP id l26-v6so10097486oii.14 for <linux-mm@kvack.org>; Sun, 29 Jul 2018 23:26:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=IjaMA+ebK29TOJgXYEaav/KA9IPiV2tRaoxxYKiru7U=; b=M9XcsmFNwl7I1eoa/rIaiEXsppacNZF7gBiMfZJDx86fRG7bCrNtha3Ien6Kqk5QVu DPqpTvCDw61bSBHifMhTzdgIGgOSNNSzqUkirfiDEDESsFL8UvQUXRRBAhVfcLj9PBee ph1/cvoDm8whjNiMQ7Q3fWfn9zwfAc2l50/4XDz644vB/w91QMZQ0AAcTP2FSWml68MV 8vsmivH75oV5tU5pyszqymv+I4bYFii84BfSUEZMQ2Q3dsvVodCslJ1IEERFr+/vSPv1 gnn+K/sE9nucfph0qWzOvf1TlD/oWhZAZg3bF6LVsNYZijsF/Cy4ku6hZslDr9kbjapP jO+A== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AOUpUlGrZXKnwYA178mKGA1NWVIJDoDka9Bw7meLI/U+Jclb02qkRjSA Ln7dXLNr6rqAGPNoTbEmTy+v7nWvQEZCgBwdbByL8/P8KbixJh+JRbk446bOISVR5I+iZA+yobE tBvHtFNgtuCHxJptV9QBEPvXVg9F4nAk6/ogvQGnwyDi70ZHs3c+vYg1yvS4EinA= X-Received: by 2002:aca:f0a:: with SMTP id 10-v6mr10530014oip.183.1532931989022; Sun, 29 Jul 2018 23:26:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdSa4NHxCvhEZ+9fZLQIR+2ht33s+OjPJztItPxBdeu0EcVaUztT8x3p36RQYCComWZFE1X X-Received: by 2002:aca:f0a:: with SMTP id 10-v6mr10529974oip.183.1532931988260; Sun, 29 Jul 2018 23:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532931988; cv=none; d=google.com; s=arc-20160816; b=IXKWzuYfqRg8PbXCA6+xtDOqDlQj3PjaLJkhI2G2pXNHzaMcYy1JFkhmsdk+od5XWY 9OawSLZODIJyQxN6FtiJm5l5QTTwjOwvnqEAdP1OWfCVWgrTZapjIRwo+icAy2AIqL8t pS8bgyTafhRQIFj3R8lclazulHT/WTNR+RgeLfiKAvU4XjtuIihVLza4BYS9cUrMSD+Q lEtKWxW+k2p/qnlWqJbXW+rlvVC7Z89D3sjQMXz9xm/Ee097l9Jtaw/BZPuIlCRncaoo O7N/yxVg5YoSTWhVpM9zfIfC/UPxLYlyu92GEpq+PMBOarJW6T5Bi8uIQ0YL8mymzDEJ NzKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=IjaMA+ebK29TOJgXYEaav/KA9IPiV2tRaoxxYKiru7U=; b=y9KQwwdz5/cWf1D1aG7ELGLpRVdoShplk57jJ64UbrePLx5M9BUqUlNC6gjQkfq3yY AXigrNhHZXANfsg9vcvCgbhvyKSmmsK5cKHBrQsoxGgUlfxAhqv7NlXGpeRvF0u3V/5K AoaChMYyTmXlfJqcZ2IkaMMJ5Pj5J3hwXnx32tZ+LwmNm7rqmz6Uy7+7qnMtwPyEEyu/ trxBLa9jeV+voen322q1HFxhkwlSUPV//ygAqzT0Q7VgoUrLkcnD6oXdZ8sSQqQebEEL PdyUmewi4CF+YNh5HmsQMUwxkzWs8FE/bSZznIusmzbOKKpsHrl3aVQsHePJsvf+ccf5 7J0w== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id v64-v6si6670983oie.317.2018.07.29.23.26.28 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Jul 2018 23:26:28 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6U6JNnQ103352 for <linux-mm@kvack.org>; Mon, 30 Jul 2018 02:26:27 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2khtrnw07c-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for <linux-mm@kvack.org>; Mon, 30 Jul 2018 02:26:27 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for <linux-mm@kvack.org> from <rppt@linux.vnet.ibm.com>; Mon, 30 Jul 2018 07:26:24 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 30 Jul 2018 07:26:20 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6U6QJd936372526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 30 Jul 2018 06:26:19 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54A4611C058; Mon, 30 Jul 2018 09:26:31 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EDDF11C066; Mon, 30 Jul 2018 09:26:29 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.8.125]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 30 Jul 2018 09:26:28 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Mon, 30 Jul 2018 09:26:16 +0300 From: Mike Rapoport <rppt@linux.vnet.ibm.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: Eric Biggers <ebiggers3@gmail.com>, Andrea Arcangeli <aarcange@redhat.com>, Alexander Viro <viro@zeniv.linux.org.uk>, syzbot <syzbot+121be635a7a35ddb7dcb@syzkaller.appspotmail.com>, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Mike Rapoport <rppt@linux.vnet.ibm.com>, stable@vger.kernel.org Subject: [PATCH RESEND] userfaultfd: remove uffd flags from vma->vm_flags if UFFD_EVENT_FORK fails Date: Mon, 30 Jul 2018 09:26:15 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18073006-0028-0000-0000-000002E23C77 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18073006-0029-0000-0000-0000239A3BD6 Message-Id: <1532931975-25473-1-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-30_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=998 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807300073 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
[RESEND] userfaultfd: remove uffd flags from vma->vm_flags if UFFD_EVENT_FORK fails
|
expand
|
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 594d192b2331..bad9cea37f12 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -633,8 +633,10 @@ static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, /* the various vma->vm_userfaultfd_ctx still points to it */ down_write(&mm->mmap_sem); for (vma = mm->mmap; vma; vma = vma->vm_next) - if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) + if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) { vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; + vma->vm_flags &= ~(VM_UFFD_WP | VM_UFFD_MISSING); + } up_write(&mm->mmap_sem); userfaultfd_ctx_put(release_new_ctx);
The fix in commit 0cbb4b4f4c44 ("userfaultfd: clear the vma->vm_userfaultfd_ctx if UFFD_EVENT_FORK fails") cleared the vma->vm_userfaultfd_ctx but kept userfaultfd flags in vma->vm_flags that were copied from the parent process VMA. As the result, there is an inconsistency between the values of vma->vm_userfaultfd_ctx.ctx and vma->vm_flags which triggers BUG_ON in userfaultfd_release(). Clearing the uffd flags from vma->vm_flags in case of UFFD_EVENT_FORK failure resolves the issue. Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Reported-by: syzbot+121be635a7a35ddb7dcb@syzkaller.appspotmail.com Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Eric Biggers <ebiggers3@gmail.com> Cc: stable@vger.kernel.org --- fs/userfaultfd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)