From patchwork Thu Jun 17 09:30:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 12327103 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=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 C7C52C49361 for ; Thu, 17 Jun 2021 09:30:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 69C45613EE for ; Thu, 17 Jun 2021 09:30:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69C45613EE 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 01E916B0070; Thu, 17 Jun 2021 05:30:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F382C6B0071; Thu, 17 Jun 2021 05:30:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB2276B0072; Thu, 17 Jun 2021 05:30:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id A96596B0070 for ; Thu, 17 Jun 2021 05:30:39 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 495AA82860BA for ; Thu, 17 Jun 2021 09:30:39 +0000 (UTC) X-FDA: 78262695798.31.1C7B0C9 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf30.hostedemail.com (Postfix) with ESMTP id 8CE1EE000254 for ; Thu, 17 Jun 2021 09:30:31 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id k6so4507698pfk.12 for ; Thu, 17 Jun 2021 02:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=SYbkYhz8dgvzCxm2xx3ltQCVLS/WASlN9bfsoiUbbWc=; b=pyG2ezEonhSZpmiR9w4aRgJpSw8RrKIDfEN/1ZUcre+W2p6ZZp510AFg5X+vESCJmb DHG57hmznembCe+kf0HzmpX+0NbvWrMoC1SgDOwiwp3p+Mn6W5adffrRP22cXsE4JyRZ B1E116SwPNZiYGO0a+nvyOoy173iS+c0O04a8= 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:date:message-id:mime-version :content-transfer-encoding; bh=SYbkYhz8dgvzCxm2xx3ltQCVLS/WASlN9bfsoiUbbWc=; b=V+6m9+ORogbDgqch1ntwfcDEwStZZdVUzNr4d4cMsXMbSD6VJFF43GkTf5nkUyCEml XG/YWjY5QRtN1+52hpNpf16sJGn83qF09kO5zvY6OfZx+hT+n1i9inYdv93Vk0t55Ojr fGRcqgXPtSORQUT9co/yMLzE/MX9Rd0SZfKbH+JaBQd8Vg630P5BMFawmCSfmbAMQsnk QbP8O6TbSFD79TUaEPH+j1TxRhxbuRtEJPVBcTI5VppOqLPrK384TOr2JWYW4K1zzU64 OZsiwTsAH+5WqdtRySmtB90tBsxo83jG95LY2oT2rZiyAs4qAN0aZYbLGdtaWeWkwlDo U9Tg== X-Gm-Message-State: AOAM5309+hhBq8HG7IXUZ8jm9tcYR5qVa88vJQLvVWccjWE0pAXBZhZz s+R13zT0+SmSsEg3MmSMzIk7MQ== X-Google-Smtp-Source: ABdhPJw/s1VjEh3D7QkWvCRIIEN5527xrRUM8tuxsJLqyJbkFYCVDMC6zwTDygQITZ2gT3hpvoSTwA== X-Received: by 2002:a62:b502:0:b029:2ec:a539:e29b with SMTP id y2-20020a62b5020000b02902eca539e29bmr4319275pfe.37.1623922237921; Thu, 17 Jun 2021 02:30:37 -0700 (PDT) Received: from localhost ([203.206.29.204]) by smtp.gmail.com with ESMTPSA id fs10sm7733847pjb.31.2021.06.17.02.30.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:30:37 -0700 (PDT) From: Daniel Axtens To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, elver@google.com, akpm@linux-foundation.org, andreyknvl@gmail.com Cc: linuxppc-dev@lists.ozlabs.org, christophe.leroy@csgroup.eu, aneesh.kumar@linux.ibm.com, bsingharora@gmail.com, Daniel Axtens Subject: [PATCH v15 0/4] KASAN core changes for ppc64 radix KASAN Date: Thu, 17 Jun 2021 19:30:28 +1000 Message-Id: <20210617093032.103097-1-dja@axtens.net> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8CE1EE000254 X-Stat-Signature: adfdd4jzjhcoipq3c9nbkikfdb3ku9dx Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=axtens.net header.s=google header.b=pyG2ezEo; dmarc=none; spf=pass (imf30.hostedemail.com: domain of dja@axtens.net designates 209.85.210.175 as permitted sender) smtp.mailfrom=dja@axtens.net X-HE-Tag: 1623922231-151964 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: Building on the work of Christophe, Aneesh and Balbir, I've ported KASAN to 64-bit Book3S kernels running on the Radix MMU. I've been trying this for a while, but we keep having collisions between the kasan code in the mm tree and the code I want to put in to the ppc tree. This series just contains the kasan core changes that we need. These can go in via the mm tree. I will then propose the powerpc changes for a later cycle. (The most recent RFC for the powerpc changes is in the v12 series at https://lore.kernel.org/linux-mm/20210615014705.2234866-1-dja@axtens.net/ ) v15 applies to next-20210611. There should be no noticeable changes to other platforms. Changes since v14: Included a bunch of Reviewed-by:s, thanks Christophe and Marco. Cleaned up the build time error #ifdefs, thanks Christophe. Changes since v13: move the MAX_PTR_PER_* definitions out of kasan and into pgtable.h. Add a build time error to hopefully prevent any confusion about when the new hook is applicable. Thanks Marco and Christophe. Changes since v12: respond to Marco's review comments - clean up the help for ARCH_DISABLE_KASAN_INLINE, and add an arch readiness check to the new granule poisioning function. Thanks Marco. Daniel Axtens (4): kasan: allow an architecture to disable inline instrumentation kasan: allow architectures to provide an outline readiness check mm: define default MAX_PTRS_PER_* in include/pgtable.h kasan: use MAX_PTRS_PER_* for early shadow tables arch/s390/include/asm/pgtable.h | 2 -- include/asm-generic/pgtable-nop4d.h | 1 - include/linux/kasan.h | 6 +++--- include/linux/pgtable.h | 22 ++++++++++++++++++++++ lib/Kconfig.kasan | 14 ++++++++++++++ mm/kasan/common.c | 4 ++++ mm/kasan/generic.c | 3 +++ mm/kasan/init.c | 6 +++--- mm/kasan/kasan.h | 6 ++++++ mm/kasan/shadow.c | 8 ++++++++ 10 files changed, 63 insertions(+), 9 deletions(-) Reviewed-by: Balbir Singh