From patchwork Wed Nov 4 23:18:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11883263 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 EFC96C00A89 for ; Thu, 5 Nov 2020 05:10:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 605CD2151B for ; Thu, 5 Nov 2020 05:10:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3Ml9UBRg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="espk/a+O"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="mCfoY2cp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 605CD2151B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pYX1B+JzPLoMGVnQVRc2IiXZQ6MgQ8AWI9b0G6tRiJ4=; b=3Ml9UBRg4nr3hOoxy5yHCCOuD 8BEVPSvH0t5rEeFzzIldxg9mjr0IJGS8+E2uPptCZ8hcvSSWh4pSAQyjpnnAstmJW//iXvrSllCJq GKz41s5ibdCatrWWT197mxWR1RfTzxa1CNXrz6CgiM3T+7iJg5hzeVy+ljNoleWY+kk5xjzGzen+b s9qFgBxRHDQFv9ZnDxjvm0bPU8vLpwK/FZzchyDF2MZP1b+VSKF+b6kJAI8Y14zPaYK8RF8BxTjo8 7wJjU4EJWEy6k/cNSgM5Zij2UzZj/xsHMEJRQ3or7Hwh872T8uO42ZtKqn1fwOuzQS6g4puSIo7nl Jt8ofo94A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaXVQ-00065W-Kc; Thu, 05 Nov 2020 05:08:16 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaW57-000145-Nx for linux-arm-kernel@merlin.infradead.org; Thu, 05 Nov 2020 03:37:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=G92npUQrDAzWi0FLCRrGsDUgO/xYzB+b9yo7BatUrLQ=; b=espk/a+OlWnlpyX3JNTJ3ZqRtc qSJQmbynz8wUnjQJarSiTyAfb3lIj0dP1AyjDkFNypVxwfAkd6y7WLC74YMXxwoUZDfnk5fm+DYkU ysH0aBOfc3+CgKJAJnEyJjOswAVZb3Y0ZJ8htFp6dvrxB3DIiRr9i+5D3G4nL5baSvaARVo/7pIb0 GtbHcHmb8IIsQwQMasPMficidVAcCrxbksGxlHrJ7omwTwql8lOlrF8wv1yln4DxQusVSYLQM9ayN 4AB2Nz3J+bIp3UG+kBzbpOmXePc+L1aNv5xsEkc73OvhEjFY5jOjolVI8Hzerg8W7NkQaqHzvIVVE Dfkm2lmQ==; Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaS5p-00048N-8i for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 23:21:31 +0000 Received: by mail-wm1-x349.google.com with SMTP id p7so5794wma.9 for ; Wed, 04 Nov 2020 15:21:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=G92npUQrDAzWi0FLCRrGsDUgO/xYzB+b9yo7BatUrLQ=; b=mCfoY2cp4+45Yg/2GkgKRvfDnEDWNJpvWB12xTWK0vuTdueKWw+4z4wH/YMCFxT/l+ Hv0xXY68/PFpfZTv01ziNJVGtDfv6QocTWuS8UhH1dEoLhGPjM4NC57IoonaZnv5R2WJ bdglNw2z26/HvPcCEZcTzjRegrgJm1WqegqASbvaI7bo4AznNU0HAyhU/h9/rK9MQ4r7 gnjWEDF6WvGFU2MMKwwF98nI3nailfbDiLeIVR2MkSI/4Epug2ksDDJeSB38qHs02aPD X/N0+CmLAvsvFNgtpwoGlIo+Dq9vDdn0FtCqeHYwM0uK2EuJLUrKQL/32w3MME18HLSE QNNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=G92npUQrDAzWi0FLCRrGsDUgO/xYzB+b9yo7BatUrLQ=; b=s3LfiXDd05qO+iuUmKTvAwMfTzdAuM5ZXmWWMq5TNsDnmO3x+F5/YfFte5pApOgKLZ LIdpEoInYxL2Y+ozlVVAQ+U5Ch+vY8ZrdpzlCBSGpScIYbqiO70KhFYOEI7+A/BnAPQ5 3XD6YF4flGfQqdn3DP+LNsF/zrhoEo2e6RuTib/z3qvb9RNjWBtFyN/T/sU/bXOks2ar hcLuA9unqA5oFpPqf9aiGwJfqd9c1eWgHLd+YmhI8LY1n2pBbhIJr4MnOBqz3mH6WCjS rFiMmLRDhtkUCbXkHTD+ZtKo/FC8ExGPoSRYaIFYfhSh/1VKFG+cm1sDRTnD6y4EtbHa WIsA== X-Gm-Message-State: AOAM5326kuJwjPsmV32GGWcDxfOp/LLuwexYV/JBoxwAaGgoCx70uhYt jK4jH9GId8RfFCAjpKA09TJyuMaagCBxNyDr X-Google-Smtp-Source: ABdhPJx59gSlNtnljRSf78Gs8PUkWDU/z1CEhdhhdjWGvP1/TZFGc547IHN93oLb7XLzSvMvsn8pTdlZNiT3UTMi X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a7b:c772:: with SMTP id x18mr38926wmk.185.1604532026477; Wed, 04 Nov 2020 15:20:26 -0800 (PST) Date: Thu, 5 Nov 2020 00:18:48 +0100 In-Reply-To: Message-Id: <3efc77f8b7ea2f0820524fddd4caf1a14fda94b9.1604531793.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v8 33/43] arm64: kasan: Align allocations for HW_TAGS From: Andrey Konovalov To: Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201104_232129_466161_0FA558E2 X-CRM114-Status: GOOD ( 10.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Marco Elver , Andrey Konovalov , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Ryabinin , Andrew Morton , Vincenzo Frascino , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hardware tag-based KASAN uses the memory tagging approach, which requires all allocations to be aligned to the memory granule size. Align the allocations to MTE_GRANULE_SIZE via ARCH_SLAB_MINALIGN when CONFIG_KASAN_HW_TAGS is enabled. Signed-off-by: Andrey Konovalov Signed-off-by: Vincenzo Frascino Reviewed-by: Catalin Marinas --- Change-Id: I51ebd3f9645e6330e5a92973bf7c86b62d632c2b --- arch/arm64/include/asm/cache.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index 63d43b5f82f6..77cbbe3625f2 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -6,6 +6,7 @@ #define __ASM_CACHE_H #include +#include #define CTR_L1IP_SHIFT 14 #define CTR_L1IP_MASK 3 @@ -51,6 +52,8 @@ #ifdef CONFIG_KASAN_SW_TAGS #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) +#elif defined(CONFIG_KASAN_HW_TAGS) +#define ARCH_SLAB_MINALIGN MTE_GRANULE_SIZE #endif #ifndef __ASSEMBLY__