From patchwork Tue Dec 18 13:30:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10735657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CDA21399 for ; Tue, 18 Dec 2018 13:30:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E3572A087 for ; Tue, 18 Dec 2018 13:30:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 215DC2A0A9; Tue, 18 Dec 2018 13:30:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D1BA2A087 for ; Tue, 18 Dec 2018 13:30:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbeLRNam (ORCPT ); Tue, 18 Dec 2018 08:30:42 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54194 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbeLRNam (ORCPT ); Tue, 18 Dec 2018 08:30:42 -0500 Received: by mail-wm1-f67.google.com with SMTP id d15so2672212wmb.3 for ; Tue, 18 Dec 2018 05:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1DLr9hZIqfTBfQ8vZM5TVqGu/0wSU0e2RGylEo0U1xk=; b=b6CeLxm48QORSNimPysCsqnEvAwvbwCEMK3zZ2IeU55RUe8jfEaoKD7B2W5pu4GMVM ZMfAqk8UVGyjCZdWBu94z+/d06Nqhr39DI+oBkGQF6PQNRAP48V2nHE1nMmWB13EyfCm NtxsSWQvTBxTL+Fd0/UOOq7DzicVsxlDHD16s9b1lX0C6x/VSR5lAuzePhQ9L1d5Oul8 VXrACEN0B09HGP6S1WtlkS87efzvH+4OfJy778AP3n08axpCT24ejrd+gQ8n9Wv0ZFss zNcku1rhZAk/DpR9yt64U57aTzC8whKP5MKSsmn/EKNweqDVHhOPHIVAgeVnlG4EPeY4 Oa+Q== 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=1DLr9hZIqfTBfQ8vZM5TVqGu/0wSU0e2RGylEo0U1xk=; b=bvD3mV+oxRUhXvp19D4aWqlEVrctbaqFUqlKjJin0HE8g3Z+MKlI/FItTioV8u8MZF HEsv9HAaJb2aOGoTTq0ZZqbJgjsNETqh18nLxlR+GjgkKsHN05m8pUpbLu/1vVW8/Mqt YO9/o5KbIfhDPJ/JWZDYNKwsGPVxIGrmf4/ply7etQ10bTTqtbUmTKkChcwtByN4KGfH ZS1k1r+ZkV7dH+peCwCgU7yS5MOLxuObUsCheqIRDCjoZczMpTKzdU3ACvAFr/ODYVR/ Hr1Hsk9pM7XM/cuKlpUEPY2VZESwznZiOZ0tSqxbA3LYe3fokCFtqoaEQrs2xAjldSVc 4lPg== X-Gm-Message-State: AA+aEWYl5QrTFg8wsF3ktPvVTUchcvbVsMY9r/pyrr453X/BB+xcmqH0 xkI+yyf12c2p/WiMwSIEdh5tpw== X-Google-Smtp-Source: AFSGD/Vk4dHI/WjETFO6q3mGOkSMUeOtBy8kBD/BEP66o/kq3hhOh6hYuClxgxsdrN7KcTWqc7mrIQ== X-Received: by 2002:a1c:a104:: with SMTP id k4mr3226049wme.54.1545139839904; Tue, 18 Dec 2018 05:30:39 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id g188sm1995927wmf.32.2018.12.18.05.30.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 05:30:38 -0800 (PST) From: Andrey Konovalov To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , Vincenzo Frascino , kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kbuild@vger.kernel.org Cc: Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya , Vishwath Mohan , Andrey Konovalov Subject: [PATCH mm] kasan, arm64: use ARCH_SLAB_MINALIGN instead of manual aligning Date: Tue, 18 Dec 2018 14:30:33 +0100 Message-Id: <706da77adfceb0c324e824d03b52d58a752577ea.1545139710.git.andreyknvl@google.com> X-Mailer: git-send-email 2.20.0.405.gbc1bbc6f85-goog MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of changing cache->align to be aligned to KASAN_SHADOW_SCALE_SIZE in kasan_cache_create() we can reuse the ARCH_SLAB_MINALIGN macro. Suggested-by: Vincenzo Frascino Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/kasan.h | 4 ++++ mm/kasan/common.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/kasan.h b/arch/arm64/include/asm/kasan.h index b52aacd2c526..ba26150d578d 100644 --- a/arch/arm64/include/asm/kasan.h +++ b/arch/arm64/include/asm/kasan.h @@ -36,6 +36,10 @@ #define KASAN_SHADOW_OFFSET (KASAN_SHADOW_END - (1ULL << \ (64 - KASAN_SHADOW_SCALE_SHIFT))) +#ifdef CONFIG_KASAN_SW_TAGS +#define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) +#endif + void kasan_init(void); void kasan_copy_shadow(pgd_t *pgdir); asmlinkage void kasan_early_init(void); diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 03d5d1374ca7..44390392d4c9 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -298,8 +298,6 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned int *size, return; } - cache->align = round_up(cache->align, KASAN_SHADOW_SCALE_SIZE); - *flags |= SLAB_KASAN; }