Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1624954rwb; Fri, 13 Jan 2023 15:14:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXsW23QsVPYipldt1MXRWVUooZNz0aXkqxHALciPveiQ7NSDiAfcyrVylq/3EZPt8YQcRoKM X-Received: by 2002:a17:906:3453:b0:84d:39ba:368b with SMTP id d19-20020a170906345300b0084d39ba368bmr21595172ejb.75.1673651678184; Fri, 13 Jan 2023 15:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673651678; cv=none; d=google.com; s=arc-20160816; b=MaXmgWNcbAqRvqvjbFHgSIBYZaRlwp0ZZaBFpkCkQmQB3yOpBTZBNvvqSmb/VFKdMz PvoAGuY80LQtAXwaxQEOy5yACDqZ69SdANIx0TIX1OZ+3ZafAK3anUQILONw2BfWEfBM 19TU3LbRz3P7rZNoFE0nS6W3aOgiUITg4sXW7xuiH8dZ50sKY1iK+ihsBzaeI/oY1KbJ JRokcW3ikvxvhdV1I2siaVaslp3nAlSTtKG51rGMaORwPwdFhiOyUTJGP//+DmimRj0R ONDs3aC6iKR38NBaefzgmR5lqd5XFXMTI4e3t0KshwrlW0usqT7MjUOeDeSAGrPjvJzo dLGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R7IouVosv4fh4wK8p/mMaRaWDR3x1iBwx4JUJte1dCE=; b=j1Iao6l+upe8cC7kSIGM35ilKereZBX/JtCllMHEoC4h7Tsa5d7yxbaWd8XPgNnkws zxL1v7N+0bK9EjOc7SS6AJ1/Xbib74C62riJqcgPUYZNUq5YZzEL7RSwtQP9BJo08qwt 4hGQZisdN5VvVkTjIPBzS2XxxNGLMRZ2YicBkEIL7wJaVFkFipvkLBo3ujMMc33I6y/S XP5mz9ZqIS5aEkvFVTx0OJLoITHHOlrbEc10RNWqCehyw/p/0hvFwJ9tZ/kmCeIBsLim wrttlLZ+65rqq+v/4q2QUB751In5cXMe3pJTIwoGhjCjIisfumszm1TXqE7pOUJRgaZm fWeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oqxOPvnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt9-20020a170906ee8900b0084b8885984bsi23226341ejb.517.2023.01.13.15.14.25; Fri, 13 Jan 2023 15:14:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oqxOPvnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbjAMWQQ (ORCPT + 52 others); Fri, 13 Jan 2023 17:16:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjAMWQN (ORCPT ); Fri, 13 Jan 2023 17:16:13 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DCD412AAB for ; Fri, 13 Jan 2023 14:16:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 67CCECE21AB for ; Fri, 13 Jan 2023 22:16:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4D95C433EF; Fri, 13 Jan 2023 22:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673648168; bh=jNFq9DR9fflrZIbqu8UmHOJl+ac80dvlW2mJLqpUET4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oqxOPvncCYYsHc2zoO8qCejMi3nRQFIbfpDIa0vowBMc1z+WNsSPyP1juY/HY3PRP ZPjbfPYCVLMJm4bRRMCDuw0cFUjCjZkPmEDFaSlXOJNM/vAtzA19kLuI3qGD2wFU4i hUzXOMeH8J7AlDK6lMa7w5L4/Aczug++BKLkPBczDxZ8G8oz0e+oNHY7DbR3cUyEtS TM+EHsdsOIQ1ma5J5zGc3Oqzx5CMWZPosWDsHjak8H75aKgX3sG+heb83p9SQ7yY2/ 97PJjRCcUKoUdqnUFfK2B2nCg0lGT0dblNd0aCA+BCp87j5T/N5cCdoCFEQF83T92J 6uGeJENIJXqoA== From: SeongJae Park To: Lorenzo Stoakes Cc: David Hildenbrand , Marek Szyprowski , Kefeng Wang , akpm@linux-foundation.org, willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: Re: [PATCH -next 5/7] mm: memory: convert wp_page_copy() to use folios Date: Fri, 13 Jan 2023 22:16:06 +0000 Message-Id: <20230113221606.1370-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Hello, On Fri, 13 Jan 2023 19:04:14 +0000 Lorenzo Stoakes wrote: > On Fri, Jan 13, 2023 at 02:08:36PM +0100, David Hildenbrand wrote: > > On 13.01.23 14:01, Marek Szyprowski wrote: > > > Hi > > > > > > On 12.01.2023 09:30, Kefeng Wang wrote: > > > > The old_page/new_page are converted to old_folio/new_folio in > > > > wp_page_copy(), then replaced related page functions to folio > > > > functions. > > > > > > > > Signed-off-by: Kefeng Wang > > > > > > This patch, merged into today's linux-next as commit 9ebae00c8e30 ("mm: > > > memory: convert wp_page_copy() to use folios"), causes serious stability > > > issues on my ARM based test boards. Here is the example of such crash: > > > > syzbot is also not happy: > > > > https://lkml.kernel.org/r/000000000000807c7805f2205df1@google.com > > > > -- > > Thanks, > > > > David / dhildenb > > > > This also completely broke my qemu environment. Same to me. > > In that thread Willy points out that the issue stems from blindly assigning > page_folio(old_page) to old_folio without checking whether it is NULL first, > therefore triggering a NULL pointer deref. > > A quick fix would be to put in a check (as shown below) which fixes the issue, > but as Willy said, I think we should drop this until it can be fixed in a > respin. > > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3044,7 +3044,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) > struct vm_area_struct *vma = vmf->vma; > struct mm_struct *mm = vma->vm_mm; > struct page *old_page = vmf->page; > - struct folio *old_folio = page_folio(old_page); > + struct folio *old_folio = old_page ? page_folio(old_page) : NULL; Tested-by: SeongJae Park Thanks, SJ