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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 960E3C433C1 for ; Mon, 22 Mar 2021 05:52:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2316F61966 for ; Mon, 22 Mar 2021 05:52:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2316F61966 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F37916B0036; Mon, 22 Mar 2021 01:33:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE9196B006C; Mon, 22 Mar 2021 01:33:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8CAB6B0070; Mon, 22 Mar 2021 01:33:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0236.hostedemail.com [216.40.44.236]) by kanga.kvack.org (Postfix) with ESMTP id BEFE16B0036 for ; Mon, 22 Mar 2021 01:33:15 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2128C6C2D for ; Mon, 22 Mar 2021 05:52:06 +0000 (UTC) X-FDA: 77946439452.21.D3E4F9E Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf20.hostedemail.com (Postfix) with ESMTP id 95D67135 for ; Mon, 22 Mar 2021 05:52:05 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id n11so7895703pgm.12 for ; Sun, 21 Mar 2021 22:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=jrTlyfiRQP0Jt7kq8QZFoM4VuMzt11eSTk3pvqVA7QY=; b=YAeNiVm0owARRZ8J86zOqgnrs/sywKok5qVDj67SztBIB9IHR+PwOEh/aZCWUCpE3L F16yrKLIthrKYhKCdHO1EAbhiFxaD72nFnwexy3ox4A7HBdijzE8VHG7jtptmM71QbQO Kl2vG24WjLENgZYdss4cmjq+iaeYGZfc5rHjY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=jrTlyfiRQP0Jt7kq8QZFoM4VuMzt11eSTk3pvqVA7QY=; b=VetPFTQeyhn5RNhm4cIu3i11k5RfbO1PQhoFRsmCHdyLjE8q7+nKLdfj2SCLN5ka7z +TpMVpL7tyAb+2zxySJBgFrKKFkn37GiB/v0s1vEs2a2xpx1JKuoyTT34RCuFAVwgAVP HKDm0NJegIlhURByLPlyG+3KOXsNgVCNNOHpae9RMHve9Wm4gZTQbaquItQiTAx8tQPS mL/jdZ5UCfOQN//ydSdwtJsEz2zR83tstv4lHu9xgfe8jSbCZC+hfvgMfneYzUfKv+tB HTAhFFNKUB5XPR3iJCyhvF5VvAhlNkbn/y0XsuFPdGcSYBdWdEShhWeDi6rG6KbnqjjR Upeg== X-Gm-Message-State: AOAM531o59c4FI4WmvrVXV1SOSoCiPjwzFA6v8N8DudV14G8ScYGqgYx Bpwjwp0dVMBVZ/ZI43qqhnzaFA== X-Google-Smtp-Source: ABdhPJxYnbJhRJz/PWii4fLjBsRW4wnnSFzmMWXqQj/ARd+zZPwmpUweQXWSFt4ROYZs7QIZ2x4FPg== X-Received: by 2002:aa7:9852:0:b029:211:6824:6c7d with SMTP id n18-20020aa798520000b029021168246c7dmr17530016pfq.19.1616392324492; Sun, 21 Mar 2021 22:52:04 -0700 (PDT) Received: from localhost (2001-44b8-1113-6700-b3b5-fa56-fd12-3c5a.static.ipv6.internode.on.net. [2001:44b8:1113:6700:b3b5:fa56:fd12:3c5a]) by smtp.gmail.com with ESMTPSA id nk3sm12514893pjb.17.2021.03.21.22.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 22:52:04 -0700 (PDT) From: Daniel Axtens To: Balbir Singh Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, kasan-dev@googlegroups.com, christophe.leroy@csgroup.eu, aneesh.kumar@linux.ibm.com Subject: Re: [PATCH v11 6/6] powerpc: Book3S 64-bit outline-only KASAN support In-Reply-To: <20210322025934.GG77072@balbir-desktop> References: <20210319144058.772525-1-dja@axtens.net> <20210319144058.772525-7-dja@axtens.net> <20210320060259.GF77072@balbir-desktop> <87o8fcatxv.fsf@dja-thinkpad.axtens.net> <20210322025934.GG77072@balbir-desktop> Date: Mon, 22 Mar 2021 16:52:00 +1100 Message-ID: <87lfafburj.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain X-Stat-Signature: ps87nf6m93cea9ohg84xp586n5a16gqo X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 95D67135 Received-SPF: none (axtens.net>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mail-pg1-f173.google.com; client-ip=209.85.215.173 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616392325-679222 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: Balbir Singh writes: > On Mon, Mar 22, 2021 at 11:55:08AM +1100, Daniel Axtens wrote: >> Hi Balbir, >> >> > Could you highlight the changes from >> > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170729140901.5887-1-bsingharora@gmail.com/? >> > >> > Feel free to use my signed-off-by if you need to and add/update copyright >> > headers if appropriate. >> >> There's not really anything in common any more: >> >> - ppc32 KASAN landed, so there was already a kasan.h for powerpc, the >> explicit memcpy changes, the support for non-instrumented files, >> prom_check.sh, etc. all already landed. >> >> - I locate the shadow region differently and don't resize any virtual >> memory areas. >> >> - The ARCH_DEFINES_KASAN_ZERO_PTE handling changed upstream and our >> handling for that is now handled more by patch 3. >> >> - The outline hook is now an inline function rather than a #define. >> >> - The init function has been totally rewritten as it's gone from >> supporting real mode to not supporting real mode and back. >> >> - The list of non-instrumented files has grown a lot. >> >> - There's new stuff: stack walking is now safe, KASAN vmalloc support >> means modules are better supported now, ptdump works, and there's >> documentation. >> >> It's been a while now, but I don't think when I started this process 2 >> years ago that I directly reused much of your code. So I'm not sure that >> a signed-off-by makes sense here? Would a different tag (Originally-by?) >> make more sense? >> > > Sure Will do. > >> >> + * The shadow ends before the highest accessible address >> >> + * because we don't need a shadow for the shadow. Instead: >> >> + * c00e000000000000 << 3 + a80e 0000 0000 0000 000 = c00fc00000000000 >> > >> > The comment has one extra 0 in a80e.., I did the math and had to use >> > the data from the defines :) >> >> 3 extra 0s, even! Fixed. >> >> >> +void __init kasan_init(void) >> >> +{ >> >> + /* >> >> + * We want to do the following things: >> >> + * 1) Map real memory into the shadow for all physical memblocks >> >> + * This takes us from c000... to c008... >> >> + * 2) Leave a hole over the shadow of vmalloc space. KASAN_VMALLOC >> >> + * will manage this for us. >> >> + * This takes us from c008... to c00a... >> >> + * 3) Map the 'early shadow'/zero page over iomap and vmemmap space. >> >> + * This takes us up to where we start at c00e... >> >> + */ >> >> + >> > >> > assuming we have >> > #define VMEMMAP_END R_VMEMMAP_END >> > and ditto for hash we probably need >> > >> > BUILD_BUG_ON(VMEMMAP_END + KASAN_SHADOW_OFFSET != KASAN_SHADOW_END); >> >> Sorry, I'm not sure what this is supposed to be testing? In what >> situation would this trigger? >> > > I am bit concerned that we have hard coded (IIR) 0xa80e... in the > config, any changes to VMEMMAP_END, KASAN_SHADOW_OFFSET/END > should be guarded. > Ah that makes sense. I'll come up with some test that should catch any unsynchronised changes to VMEMMAP_END, KASAN_SHADOW_OFFSET or KASAN_SHADOW_END. Kind regards, Daniel Axtens > Balbir Singh.