Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6731440rdb; Fri, 15 Dec 2023 07:02:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IExDPmNGHyYk0tzjEhvBQlggnAthNWyHzrqiEP4qoSigJhoRJMYE/uIraEOOcpfs0Mb3O3u X-Received: by 2002:a17:906:49:b0:a23:f3b:16f8 with SMTP id 9-20020a170906004900b00a230f3b16f8mr3027811ejg.76.1702652545085; Fri, 15 Dec 2023 07:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702652545; cv=none; d=google.com; s=arc-20160816; b=aqvEN5O5ByzChVbyYRntSEjWgPM7LJZXlopMNL2QC5jRloHE4knFcYbtFUNpgqkvi3 R7GEY05ZUIL6pqLd6T3PCBm9felYkHJ+Y9oxiKAvKHBay27fpzBMoeTFPHrXn/G6+rw6 dq3/WMasL0CfBlthdeQC7b5LJ5M0Jb/w6ghVj5y0HswC4/QsG8CuYKCWH/Ww72/c+FdY yZG/6jEwiSGranJKYO5ntAXqkoEXzv7SHos95479mWUOb3GTPtGX414iPprAh43yLVyt ve+r3q0Qx9x6XnHNsFQ9Tqx3hHaL4k+ekBFIdXyD7bQB8CmaRlB7ul3s9o7Z1G6wV5gZ Rzrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fpNr8tLv7DaR3O7eSvBZDrzrhRmQRH0saU7oGWLT/Ng=; fh=MF7WwSk0VzPfZP2tfdT19Q8IVVWatFc3ZTHPX7JwHfU=; b=o4mkYGz5FZMcVSFZUlJMETfGVueUzn62+ta1pDFQ7euy5EP9i3Vjw/pyDh9DMTd/jZ ft+7PIet4O4tDILnM1illMJMjkcqQZynOGN5ThCmVIyWPZzH/E7SrhWtqLIDWbvfQTbi VXcYVwb+FpQb9E9xPwlqmRIMJ7eCKO8k7ENdIe/JAJE8mNLvw1D1pTPeF47i3F2+WHGk VX1vD0oZCHMG/qghg+lmeW26Gud+DWYETkyyuU6Hf7v97I0RhOU1QJqn/8PiF9hqTk0v LIhjn7Cwaew+5t1ZE3MTvbbwYdBRfDhzWeD+waQd+HJGkH49RShGCwkOGtUxqfOXxjeu QO+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QEP7jk7Q; spf=pass (google.com: domain of linux-kernel+bounces-1147-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1147-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n6-20020a170906118600b00a1ce221cac1si7713345eja.1015.2023.12.15.07.02.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 07:02:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1147-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=QEP7jk7Q; spf=pass (google.com: domain of linux-kernel+bounces-1147-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1147-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E6E791F24C9A for ; Fri, 15 Dec 2023 15:02:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 246CB37166; Fri, 15 Dec 2023 15:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QEP7jk7Q" X-Original-To: linux-kernel@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 454CE36AFF for ; Fri, 15 Dec 2023 15:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fpNr8tLv7DaR3O7eSvBZDrzrhRmQRH0saU7oGWLT/Ng=; b=QEP7jk7QKVzggKrwd8F8h78Y8i Xxq+GkDU4ZLXQka8SyG5MAc6oqRvmsXdnT3l6YfPtOzsakpYEMzl4/iV7V4icASVErZ82fn8xG82Q H7WPX35sxIEx+ESMNW3lj3J9A1v08xQ44JW4HOewQwkIlJr1oCxavk2JBTDqmq0JzOS3kk2l0EsuC YmvPhA8C0eMlPugu4A70uwIjwQ07tjkbuCUSfEC61c/9H4bdFe7wmHLdSKZm4dwdWFtizJHmXeA8U YfvrugFq3wI7xqhwlHp6b5WIkA6TyvCDDJ9cNIdgRU44UQUK6NVRpGE5LjSThBIP0wyQ5AHb29Uw8 JvSBWkRw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rE9h0-000Yy1-IV; Fri, 15 Dec 2023 15:01:34 +0000 Date: Fri, 15 Dec 2023 15:01:34 +0000 From: Matthew Wilcox To: Baolin Wang Cc: akpm@linux-foundation.org, david@redhat.com, ying.huang@intel.com, ziy@nvidia.com, xuyu@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: migrate: fix getting incorrect page mapping during page migration Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Dec 15, 2023 at 02:51:43PM +0000, Matthew Wilcox wrote: > I'm not saying no to this fix, but dump_mapping() is supposed to be > resilient against this. Is the issue that 'dentry' is NULL, or is it > some field within dentry that is NULL? eg, would this fix your > case? Uh, dentry is an on-stack dentry. So obviously it's a pointer within it that's NULL. Maybe this, having stared at the implementation of %pd? +++ b/fs/inode.c @@ -588,7 +588,8 @@ void dump_mapping(const struct address_space *mapping) } dentry_ptr = container_of(dentry_first, struct dentry, d_u.d_alias); - if (get_kernel_nofault(dentry, dentry_ptr)) { + if (get_kernel_nofault(dentry, dentry_ptr) || + !dentry->d_parent || !dentry->d_name) { pr_warn("aops:%ps ino:%lx invalid dentry:%px\n", a_ops, ino, dentry_ptr); return;