Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp68253rdb; Thu, 16 Nov 2023 12:04:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9nRwTV8htCXtb8dfGp8wmXd7OuCxSQjZZAKWJfXa/51SVQgpH95YJKksdc9Yh2rHXCP55 X-Received: by 2002:a05:6a00:458d:b0:6bd:f760:6ab1 with SMTP id it13-20020a056a00458d00b006bdf7606ab1mr14687350pfb.14.1700165067874; Thu, 16 Nov 2023 12:04:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700165067; cv=none; d=google.com; s=arc-20160816; b=iLq/nqjWmeHe2WKaGBBPt0D8DHeWQp6tf3REO04lgjkOpiP2Uhda5lTJrtGdfBS+Za x+4qSCHd5QayoYcNAzNIawlTqsBmoHxwqbBilZw2PuNfrNlCUav3DmacWBkb+ZgfPNoH XwCOaztISHT8khz2EuU24BxEsMO5oY41C1bljZYGRP3f3hGoR8vyy8Wwljyrgjsm+Xj6 gZ9riakHEVe0QZPX6GjTZLCAjO8Op6KUbiaynZyyZH/auvupNac3+y5u5cmHFGAKDXLI ycAqlF3vRKI9zko38EH95tDiLLEF3HqIJJtIAwWILdvWkKv8/P3iUZTgK5v1GctPcC6x lFog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+4XQ4i8Y5DNwJiAj9ly/ReOTlxs9KYLdEh1NBejN2C4=; fh=HPvcIj+D01agDBU4+4vNYYFLLwKrlXgi4Jf2hIX45lE=; b=Pt1l15hcwo078yRbWavpgvM+XF0xHoCJd8uImai8P6c9+POjUsx7w6S4em+jPGm1or 7xBwZi2B3DeendfnPHsgmbwfb9QB8pRktVUKPOfJ6RpMX+4SYDo5EBuj9asaX/rtJYU0 W/UwhokEEhk3zovyZ4S6IoA1rjO8YryIy+ia45xKRJyBgDFEvyAqmrNq6L4RHg+opy5X q0nzPC9Mzp2/J7ZtMvPEBGEiOihwdkNwE5Y7Rdymg119YvBSrEas9wI9dPJBtWdkPdlW h6tIuIdpYGaqq2mYjYpnovuzebae8QjWoLjBlkPKwpF48e/hdgoM0hJUz6Du2mAvcYzv 3Crw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GuEyVXrQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y10-20020aa79e0a000000b0068fe8cac913si204620pfq.324.2023.11.16.12.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:04:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GuEyVXrQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C201180417EF; Thu, 16 Nov 2023 12:04:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345368AbjKPUEQ (ORCPT + 99 others); Thu, 16 Nov 2023 15:04:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbjKPUEP (ORCPT ); Thu, 16 Nov 2023 15:04:15 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20E231A8 for ; Thu, 16 Nov 2023 12:04:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700165051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+4XQ4i8Y5DNwJiAj9ly/ReOTlxs9KYLdEh1NBejN2C4=; b=GuEyVXrQuHVCQugwq+bPWiZUzUzD+RGg+iwWln9O5RNlrVAx9VI2tVPxxW2vILm25KYwh5 auWurIE7Rit4j8MjTMztQYtA4vjAItvwH6Yhfbj7t+ARRQSStA/AgJIn6ZXahF5Xhu/9kM ViOfi6tY0zRD4x0RDg4L9t/EXSXGoBY= Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-4A8Bd_ElMxGxhxUFh0sH-A-1; Thu, 16 Nov 2023 15:04:08 -0500 X-MC-Unique: 4A8Bd_ElMxGxhxUFh0sH-A-1 Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-1f00b6ba9d6so294988fac.0 for ; Thu, 16 Nov 2023 12:04:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700165048; x=1700769848; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+4XQ4i8Y5DNwJiAj9ly/ReOTlxs9KYLdEh1NBejN2C4=; b=LiFmIyhCzKEBOQ6tSo7AYJiJLHPva4tFE0Kgs0tkAyzHqIclvpy6Wm645ZCQzsDups /wg7X+yVEkMwaK0lr9fPGefs+IC4bBepSxn4SkHUUNBp5ENa4vL8W3xd3tpRONNTjCIn W9USEI/4RpPIHG6IotXzxNQfEl3DMv5rusRbcFP+MuOcaCN1dO2ZSu1y+HFBLUXKM1ff klLDl6lGJYp9WSwxVYGTH4Sk+uUrvXHUEAN2bq+ccI1at6cadWKiP0fFgyqZ6yz3b1pn /+eUJLzF+BCJ+JcqW1ijvq15dJna1CcB1GqsExX6XYZIgI2g1XegkPICzC/f0AJPw+RS EZfw== X-Gm-Message-State: AOJu0YwYD/RpjPgKHiquiCijmxxteAF0SrtfFA9vJKdvs8Q1GxR2HaUG 7WFN6PJCVyfrG8RdbEYBwd7aoPXr3bMsB1bsBK6Cactee/9uz7YNE8TPaVf/R3sub+dVtOFhU1k S8qACyJFEkbUpI5K+03i/Rcza X-Received: by 2002:a05:6870:2301:b0:1ea:7463:1b8f with SMTP id w1-20020a056870230100b001ea74631b8fmr10381849oao.0.1700165048057; Thu, 16 Nov 2023 12:04:08 -0800 (PST) X-Received: by 2002:a05:6870:2301:b0:1ea:7463:1b8f with SMTP id w1-20020a056870230100b001ea74631b8fmr10381812oao.0.1700165047537; Thu, 16 Nov 2023 12:04:07 -0800 (PST) Received: from x1n (cpe688f2e2cb7c3-cm688f2e2cb7c0.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id j17-20020ac86651000000b0041b3deef647sm33619qtp.8.2023.11.16.12.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:04:06 -0800 (PST) Date: Thu, 16 Nov 2023 15:04:04 -0500 From: Peter Xu To: David Hildenbrand Cc: Andrew Morton , syzbot , Muhammad Usama Anjum , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, wangkefeng.wang@huawei.com Subject: Re: [syzbot] [mm?] WARNING in unmap_page_range (2) Message-ID: References: <000000000000b0e576060a30ee3b@google.com> <20231115140006.cc7de06f89b1f885f4583af0@linux-foundation.org> <6308590a-d958-4ecc-a478-ba088cf7984d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6308590a-d958-4ecc-a478-ba088cf7984d@redhat.com> X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 12:04:17 -0800 (PST) On Thu, Nov 16, 2023 at 07:13:44PM +0100, David Hildenbrand wrote: > > It should be fine, as: > > > > static void make_uffd_wp_pte(struct vm_area_struct *vma, > > unsigned long addr, pte_t *pte) > > { > > pte_t ptent = ptep_get(pte); > > > > #ifndef CONFIG_USERFAULTFD_ > > > > if (pte_present(ptent)) { > > pte_t old_pte; > > > > old_pte = ptep_modify_prot_start(vma, addr, pte); > > ptent = pte_mkuffd_wp(ptent); > > ptep_modify_prot_commit(vma, addr, pte, old_pte, ptent); > > } else if (is_swap_pte(ptent)) { > > ptent = pte_swp_mkuffd_wp(ptent); > > set_pte_at(vma->vm_mm, addr, pte, ptent); > > } else { <----------------- this must be pte_none() already > > set_pte_at(vma->vm_mm, addr, pte, > > make_pte_marker(PTE_MARKER_UFFD_WP)); > > } > > } > > Indeed! Is pte_swp_mkuffd_wp() reasonable for pte markers? I rememebr that > we don't support multiple markers yet, so it might be good enough. Not really that reasonable, but nothing harmful either that I see so far; the current code handles any pte marker without caring any of those hint bits. I can also reproduce this syzbot error easily with !UFFD config on x86. Let me send the patchset to fix current known issues first. Thanks, -- Peter Xu