Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1854524pxb; Mon, 8 Mar 2021 07:58:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6vRNsuUgD/lqEKhxhJMOVnD56ziwX7bqebcVnRrGUMhCGfvs4OoftSfFQeMcR6z1fk7eA X-Received: by 2002:a17:906:1759:: with SMTP id d25mr15739227eje.524.1615219102573; Mon, 08 Mar 2021 07:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615219102; cv=none; d=google.com; s=arc-20160816; b=KVDqS3/h8gznAtTiz85UbZ5ytC9JVpGiusJNvqOaQOZVu+P1EygmZoEI1EVQt0r5Ne 1SWTXxIzJjC5I2Uuoj/mH4EVLZrpmyz7bU48pAoz9T07qAOJ0nnyHUU8C3p+aO/QDEoH luw0p4RbuEjJdvD1o/XExq8ZEuUl3/9zlg6F6o/mOpm5lROin+cu6m86j0DERGDT1+GG 6fxVPmy3bnd13iVlI1UUH1vz958nGHaGdjtCHYOZ5f094fekL912ngiqOiMed04ep3v9 7fQ+MIduuEmmTBjHxQtpeq6Lg39K/xhTq9aXm/TTPWVSO+BKKfo3qiBCAl0AvGPODKmB NQ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=FoMoOBBpWzT75wmFJ4xJzRk+FU5MgOdLV7/pA36y50w=; b=b3ARUOaNY9j9ugErgsKIVHwTcZAqNHRbrw2qlKmuWgjC7Dgce8t/xdCZnC4KLIp+G1 eoD0/5+BJUuFAde464gk475w/84Cl5g0uh45+mtlPXA5SXA8t2sxGIDfMMzm7KnQ1z/Q HYhMGyeINPwCru2wbe2lHAGxvDgjs+JF4C/jlw1IQfDfoUVkuJ1iujXw3dnWsVGmPyuZ kk3qtq8i96pmSiIiHJJnM5ebej6L+qq/xBhWo9t7TxYl8qGiEwqhYwFuT+GhRHyExuE7 hLG2fm8sb6Ihdk+LrcnD5kL5RtI2DazJ9EkHlY/zR8zgiTLyEw4FkuyjJhLAHL8GPlbJ mlwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gJjqv60K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do13si2777202ejc.87.2021.03.08.07.57.59; Mon, 08 Mar 2021 07:58:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gJjqv60K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbhCHPzy (ORCPT + 99 others); Mon, 8 Mar 2021 10:55:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbhCHPzW (ORCPT ); Mon, 8 Mar 2021 10:55:22 -0500 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7287CC06174A for ; Mon, 8 Mar 2021 07:55:22 -0800 (PST) Received: by mail-qt1-x84a.google.com with SMTP id j2so2866168qtv.10 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=ENtCt4TvqwVrddNtfT8kv42cLagdZcQ61+4rvChIyONXFoi6YS9RVVPVoGe+cYe9PX pLdFhYBahDyrMGTYytn7DynLT3mxcF67BhHfYbAWMyX/fsYC2Hj4XtXOCL1uxV8V/tvQ YPMeHwvSFCejzc9CkShRW9e495KvbNIZmoCFR1JNss8iEHitcMb4sCUt1vXiA5XiBRZI ixy0v4EzralJjwljlshN1u4UM1CJF1OzEJUMklYcqY9w0X+4xRcMJE4+XCvi3C3BpBFb cmkSO5tSfDxJ10YmUOedYRjNXnV467bIPoozHjiT6wjnWQNoeZ1dc5NOvjPAtFtrmUzi f2LQ== X-Gm-Message-State: AOAM532RygEWiFe4m2iXKNE36N3yOM6efO1yiQATPOEm78NIVgXIb/HI XW1da7qrqbBTI5wK8OPvnZcG2p5GX9h25KZM Sender: "andreyknvl via sendgmr" 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.30.1.766.gb4fecdf3b7-goog