From patchwork Mon Mar 8 15:55:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 12122867 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 BC8AEC433E0 for ; Mon, 8 Mar 2021 15:57:10 +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 1DA9565226 for ; Mon, 8 Mar 2021 15:57:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DA9565226 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=cqkEPEof1dl5+zgdR9KK/Pn5jFUv2Y5yQI2IIOrd96c=; b=cW7EJbqdzXRIBMBN5CsQgB8yeR lfE1BLIglc/ZsVGl8VyJHHQmtPdIszInWA3KKASZztjvJqBwaLWF9kdVbVON52DoxOAOqpBKn51x2 +CJoBy+yoIORnC/zwtevq1sorVBwzp6ZZqRFddO9S+DhtESoDpDBQl/2aNOzKMQMlEAgauk7RYkyL DQJ8qydq4VG6fDknIo5QOMaiy4TR+V3HA/eAxXwZOL8TjqM205uKWo9QhD7hcgZt2AB4oMDr7R4im m3scXkJK2/hcDeShZCQWOiCVS/OpUnnti/GQe9SN7hvWIVTiurX3osNJQ6apnG+LgvwEJRiZ1TMwO dWM/Hb1w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJIED-000lp9-Fp; Mon, 08 Mar 2021 15:55:30 +0000 Received: from mail-qt1-x849.google.com ([2607:f8b0:4864:20::849]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJIE8-000lmj-5i for linux-arm-kernel@lists.infradead.org; Mon, 08 Mar 2021 15:55:26 +0000 Received: by mail-qt1-x849.google.com with SMTP id k1so8282313qtp.12 for ; Mon, 08 Mar 2021 07:55:22 -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=FoMoOBBpWzT75wmFJ4xJzRk+FU5MgOdLV7/pA36y50w=; b=gJjqv60KbnOg/rjkTVlwcooSILnYJ3qeJRQgS9DTzcLaQb5lxvLl1m11dOVtbvwUDv IyNBTpOv9RYKxYzlDivy5JN6bnZagUv6vYJdw670cjpVq20vt5lCwFKLdpfhGMfdUo45 u4xs8vMYjYWNyhaPTw8Vvpt9eAscslNnL5twuLXJwVRWHKeBEdNcMzVXMsZSBcGmAfxN zSJytXSh0gYbY4k/oi5SGmevNq7lIDm2ke7+kxf8q8ZYBzCU+Nv0h2hM9SxKJDBM5GRi CmK/me3P/TgWsXjAugxJtgZQbjZaeefObcdBU/5Xa4xOYZui6YqK81n6kXBXsYOs2eJk QgbA== 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=FoMoOBBpWzT75wmFJ4xJzRk+FU5MgOdLV7/pA36y50w=; b=Wo/r17y1rn9VxcBGXpo+5LqAeWaXQxg6kSMECA9nTCEMoSGKJClx/LSrU6K5NuH3px grh2YAUNdG2q96x4YhneSw64xwLb8cYnivDDiuZ4/YS3RJRLbI1gGmRCQo/yQnofI1ex OLwCoQ8h6N06pUMuNmsK1M4rI4gl1ndgEx/n+LYjRBQmLvsL5VP7N5th68B2W4qWmlDu CofenD2zOrL3GI6dwYuo6xnH+MWfEtS78wKD07liiOzE3FwDwAo/8LwRpaFsrHMhYHCt lZyxDPnZvZhh7dE42Q06nROjWc9Zq54NikZXLy4VVbeqQi/Guu6JIVQ3WEhBlD8eSDxf qrEg== X-Gm-Message-State: AOAM533JrpMv/FvqmAPJVKXsBQ3Pk70mwq4GYJO1l6N3aBka4YaHB6ME 9L095JyrF+iB49Gatu+jq1C9l3hT534FehDP X-Google-Smtp-Source: ABdhPJxpc8xtWCUHnacmkUYbjfY6hvpOAtCcn6T/A/8xB55wTWfnA/FRfsF9ckMO+6ZAPsDaU0zHb/aq1Bb/PMdk X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:85fb:aac9:69ed:e574]) (user=andreyknvl job=sendgmr) by 2002:a05:6214:1870:: with SMTP id eh16mr8647655qvb.23.1615218921580; Mon, 08 Mar 2021 07:55:21 -0800 (PST) Date: Mon, 8 Mar 2021 16:55:13 +0100 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH v2 0/5] kasan: integrate with init_on_alloc/free From: Andrey Konovalov To: Catalin Marinas , Vincenzo Frascino , Alexander Potapenko , Marco Elver Cc: Andrew Morton , Will Deacon , Dmitry Vyukov , Andrey Ryabinin , 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-20210308_155524_303292_B13249CD X-CRM114-Status: GOOD ( 10.54 ) 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 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 | 20 ++++++--- 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, 196 insertions(+), 139 deletions(-)