From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0095EC433FE for ; Fri, 25 Mar 2022 22:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233940AbiCYWoD (ORCPT ); Fri, 25 Mar 2022 18:44:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233939AbiCYWn4 (ORCPT ); Fri, 25 Mar 2022 18:43:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E0E20A3B5 for ; Fri, 25 Mar 2022 15:42:00 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id B5783614BD for ; Fri, 25 Mar 2022 22:41:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13EE5C340ED; Fri, 25 Mar 2022 22:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1648248119; bh=tPKRjWYzi26HPTYUNUmSjZv2xULdxoI44PNsNPhnpYw=; h=Date:To:From:Subject:From; b=ZoSvfVWyuIpEIdKXXFxgLfHSCd4Lan4VPAZUB6VtzI55naQUB0Y6KYbtSupGTtV8Q FT/lcSQcnxKwkckNhx/vwnnmXSrKTF+jJJIWlKWuYMwKnJ1YRrHHMdsvlW7NZvIhlR OXe7WtbREnKZj2xJLIjfSbV1SJESZgm4/EZTMaMQ= Date: Fri, 25 Mar 2022 15:41:58 -0700 To: mm-commits@vger.kernel.org, will@kernel.org, vincenzo.frascino@arm.com, ryabinin.a.a@gmail.com, pcc@google.com, mark.rutland@arm.com, glider@google.com, eugenis@google.com, elver@google.com, dvyukov@google.com, catalin.marinas@arm.com, andreyknvl@google.com, akpm@linux-foundation.org From: Andrew Morton Subject: [merged] kasan-page_alloc-init-memory-of-skipped-pages-on-free.patch removed from -mm tree Message-Id: <20220325224159.13EE5C340ED@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: kasan, page_alloc: init memory of skipped pages on free has been removed from the -mm tree. Its filename was kasan-page_alloc-init-memory-of-skipped-pages-on-free.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Andrey Konovalov Subject: kasan, page_alloc: init memory of skipped pages on free Since commit 7a3b83537188 ("kasan: use separate (un)poison implementation for integrated init"), when all init, kasan_has_integrated_init(), and skip_kasan_poison are true, free_pages_prepare() doesn't initialize the page. This is wrong. Fix it by remembering whether kasan_poison_pages() performed initialization, and call kernel_init_free_pages() if it didn't. Reordering kasan_poison_pages() and kernel_init_free_pages() is OK, since kernel_init_free_pages() can handle poisoned memory. Link: https://lkml.kernel.org/r/1d97df75955e52727a3dc1c4e33b3b50506fc3fd.1643047180.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov Acked-by: Marco Elver Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Catalin Marinas Cc: Dmitry Vyukov Cc: Evgenii Stepanov Cc: Mark Rutland Cc: Peter Collingbourne Cc: Vincenzo Frascino Cc: Will Deacon Signed-off-by: Andrew Morton --- mm/page_alloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/mm/page_alloc.c~kasan-page_alloc-init-memory-of-skipped-pages-on-free +++ a/mm/page_alloc.c @@ -1371,11 +1371,16 @@ static __always_inline bool free_pages_p * With hardware tag-based KASAN, memory tags must be set before the * page becomes unavailable via debug_pagealloc or arch_free_page. */ - if (init && !kasan_has_integrated_init()) - kernel_init_free_pages(page, 1 << order); - if (!skip_kasan_poison) + if (!skip_kasan_poison) { kasan_poison_pages(page, order, init); + /* Memory is already initialized if KASAN did it internally. */ + if (kasan_has_integrated_init()) + init = false; + } + if (init) + kernel_init_free_pages(page, 1 << order); + /* * arch_free_page() can make the page's contents inaccessible. s390 * does this. So nothing which can access the page's contents should _ Patches currently in -mm which might be from andreyknvl@google.com are stacktrace-add-interface-based-on-shadow-call-stack.patch arm64-scs-save-scs_sp-values-per-cpu-when-switching-stacks.patch arm64-implement-stack_trace_save_shadow.patch kasan-use-stack_trace_save_shadow.patch