From patchwork Tue Mar 9 13:24:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12125283 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.0 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,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 B95D3C433E0 for ; Tue, 9 Mar 2021 13:42:12 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 CD1E0651C7 for ; Tue, 9 Mar 2021 13:42:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD1E0651C7 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=74d4lJCsbg7jflChZgTnf7gpuQobj9H2g+Ugie329Kc=; b=UDQZakiBpQwATOnijkOgMxv9LG gZm5LxKZEnzhlOrJYEdW2JRsX3PjVpwce7GgCMvyUk8xcoO6Gb7XZ6ppAbuhR4lrm83k+w3nGzN1l Fq+AfDwW9Wk3wmzjrzs+/mwm/djwv+bHhUb/qhdlCdVzLdhqTVbHETrBF6HZQdpiMzytlbegHwQyg QfWT/8MJAORtOrA4TrTtN7u6ndLwkCEC+ogGrUCJKtx3iAAJZKR5Ukk6Dv1+uspF5ayBOamw8IUwQ 3vKwudIQYpVqdUMKO393XuQfN9xYDuKJ93dAF/I8HtkG3ZxAiCXwTX0n5Trh+upbEUA19k9na4Jee Idk6ctig==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJcac-004hOb-BH; Tue, 09 Mar 2021 13:39:58 +0000 Received: from mail-qk1-x74a.google.com ([2607:f8b0:4864:20::74a]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJcLt-004bnW-NJ for linux-arm-kernel@lists.infradead.org; Tue, 09 Mar 2021 13:24:51 +0000 Received: by mail-qk1-x74a.google.com with SMTP id b127so8201239qkf.19 for ; Tue, 09 Mar 2021 05:24:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=mcTFS30JyBp5UEIivUihex+f+ayULWtQ0lH68CQCZDA=; b=gTizBqstGl5T21phg1I1K9VtIs664wU897rwXS3AOQBIXH3um4pyp155yLPoBJaqTq Ks/wQ/XfaqpyH0LflvdQ9R7fNyrMSzNZxk95p1pLh9p9/ZN+xWUkCE3QVPlENArU3V5Z bkqLzOgrKWhYCxbDcGOHAUmQY3eItG0ebyweURJwIGwUNSOHn9g1exTedyRpi/b3hxx5 S8Fbx2c2l0nxE848ea6YiiJdP2I3AB3Zj2InIOO3fTBqMzBCmYfj8tBrjr1tOaJA3EVM vKQpK/QLImjduTgiS46MFXNCJwgFJ9qTSc0o/brfAhtpom5zoPMRDM84CQJxAWpsPKp5 hXfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=mcTFS30JyBp5UEIivUihex+f+ayULWtQ0lH68CQCZDA=; b=O3xiR5TnBn6jOxLZ3Onf3R6b+d6x54AktSJefMV9Ok3Mkgv/bljVDKVwxyjx5KBZ6+ +DDaaOgRZn7bwJ1LippjBb66oagaTeST6JqvjlrETzrFFEUXBm7xYzkeX8uOatJBiA59 RO/rZGLQcjQaYinank0CKKwVCzdoIDRtxXxv2T6mg1Lv4LxcanWJ0cAUjLl4cQpjUtGF wJ6MNvOUuyXDuaUU9SltQt+HFiIU8b7N5dV5zdCQnhnIuu7GdF0VmX9int9KzHoWzzvY rKOTBoWCZYPuWzto0a2FexecguBPEzxMIVSicL/v648SEQ52arJ8yTYoUjwlYCDxQc98 OVEQ== X-Gm-Message-State: AOAM532YRE1Yd4oH8YJGxSuqg23mPLvAi0ZCwnKaNaBJ1sZkKsQNY0D6 QbBpXlS8cxBUsos48wocLh2m0aRhoCxEJY3n X-Google-Smtp-Source: ABdhPJweE9948FBg9Sg3+ZSTxVw/xY9NiczdF8z6eCM2VRC6d+9Z58LpvBkzmdMVQtlRcAsbsoNW/XJszwbNxEs2 X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:5802:818:ce92:dfef]) (user=andreyknvl job=sendgmr) by 2002:a05:6214:1909:: with SMTP id er9mr25819084qvb.5.1615296282586; Tue, 09 Mar 2021 05:24:42 -0800 (PST) Date: Tue, 9 Mar 2021 14:24:34 +0100 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH v3 0/5] kasan: integrate with init_on_alloc/free From: Andrey Konovalov To: Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Catalin Marinas Cc: Will Deacon , Vincenzo Frascino , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_132446_142735_AC6FDA33 X-CRM114-Status: GOOD ( 10.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch series integrates HW_TAGS KASAN with init_on_alloc/free by initializing memory via the same arm64 instruction that sets memory tags. This is expected to improve HW_TAGS KASAN performance when init_on_alloc/free is enabled. The exact perfomance numbers are unknown as MTE-enabled hardware doesn't exist yet. Changes v2->v3: - Move init variable check out of initialization loop in mte_set_mem_tag_range(). Changes v1->v2: - Add and use kasan_has_integrated_init() helper. - Update comments to not explicitly mention relation between HW_TAGS KASAN and memory init. - Fix non initting memory with kasan=off by checking kasan_enabled() instead of IS_ENABLED(CONFIG_KASAN_HW_TAGS). Andrey Konovalov (5): arm64: kasan: allow to init memory when setting tags kasan: init memory in kasan_(un)poison for HW_TAGS kasan, mm: integrate page_alloc init with HW_TAGS kasan, mm: integrate slab init_on_alloc with HW_TAGS kasan, mm: integrate slab init_on_free with HW_TAGS arch/arm64/include/asm/memory.h | 4 +- arch/arm64/include/asm/mte-kasan.h | 39 +++++++++++------ include/linux/kasan.h | 48 +++++++++++++------- lib/test_kasan.c | 4 +- mm/kasan/common.c | 45 +++++++++---------- mm/kasan/generic.c | 12 ++--- mm/kasan/kasan.h | 19 ++++---- mm/kasan/shadow.c | 10 ++--- mm/kasan/sw_tags.c | 2 +- mm/mempool.c | 4 +- mm/page_alloc.c | 37 +++++++++++----- mm/slab.c | 43 ++++++++++-------- mm/slab.h | 17 ++++++-- mm/slub.c | 70 +++++++++++++++--------------- 14 files changed, 207 insertions(+), 147 deletions(-)