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 X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ED0CC433DB for ; Thu, 18 Feb 2021 20:26:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D29FF64EE0 for ; Thu, 18 Feb 2021 20:26:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D29FF64EE0 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2ECDB6B0006; Thu, 18 Feb 2021 15:26:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C36C6B006C; Thu, 18 Feb 2021 15:26:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DA206B006E; Thu, 18 Feb 2021 15:26:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 074906B0006 for ; Thu, 18 Feb 2021 15:26:50 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B500A180300CC for ; Thu, 18 Feb 2021 20:26:49 +0000 (UTC) X-FDA: 77832522138.21.BCF64FC Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf14.hostedemail.com (Postfix) with ESMTP id E1F5CC0001FE for ; Thu, 18 Feb 2021 20:26:44 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id z9so2236845pjl.5 for ; Thu, 18 Feb 2021 12:26:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GC4n6p0kCS6da68jsD6jAKKzKuFPDfyocm7j6MYSTS8=; b=uInv/ZqoBJmasKXFM/O8yXdM4LTRC1zztGi57d3m+qWoPYlp4vepNpjPUOLwPS3+GY 2l0ltb4aK3RgZ53X5mpdYs7V5ViAR49cUI65Za/4iILIlfhMvA2gQbpDSwhDplVFR+bD j93/IqG09Yw8LsIVnG5WotNR+D4e3gmA7GMbYdauLrjfy1KG8rrLV8j4FaKqK76uW+b2 hAV4oQKw5d7iiK2A1s8qlr3tgO8yehsx3m8QdqY5brt3gCttkX/eTvEV3pGaVye/z5P8 5pvw96XJr6z63Wdrb3VUBILPWqQWZ2ZAUqZj4jVqVo2202J/Mvse/lpKK5MYb2UKFPOe XK8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GC4n6p0kCS6da68jsD6jAKKzKuFPDfyocm7j6MYSTS8=; b=D7gTjyESgO3ZACWGGHmjYPGarQuTQ2BQlOVdqALIgzFpgZ5QMzb5cAvKfCrUuNSEh2 0RsobKe3771SBseKSy83TYfmsP8+iSQlNxiJChGR3bClbZ8cXC8zGz+StW0GcgxSAatC 4jSjf7FD+jc2Rw2BikQelFU5JPJ1KxYHCvVmYdNXsSXikqw+WjuihWlVp6xyCafMpzRJ 6x/yAWlevXVM9StK4UsdFYMbEA4x9QS2nONDMj/GeqGvuM98uaSyGmQBmwgu01Y0lgPg TUrrGMjaX5DLF2dWwBG3N2JnjX/gXRdLau2ABjEmb/7ay2jUaHvMHDXi79HYFy1dcrDk TM8A== X-Gm-Message-State: AOAM530JdyVVaddHoKCq1XB8iB7DyEAZsnjfscu3SqUJ6VgLhpGV6Lou DpLJFJLxVKt0rscQJ+gliOqSoxz7T3lpgdlQLtlR5Q== X-Google-Smtp-Source: ABdhPJxXYZ8X96dHztKkDqT+MVkht4oVMUav1kzWZU9nbaVtab3gCQiGMxFpmDM7RLj+0nCgOdO31NBcKYPsmKtvr/Q= X-Received: by 2002:a17:90b:350b:: with SMTP id ls11mr5575629pjb.166.1613680008214; Thu, 18 Feb 2021 12:26:48 -0800 (PST) MIME-Version: 1.0 References: <487751e1ccec8fcd32e25a06ce000617e96d7ae1.1613595269.git.andreyknvl@google.com> <509c1c80-bb2c-0c5c-ffa3-939ca40d2646@redhat.com> In-Reply-To: <509c1c80-bb2c-0c5c-ffa3-939ca40d2646@redhat.com> From: Andrey Konovalov Date: Thu, 18 Feb 2021 21:26:36 +0100 Message-ID: Subject: Re: [PATCH] mm, kasan: don't poison boot memory To: David Hildenbrand Cc: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , George Kennedy , Konrad Rzeszutek Wilk , Will Deacon , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , Christoph Hellwig , kasan-dev , Linux ARM , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: w37sa7qo9653oj8zrctdiphb4atiyzpg X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E1F5CC0001FE Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=mail-pj1-f48.google.com; client-ip=209.85.216.48 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1613680004-2362 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: On Thu, Feb 18, 2021 at 8:46 PM David Hildenbrand wrote: > > > 1. For KASAN_GENERIC: leave everything as is to be able to detect > > these boot-time bugs. > > > > 2. For KASAN_SW_TAGS: remove boot-time poisoning via > > kasan_free_pages(), but use the "invalid" tag as the default shadow > > value. The end result should be the same: bad accesses will be > > detected. For unallocated memory as it has the default "invalid" tag, > > and for allocated memory as it's poisoned properly when > > allocated/freed. > > > > 3. For KASAN_HW_TAGS: just remove boot-time poisoning via > > kasan_free_pages(). As the memory tags have a random unspecified > > value, we'll still have a 15/16 chance to detect a memory corruption. > > > > This also makes sense from the performance perspective: KASAN_GENERIC > > isn't meant to be running in production, so having a larger perf > > impact is acceptable. The other two modes will be faster. > > Sounds in principle sane to me. I'll post a v2 soon, thanks! > Side note: I am not sure if anybody runs KASAN in production. Memory is > expensive. Feel free to prove me wrong, I'd be very interest in actual > users. We run KASAN_SW_TAGS on some dogfood testing devices, and KASAN_HW_TAGS is being developed with the goal to be running in production.