From patchwork Tue Jun 15 01:46:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 12320379 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=ham 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 45791C2B9F4 for ; Tue, 15 Jun 2021 01:47:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C5D7A61414 for ; Tue, 15 Jun 2021 01:47:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5D7A61414 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 115CC6B0036; Mon, 14 Jun 2021 21:47:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09F306B006E; Mon, 14 Jun 2021 21:47:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E33B36B0070; Mon, 14 Jun 2021 21:47:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id AC6586B0036 for ; Mon, 14 Jun 2021 21:47:12 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 397A0BBC8 for ; Tue, 15 Jun 2021 01:47:12 +0000 (UTC) X-FDA: 78254270304.31.C6CB72E Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf30.hostedemail.com (Postfix) with ESMTP id 079EDE000243 for ; Tue, 15 Jun 2021 01:47:05 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id k5so10848443pjj.1 for ; Mon, 14 Jun 2021 18:47:11 -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=Ok1AmBf91H6Q/IhwbEd4jKqOoWLU/Xv6mOEECK2NByo=; b=H4VDtuClI+xBARo/PkX4faHPWxSILJD209oddgYal3t0beaYPakrVo/4tTDPLfWJ3r gotXX1n6Iq929WNOAdC9iC1VR2H3HXFpK3i9YDiyBj5NeVven5qtdU0yZITIYwJfT18R R402qr5t3f3fnjNl8J8Y7kwZfOxy0uVpk1qNM= 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=Ok1AmBf91H6Q/IhwbEd4jKqOoWLU/Xv6mOEECK2NByo=; b=fe2nVkJXBQuOa0W1+lBlA7BG4TvZhQ8M+pZBtKN9JjNdEajiLWa8Pd+BIJyMtU5buC wwNROYY7no48WawNAZOLG4K+0Px6sR35U+BpflKh3MIVLfXYT63kr+283AvNwVf3M5// ziPfCyqR9CLMnI6gK1L3x2H7s3pbZM7drXJcCToXmpjaDxlWX5C6aipeXh75efUphNf4 WY8qbTpDE8/URqhxUyoUsqI3uCgOJlAzYnK5zIgmMG23lVDxbSIZN0jbAllsEi1Ssd6I BxKgq8W02aEaMAOwnUDnu4zb3RfGzytQyZ5rXu+z6sYQ3icBvZ7h/i7MXfe6XNWSlBRh wUhw== X-Gm-Message-State: AOAM530DCpVNKtirn5jOBaaVluEfTLB1M2SOI+N/6OZwLxHlEWpPTwc8 xp/HqeCLgUt/7m5Dg5zV/vpFhA== X-Google-Smtp-Source: ABdhPJwweEOVq3GJfsTJTL6yeQhZ4Ms23CXanMBJCKsQmXd9Q1u6Wl2KRDctbbN/XtM4RyiyKCDmeA== X-Received: by 2002:a17:90a:8546:: with SMTP id a6mr22237711pjw.128.1623721630780; Mon, 14 Jun 2021 18:47:10 -0700 (PDT) Received: from localhost ([203.206.29.204]) by smtp.gmail.com with ESMTPSA id gl13sm628913pjb.5.2021.06.14.18.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 18:47:10 -0700 (PDT) From: Daniel Axtens To: 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, bsingharora@gmail.com Cc: elver@google.com, Daniel Axtens Subject: [PATCH v12 0/6] KASAN core changes for ppc64 radix KASAN Date: Tue, 15 Jun 2021 11:46:59 +1000 Message-Id: <20210615014705.2234866-1-dja@axtens.net> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=axtens.net header.s=google header.b=H4VDtuCl; spf=pass (imf30.hostedemail.com: domain of dja@axtens.net designates 209.85.216.48 as permitted sender) smtp.mailfrom=dja@axtens.net; dmarc=none X-Stat-Signature: dnpr4knwc38x5w59n4x1owt4jdoey5iy X-Rspamd-Queue-Id: 079EDE000243 X-Rspamd-Server: rspam06 X-HE-Tag: 1623721625-234128 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. So my aim here is for patches 1 through 4 or 1 through 5 to go in via the mm tree. I will then propose the powerpc changes for a later cycle. (I have attached them to this series as an RFC, and there are still outstanding review comments I need to attend to.) v12 applies to next-20210611. There should be no noticable changes to other platforms. Kind regards, Daniel Daniel Axtens (6): kasan: allow an architecture to disable inline instrumentation kasan: allow architectures to provide an outline readiness check kasan: define and use MAX_PTRS_PER_* for early shadow tables kasan: Document support on 32-bit powerpc powerpc/mm/kasan: rename kasan_init_32.c to init_32.c [RFC] powerpc: Book3S 64-bit outline-only KASAN support Documentation/dev-tools/kasan.rst | 7 +- Documentation/powerpc/kasan.txt | 58 +++++++++++ arch/powerpc/Kconfig | 4 +- arch/powerpc/Kconfig.debug | 3 +- arch/powerpc/include/asm/book3s/64/hash.h | 4 + arch/powerpc/include/asm/book3s/64/pgtable.h | 4 + arch/powerpc/include/asm/book3s/64/radix.h | 13 ++- arch/powerpc/include/asm/kasan.h | 22 +++++ arch/powerpc/kernel/Makefile | 11 +++ arch/powerpc/kernel/process.c | 16 ++-- arch/powerpc/kvm/Makefile | 5 + arch/powerpc/mm/book3s64/Makefile | 9 ++ arch/powerpc/mm/kasan/Makefile | 3 +- .../mm/kasan/{kasan_init_32.c => init_32.c} | 0 arch/powerpc/mm/kasan/init_book3s_64.c | 95 +++++++++++++++++++ arch/powerpc/mm/ptdump/ptdump.c | 20 +++- arch/powerpc/platforms/Kconfig.cputype | 1 + arch/powerpc/platforms/powernv/Makefile | 6 ++ arch/powerpc/platforms/pseries/Makefile | 3 + include/linux/kasan.h | 18 +++- lib/Kconfig.kasan | 14 +++ mm/kasan/common.c | 4 + mm/kasan/generic.c | 3 + mm/kasan/init.c | 6 +- mm/kasan/kasan.h | 4 + mm/kasan/shadow.c | 4 + 26 files changed, 316 insertions(+), 21 deletions(-) create mode 100644 Documentation/powerpc/kasan.txt rename arch/powerpc/mm/kasan/{kasan_init_32.c => init_32.c} (100%) create mode 100644 arch/powerpc/mm/kasan/init_book3s_64.c