From patchwork Thu Dec 12 15:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 11288551 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF2CA1593 for ; Thu, 12 Dec 2019 15:17:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7C919205C9 for ; Thu, 12 Dec 2019 15:17:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=axtens.net header.i=@axtens.net header.b="q7DQztUh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C919205C9 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 963048E0006; Thu, 12 Dec 2019 10:17:04 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 913768E0001; Thu, 12 Dec 2019 10:17:04 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8027A8E0006; Thu, 12 Dec 2019 10:17:04 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 67D178E0001 for ; Thu, 12 Dec 2019 10:17:04 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 22FA42493 for ; Thu, 12 Dec 2019 15:17:04 +0000 (UTC) X-FDA: 76256842368.10.sand71_77dda5105920b X-Spam-Summary: 2,0,0,0d66f700c210ccd3,d41d8cd98f00b204,dja@axtens.net,:linux-kernel@vger.kernel.org::linuxppc-dev@lists.ozlabs.org:kasan-dev@googlegroups.com:christophe.leroy@c-s.fr:aneesh.kumar@linux.ibm.com:bsingharora@gmail.com:dja@axtens.net,RULES_HIT:41:355:379:541:973:988:989:1260:1311:1314:1345:1437:1515:1535:1542:1711:1730:1747:1777:1792:1801:2393:2559:2562:2693:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3873:3874:4250:4605:5007:6119:6248:6261:6653:6755:7903:9040:10004:11026:11473:11657:11658:11914:12043:12048:12219:12296:12297:12517:12519:12555:12679:12895:13869:13894:14096:14181:14394:14721:21080:21433:21444:21451:21627:21740:21810:21819:30005:30012:30054:30070:30074,0,RBL:209.85.215.196:@axtens.net:.lbl8.mailshell.net-62.2.0.100 66.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:39,LUA_SUMMARY:none X-HE-Tag: sand71_77dda5105920b X-Filterd-Recvd-Size: 5071 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Dec 2019 15:17:03 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id x7so1286450pgl.11 for ; Thu, 12 Dec 2019 07:17:03 -0800 (PST) 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=v26BsJHtOrSEIqcupCpn6pVHwbqhLlNjRKE6OChruw8=; b=q7DQztUhC2cJBLWp8U64RWDfNoq8AbBYU8MfDcKAjAFGPJpPnE3FAqVtyqVKY+ZAqn qMLB/MGQif2yiI3NOW7QGUKPa2TozBJMY2FgfNVz0e4txIKABIoAdygoKGywYQN+O2Vo Nkke2edKnZCvy5sqTt3NpxXWt8nNTJADHSHOU= 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=v26BsJHtOrSEIqcupCpn6pVHwbqhLlNjRKE6OChruw8=; b=dHfEMCP5Oh4A/WftPInfjk0ZwahHdU7+JLDPsObDAF3i1DHNT+M/hV6gEHgIRUj161 JUeqMkIYJ4q1o36s9jYw4W7Ph0x9ymT5ahooPPZxtLOCStg4A5zU8DZzyLnZSw5AIegg ELYLj4y8x5/Q8eRK53O2k42yCCpppERZFQPyaaO4ZOawSSSfiIr1K++KbiScQHATXHyl iK4GCey2WuUYnZCMVKYbwcsZAikdpc06JWfCv4sUNlnnoxr2s4E47j7SpC0C2noxgQNq E8nX5NzxVzhGMIHg4Ygq4wQFjjwmJhD8DuYq7r2jyleB75uwJbnWuJBXOaP1zwzMYfGd eOCg== X-Gm-Message-State: APjAAAU8PCn6ZZeutaieuM/2RULjRVLMRIC/wVFiFllfwECEe95rbXQz yRypv0yNytEivtcPa92th3G13w== X-Google-Smtp-Source: APXvYqwZHmuzKnMIkPQu7WYLto/58IR4TZmFj0304fSKWKFda3vIFLGQeA7OjH96Yx4Qnd6rYUHK5g== X-Received: by 2002:aa7:90c4:: with SMTP id k4mr10406197pfk.216.1576163822527; Thu, 12 Dec 2019 07:17:02 -0800 (PST) Received: from localhost (2001-44b8-1113-6700-b116-2689-a4a9-76f8.static.ipv6.internode.on.net. [2001:44b8:1113:6700:b116:2689:a4a9:76f8]) by smtp.gmail.com with ESMTPSA id 5sm6415205pjc.29.2019.12.12.07.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 07:17:01 -0800 (PST) From: Daniel Axtens To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, kasan-dev@googlegroups.com, christophe.leroy@c-s.fr, aneesh.kumar@linux.ibm.com, bsingharora@gmail.com Cc: Daniel Axtens Subject: [PATCH v3 0/3] KASAN for powerpc64 radix Date: Fri, 13 Dec 2019 02:16:53 +1100 Message-Id: <20191212151656.26151-1-dja@axtens.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 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. This provides full inline instrumentation on radix, but does require that you be able to specify the amount of physically contiguous memory on the system at compile time. More details in patch 3. v3: Reduce the overly ambitious scope of the MAX_PTRS change. Document more things, including around why some of the restrictions apply. Clean up the code more, thanks Christophe. v2: The big change is the introduction of tree-wide(ish) MAX_PTRS_PER_{PTE,PMD,PUD} macros in preference to the previous approach, which was for the arch to override the page table array definitions with their own. (And I squashed the annoying intermittent crash!) Apart from that there's just a lot of cleanup. Christophe, I've addressed most of what you asked for and I will reply to your v1 emails to clarify what remains unchanged. Daniel Axtens (3): kasan: define and use MAX_PTRS_PER_* for early shadow tables kasan: Document support on 32-bit powerpc powerpc: Book3S 64-bit "heavyweight" KASAN support Documentation/dev-tools/kasan.rst | 7 +- Documentation/powerpc/kasan.txt | 122 ++++++++++++++++++ arch/powerpc/Kconfig | 3 + arch/powerpc/Kconfig.debug | 21 +++ arch/powerpc/Makefile | 11 ++ arch/powerpc/include/asm/book3s/64/hash.h | 4 + arch/powerpc/include/asm/book3s/64/pgtable.h | 7 + arch/powerpc/include/asm/book3s/64/radix.h | 5 + arch/powerpc/include/asm/kasan.h | 21 ++- arch/powerpc/kernel/process.c | 8 ++ arch/powerpc/kernel/prom.c | 64 ++++++++- arch/powerpc/mm/kasan/Makefile | 3 +- .../mm/kasan/{kasan_init_32.c => init_32.c} | 0 arch/powerpc/mm/kasan/init_book3s_64.c | 72 +++++++++++ include/linux/kasan.h | 18 ++- mm/kasan/init.c | 6 +- 16 files changed, 359 insertions(+), 13 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