From patchwork Mon Nov 2 16:03:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11874375 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 409CEC00A89 for ; Mon, 2 Nov 2020 16:09:15 +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 DD1E422275 for ; Mon, 2 Nov 2020 16:09:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="utBG+zZO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="pVFQxBGu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD1E422275 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=utBG+zZOiMwif97kfYhwoPlyn HUcqz8LEikM45KIOe6oCQFqaD55fhBnolHYEz/6+aLwNCKBw+Vgbgkdjj+urtZzVrNn9iuQvKBxID +lDaDFkMKA2JeAgoo/rzr1Dn0ZRGslt9q+V/E6MV9tCWJvzkOwvbG+n6Uho2Gk/2tOyL/PCs9cBTI u4Bqcekthr0d6gVK41Hfcoh/8PoP10+JMAqvCu+0nb2GB/qACkopnckY9zo2ux0WSW0spYAArYgvY Y0sGo+vnsQ1FzaQCATp8xoiTuqigG7d+TrFsTkhn2rh4RKrMKY6OMllc8CnV9NCW/AN5r8D2C1OUp baDs9W+/A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZcLw-0007Sy-7v; Mon, 02 Nov 2020 16:06:40 +0000 Received: from mail-ed1-x54a.google.com ([2a00:1450:4864:20::54a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZcKA-0006V0-Pj for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 16:04:52 +0000 Received: by mail-ed1-x54a.google.com with SMTP id bs10so6279705edb.22 for ; Mon, 02 Nov 2020 08:04:49 -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=pVFQxBGu09AktYQjGsUevuiZuIp8P2uc/Rpm7nB+HDrnBUFO+j4DH5TvoZ9zgREXH3 y4SZyXQWlBxpzqIkIMZoU+stzzpZV8IniPwc4BuB9vJo809BfgfqIfYwLWvaNaiRSAwK L9pEUEjzBBF+FE/v7xF0yuigdwpt2rhEXTYSXc1gmQjPCLXc3VxImurzeWNyfG8yJTpJ m56oceueeUP5vJzJpij023CAKuDum+01Ze+MgnmqsHg0ah5XqFxEJAn1ifFvOw6ahk+d 48gnuFiIQy9hBTQT9wuBaaXCsmXLTn1HNEcshgV8RzIjdRVLYeap5lGJt3HGn2ZUd0yh 6FBA== 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=jNLNUurZKRhPbI5n6LQBgWo6oQb1EGUUKnNR4W9o/6erJOJKxl0x1jpVjCiDFCaFS6 6JCha7GSF5Fjc+Mq04+ChmJItTzRRnJLKBp8Rxe8UIbmOUTgp7KIPTGXCNDGDpO0Giia Rvna2C8yLch7UyYfyo5ir2Zu8IwbY/j7YidiuFLQT8IN4jeNtQP3BEyxJOqWd5OnXuNh aO+zXZ2vhGghhp6i03vJHJ99w6Darn6J/lYB4KS/r19pT3yQg5A63TCanXSweEmfvz7y 0Z+Z9FsL5cNmxFSQ30qWWmHFnSXSOw3xUIHIFoyGoDkbPwNi8Ut6lY9tJi1CMwT53gat hLsw== X-Gm-Message-State: AOAM530FN3TXQlWsjxRgdlR8yTPMc6jNbmuINVdQIW6hqeKQxUFLeLSP HZezqWOfvwaK3gE3/K/dYcFEz+x/O0y838Am X-Google-Smtp-Source: ABdhPJynNapDQa+98oKFs1UEEnhM037/oSJpIpMZ7UZ8DRdegNxgG10b/E2rJbftBz4QFi6fw28i4NYRT+57N4AT X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a50:ff02:: with SMTP id a2mr16764112edu.364.1604333088410; Mon, 02 Nov 2020 08:04:48 -0800 (PST) Date: Mon, 2 Nov 2020 17:03:49 +0100 In-Reply-To: Message-Id: <5d790812e7b0e8fd6747b0f2cb38de52c686de32.1604333009.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v7 09/41] arm64: kasan: Align allocations for HW_TAGS From: Andrey Konovalov To: Catalin Marinas , Will Deacon X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201102_110450_917938_5EA81517 X-CRM114-Status: GOOD ( 12.88 ) 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 , Elena Petrova , Andrey Konovalov , Kevin Brodsky , 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__