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 3EF1DC433DB for ; Mon, 22 Mar 2021 00:55:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B92AF61946 for ; Mon, 22 Mar 2021 00:55:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B92AF61946 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 05B8B6B0036; Sun, 21 Mar 2021 20:55:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 031646B006C; Sun, 21 Mar 2021 20:55:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3BCA6B0070; Sun, 21 Mar 2021 20:55:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id CB3426B0036 for ; Sun, 21 Mar 2021 20:55:13 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8C2351DF8 for ; Mon, 22 Mar 2021 00:55:13 +0000 (UTC) X-FDA: 77945691306.30.0DE5A84 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf11.hostedemail.com (Postfix) with ESMTP id 09686200024C for ; Mon, 22 Mar 2021 00:55:12 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id ay2so5660368plb.3 for ; Sun, 21 Mar 2021 17:55:12 -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=YhjptOa1YLY02YG0NxjiEXQDPMTypn5KHITe161ubW8=; b=XjyhafFAg3wXva8WM5LObDDfgCIfrUS6S3ztJ28AyYH/b2GPcOTLtgLxtWECmkpr7l vGJZHDY1tif2FC7KyD8ToeYPd4bK/ePagyiqCdBq4UAIjnJF50hIlo6EayblM8ugIYFx GZ9LLX+CzSqud+1wJjwvebJKayc9NoySTnoh0= 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=YhjptOa1YLY02YG0NxjiEXQDPMTypn5KHITe161ubW8=; b=JaGd+089aT0me1HKSYb6fRf3KxrPgGuGUw9BgBzm3WLj0U18EgtLSxZs0w1zpJAHeF AWI8y8PNWYWoCxtyhvIoIeVS6x2rEIqnHwbYLscYscX6cMGXsOUI6YrGm78ivOZWz4sP YIw+Rdn1zACArCqzfBjygWdj8SaW4lIxMq+Zxrx5T4peu+6i9d8uarN6bVYSIco7HiGp u9epdXBXLYQQi2YhIW558w3WXPpxdwerRT5LTr5FzthAPmfekzcNnssE6x3inKjLJFbt I/zT2TKRDn+sdOHnOdWrrqHNeWECusEE4bJwncs7XwOPnkLNmaIxuskBpR4PSItA6FCE 5u6g== X-Gm-Message-State: AOAM532GJWQykO4G55cv54LbdhdD3QPrCcWDIWKRqSjYsoZd70z3hWq1 BBcwqpAKXXNkqLquYA2CVDmP/Q== X-Google-Smtp-Source: ABdhPJzRcD3yNsaQ3jmRQ0MduvBzp8dYAxJ2WA2adD1Mh26gwWUxEkRCqKjrQfqNc13bL5NgiJ09qg== X-Received: by 2002:a17:902:e546:b029:e5:ec5e:6bf4 with SMTP id n6-20020a170902e546b02900e5ec5e6bf4mr24400618plf.41.1616374511814; Sun, 21 Mar 2021 17:55:11 -0700 (PDT) Received: from localhost (2001-44b8-1113-6700-b0f2-84a1-ce9a-a0fd.static.ipv6.internode.on.net. [2001:44b8:1113:6700:b0f2:84a1:ce9a:a0fd]) by smtp.gmail.com with ESMTPSA id j21sm11603072pfc.114.2021.03.21.17.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Mar 2021 17:55:11 -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: <20210320060259.GF77072@balbir-desktop> References: <20210319144058.772525-1-dja@axtens.net> <20210319144058.772525-7-dja@axtens.net> <20210320060259.GF77072@balbir-desktop> Date: Mon, 22 Mar 2021 11:55:08 +1100 Message-ID: <87o8fcatxv.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain X-Stat-Signature: z4e7wqq9iiuitbf153k65jp3pgp8d5nj X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 09686200024C Received-SPF: none (axtens.net>: No applicable sender policy available) receiver=imf11; identity=mailfrom; envelope-from=""; helo=mail-pl1-f179.google.com; client-ip=209.85.214.179 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616374512-673234 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: 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? >> + * 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? Kind regards, Daniel > > Looks good otherwise, I've not been able to test it yet > > Balbir Singh.