From mboxrd@z Thu Jan 1 00:00:00 1970 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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable 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 29CF8C43333 for ; Fri, 5 Feb 2021 22:06:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0267D64DD6 for ; Fri, 5 Feb 2021 22:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233094AbhBEWFc (ORCPT ); Fri, 5 Feb 2021 17:05:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbhBEO5n (ORCPT ); Fri, 5 Feb 2021 09:57:43 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B619C061793 for ; Fri, 5 Feb 2021 08:25:56 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id g3so3832695plp.2 for ; Fri, 05 Feb 2021 08:25:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=YWfA2TQ5ApvZiaB/IqgvOHh0zr5cPm+JHUeKZ3MWatPWqRn+mvCJRLw/TwPHlOjRX3 xSzjR3V9y59pebgurUiBcvvHg+NeXKpZNzzyfxxhKXfVgRx86huXB3XiDaEup1uA3iZu 58WHlIewB/n6yqYVlpdN2029/6Xn3wg2TRyryIQtMn0Jsn+i+ZMW8jyL6K71IhSHNL33 E1X/C2e96YJz8ZE451WxgNnwUhqWRee0PR7JOK+kUsqhvgZTq/Mh4RPW3a+Ch+rZ9rYJ ykElq77xB8X64yHy+M0EZZCevdU23gKPsL+WVLfFgJKRcLus7h61IuWtG43Pf0p+Tksc 1+tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=FiGDNH0lTgC970kyjDOvk6x3hFR7jE+m/GVWGkcpQGuuhrvwiQK8m+JOSaOGnoYxgp 54vegcOZ7Q3N4bU96YZ9+oIjvG09I33CHI42ZlOJSm+x77/eUFyIj9den37SzPdd92VF TeJ9TsOssIxb84Ctmm3lQSLi0LokxuGexYaRtIkAFu40Q+0o2N+MZ0Xk9bLpuec9HZjC 2Fl//4bMtWTumBP4DEhQeF6HF2ogpZ6lNRN8b3QZOAfu+PlXkrXj9ERw0/XQi//q+k7A AZo0+022nNLN/b0zddYdlPD4fZ3w4Y5zGo2rs2gT9Q6/QnAL8G0bcuER4k23oPs1dCyZ ocAw== X-Gm-Message-State: AOAM531WuDJbK86Y1uIJkb95s7rYLe+pDR5bktsBr6UYRRHAPz3am/XX aDfVcaonfsNwl2+MDS5TPlzjDCsUKiwi2seobSNNMA== X-Google-Smtp-Source: ABdhPJz7hg3W9UVrqwUtxXCMXQuIfjDWNNH7DXXlqilvLV51Hybl4F2VuwOFjYZCYn1biMA69T6PJSx+PVqU/vuc6IU= X-Received: by 2002:a17:90b:350b:: with SMTP id ls11mr4812469pjb.166.1612542355340; Fri, 05 Feb 2021 08:25:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Fri, 5 Feb 2021 17:25:44 +0100 Message-ID: Subject: Re: [PATCH v2 00/12] kasan: optimizations and fixes for HW_TAGS To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver Cc: Will Deacon , Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev , Linux ARM , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 5, 2021 at 4:39 PM Andrey Konovalov wrote: > > This patchset goes on top of: > > 1. Vincenzo's async support patches [1], and > 2. "kasan: untag addresses for KFENCE" fix [2] (already in mm). > > [1] https://lore.kernel.org/linux-arm-kernel/20210130165225.54047-1-vincenzo.frascino@arm.com/ > [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=akpm&id=dec4728fab910da0c86cf9a97e980f4244ebae9f > > This patchset makes the HW_TAGS mode more efficient, mostly by reworking > poisoning approaches and simplifying/inlining some internal helpers. > > With this change, the overhead of HW_TAGS annotations excluding setting > and checking memory tags is ~3%. The performance impact caused by tags > will be unknown until we have hardware that supports MTE. > > As a side-effect, this patchset speeds up generic KASAN by ~15%. Forgot to include changes v1->v2: - Use EXPORT_SYMBOL_GPL() for arm64 symbols. - Rename kmalloc bool flag argument to is_kmalloc. - Make empty mte_set_mem_tag_range() return void. - Fix build warning in 32-bit systems by using unsigned long instead of u64 in WARN_ON() checks. - Minor changes in comments and commit descriptions. - Use kfence_ksize() before __ksize() to avoid crashes with KFENCE. - Use inline instead of __always_inline. > > Andrey Konovalov (12): > kasan, mm: don't save alloc stacks twice > kasan, mm: optimize kmalloc poisoning > kasan: optimize large kmalloc poisoning > kasan: clean up setting free info in kasan_slab_free > kasan: unify large kfree checks > kasan: rework krealloc tests > kasan, mm: fail krealloc on freed objects > kasan, mm: optimize krealloc poisoning > kasan: ensure poisoning size alignment > arm64: kasan: simplify and inline MTE functions > kasan: inline HW_TAGS helper functions > arm64: kasan: export MTE symbols for KASAN tests > > arch/arm64/include/asm/cache.h | 1 - > arch/arm64/include/asm/kasan.h | 1 + > arch/arm64/include/asm/mte-def.h | 2 + > arch/arm64/include/asm/mte-kasan.h | 65 ++++++++-- > arch/arm64/include/asm/mte.h | 2 - > arch/arm64/kernel/mte.c | 48 +------- > arch/arm64/lib/mte.S | 16 --- > include/linux/kasan.h | 25 ++-- > lib/test_kasan.c | 111 +++++++++++++++-- > mm/kasan/common.c | 187 ++++++++++++++++++++--------- > mm/kasan/kasan.h | 72 +++++++++-- > mm/kasan/shadow.c | 53 ++++---- > mm/slab_common.c | 18 ++- > mm/slub.c | 3 +- > 14 files changed, 418 insertions(+), 186 deletions(-) > > -- > 2.30.0.365.g02bc693789-goog > From mboxrd@z Thu Jan 1 00:00:00 1970 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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 BC603C433DB for ; Fri, 5 Feb 2021 16:25:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 350A764DE7 for ; Fri, 5 Feb 2021 16:25:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 350A764DE7 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 95B8F6B0074; Fri, 5 Feb 2021 11:25:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 90D1A6B0075; Fri, 5 Feb 2021 11:25:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FAEE6B0078; Fri, 5 Feb 2021 11:25:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0150.hostedemail.com [216.40.44.150]) by kanga.kvack.org (Postfix) with ESMTP id 686156B0074 for ; Fri, 5 Feb 2021 11:25:57 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2C8973633 for ; Fri, 5 Feb 2021 16:25:57 +0000 (UTC) X-FDA: 77784740754.11.crib04_0b18043275e6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 055A6180F8B81 for ; Fri, 5 Feb 2021 16:25:56 +0000 (UTC) X-HE-Tag: crib04_0b18043275e6 X-Filterd-Recvd-Size: 5935 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 16:25:56 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id y10so3815328plk.7 for ; Fri, 05 Feb 2021 08:25:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=YWfA2TQ5ApvZiaB/IqgvOHh0zr5cPm+JHUeKZ3MWatPWqRn+mvCJRLw/TwPHlOjRX3 xSzjR3V9y59pebgurUiBcvvHg+NeXKpZNzzyfxxhKXfVgRx86huXB3XiDaEup1uA3iZu 58WHlIewB/n6yqYVlpdN2029/6Xn3wg2TRyryIQtMn0Jsn+i+ZMW8jyL6K71IhSHNL33 E1X/C2e96YJz8ZE451WxgNnwUhqWRee0PR7JOK+kUsqhvgZTq/Mh4RPW3a+Ch+rZ9rYJ ykElq77xB8X64yHy+M0EZZCevdU23gKPsL+WVLfFgJKRcLus7h61IuWtG43Pf0p+Tksc 1+tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=ZpSfVf1lLHw4W+0bbPpYmfF9e5Gmf6J3HzOAZELZcVu81KssDmz7MeLN9oj+ArK1mB tM/lUNCiIDm1zV50AgiuzykBj46l8ZYrPfRf183zZbS5vgH99Q+0EQC04Js/IHTwb9b9 Rr7gWT3pSHXjrpeaiP5ilnbViOLPO5GQeZjHhOEkAorkTo1ucSZkJtJTEpGGCW5gGoqQ SiI1DOfZlz4pAhXz/9xwJmiO169pWr5yabwQaAuvz9weeylWdKZnAaoEhl1NFZ3uYinr Q/1Rps5jyuOOCaUBKdvVChneMCetjkcMjjoUyWxm7MhcHdFqbsmLA1sNBVsNe4Ga88XM rVMQ== X-Gm-Message-State: AOAM533hC5clkl6NonuB8fyMoBj5C++ouSv05LaA6ZZb5G7htFqLymno gM1lMz349/1yuXuZAvyUNhIpQKM7W+A2CaHa8Fq1DQ== X-Google-Smtp-Source: ABdhPJz7hg3W9UVrqwUtxXCMXQuIfjDWNNH7DXXlqilvLV51Hybl4F2VuwOFjYZCYn1biMA69T6PJSx+PVqU/vuc6IU= X-Received: by 2002:a17:90b:350b:: with SMTP id ls11mr4812469pjb.166.1612542355340; Fri, 05 Feb 2021 08:25:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Fri, 5 Feb 2021 17:25:44 +0100 Message-ID: Subject: Re: [PATCH v2 00/12] kasan: optimizations and fixes for HW_TAGS To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver Cc: Will Deacon , Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev , Linux ARM , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Feb 5, 2021 at 4:39 PM Andrey Konovalov wrote: > > This patchset goes on top of: > > 1. Vincenzo's async support patches [1], and > 2. "kasan: untag addresses for KFENCE" fix [2] (already in mm). > > [1] https://lore.kernel.org/linux-arm-kernel/20210130165225.54047-1-vincenzo.frascino@arm.com/ > [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=akpm&id=dec4728fab910da0c86cf9a97e980f4244ebae9f > > This patchset makes the HW_TAGS mode more efficient, mostly by reworking > poisoning approaches and simplifying/inlining some internal helpers. > > With this change, the overhead of HW_TAGS annotations excluding setting > and checking memory tags is ~3%. The performance impact caused by tags > will be unknown until we have hardware that supports MTE. > > As a side-effect, this patchset speeds up generic KASAN by ~15%. Forgot to include changes v1->v2: - Use EXPORT_SYMBOL_GPL() for arm64 symbols. - Rename kmalloc bool flag argument to is_kmalloc. - Make empty mte_set_mem_tag_range() return void. - Fix build warning in 32-bit systems by using unsigned long instead of u64 in WARN_ON() checks. - Minor changes in comments and commit descriptions. - Use kfence_ksize() before __ksize() to avoid crashes with KFENCE. - Use inline instead of __always_inline. > > Andrey Konovalov (12): > kasan, mm: don't save alloc stacks twice > kasan, mm: optimize kmalloc poisoning > kasan: optimize large kmalloc poisoning > kasan: clean up setting free info in kasan_slab_free > kasan: unify large kfree checks > kasan: rework krealloc tests > kasan, mm: fail krealloc on freed objects > kasan, mm: optimize krealloc poisoning > kasan: ensure poisoning size alignment > arm64: kasan: simplify and inline MTE functions > kasan: inline HW_TAGS helper functions > arm64: kasan: export MTE symbols for KASAN tests > > arch/arm64/include/asm/cache.h | 1 - > arch/arm64/include/asm/kasan.h | 1 + > arch/arm64/include/asm/mte-def.h | 2 + > arch/arm64/include/asm/mte-kasan.h | 65 ++++++++-- > arch/arm64/include/asm/mte.h | 2 - > arch/arm64/kernel/mte.c | 48 +------- > arch/arm64/lib/mte.S | 16 --- > include/linux/kasan.h | 25 ++-- > lib/test_kasan.c | 111 +++++++++++++++-- > mm/kasan/common.c | 187 ++++++++++++++++++++--------- > mm/kasan/kasan.h | 72 +++++++++-- > mm/kasan/shadow.c | 53 ++++---- > mm/slab_common.c | 18 ++- > mm/slub.c | 3 +- > 14 files changed, 418 insertions(+), 186 deletions(-) > > -- > 2.30.0.365.g02bc693789-goog > From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.1 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,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 72245C433DB for ; Fri, 5 Feb 2021 16:27:11 +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 0184664DEE for ; Fri, 5 Feb 2021 16:27:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0184664DEE 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:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=23s4USJRf4PeDOyka6oQEDomo0GnwmKs7IRiwFQmnMM=; b=tOfqMCpGpjUTEGgGuj1p28dWr H9JL8WpN7Gp6IDvXQg7xQpSFzRcb85CxHRV8ta7puYfTx8pH8xU8MU0j56DGS8Lvs+umsH5jexE7X htzfIAIdMqy53SrqV5jdb9K7F8hYUgkniUeT3q3DZ664mDVSqxKYJbPTIGN1ScepM1kxVu5GnkUOW 2e8VsKGzQ7SYoNx3dr7jCj7idqN6bCsGv7ngXz3LQG1DmrYTtVG0UGqHQ6X3TBx8JDsWoL71Pe16g e6rFHi2quJKjf3JYhBxSkSp+VgGFDzDpGv4ASP5Qfmq7Z1ogKQYtmoF5t4wyP4Hf7k96cZH9KZAgC We8Kb8fjw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l83vl-0005MV-KE; Fri, 05 Feb 2021 16:26:01 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l83vi-0005Ky-Ih for linux-arm-kernel@lists.infradead.org; Fri, 05 Feb 2021 16:25:59 +0000 Received: by mail-pl1-x62e.google.com with SMTP id x9so3822494plb.5 for ; Fri, 05 Feb 2021 08:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=YWfA2TQ5ApvZiaB/IqgvOHh0zr5cPm+JHUeKZ3MWatPWqRn+mvCJRLw/TwPHlOjRX3 xSzjR3V9y59pebgurUiBcvvHg+NeXKpZNzzyfxxhKXfVgRx86huXB3XiDaEup1uA3iZu 58WHlIewB/n6yqYVlpdN2029/6Xn3wg2TRyryIQtMn0Jsn+i+ZMW8jyL6K71IhSHNL33 E1X/C2e96YJz8ZE451WxgNnwUhqWRee0PR7JOK+kUsqhvgZTq/Mh4RPW3a+Ch+rZ9rYJ ykElq77xB8X64yHy+M0EZZCevdU23gKPsL+WVLfFgJKRcLus7h61IuWtG43Pf0p+Tksc 1+tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RAV6woYg0kfqY+8ibsodS4//9eDsxI9wZiwPSoFnDsw=; b=SlS/ZMZqQllBdMmeGi+uPCh9reMetsrS9puU01KrOvVR+Oofxjp3nQ+TXdcHjUQHoG ZgCLoTKsDUDG2v5XVo9yBDzv3xrqMag3GU9N7LElsDWikAeyYRO2iPjLefLSQ3BYu/5N 5VTUsDX/9B9LdHVfrbuSZw2Yj7j5AqhFmE4hzinWpWoEKbl4j1KXmT5o2oLDh74DRUp8 LQlLArqbSc4mJbUd92Hg0JylOmHr+2u078qcOZkcvKF0ITNRESekNaNQUq1rQFKfeZAY W2ve1aKbcSUcj85vbCT55nuF90L26cKr6PCa4Ojh54Ie3tN2wiaPwx3bC5CrJ9x2l1/y fZmg== X-Gm-Message-State: AOAM530n+yjSkEVsGcoonXQJNgVWrcymgjlFbFh66C64ZRCABrL6D6nm cM+X0jgSgPOaX8NKPuGEHJFMTa3ORd7B4mE8ec5FiQ== X-Google-Smtp-Source: ABdhPJz7hg3W9UVrqwUtxXCMXQuIfjDWNNH7DXXlqilvLV51Hybl4F2VuwOFjYZCYn1biMA69T6PJSx+PVqU/vuc6IU= X-Received: by 2002:a17:90b:350b:: with SMTP id ls11mr4812469pjb.166.1612542355340; Fri, 05 Feb 2021 08:25:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Fri, 5 Feb 2021 17:25:44 +0100 Message-ID: Subject: Re: [PATCH v2 00/12] kasan: optimizations and fixes for HW_TAGS To: Andrew Morton , Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210205_112558_911141_B02BFFF3 X-CRM114-Status: GOOD ( 18.61 ) 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: Branislav Rankov , Kevin Brodsky , Will Deacon , LKML , kasan-dev , Linux Memory Management List , Linux ARM , Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 5, 2021 at 4:39 PM Andrey Konovalov wrote: > > This patchset goes on top of: > > 1. Vincenzo's async support patches [1], and > 2. "kasan: untag addresses for KFENCE" fix [2] (already in mm). > > [1] https://lore.kernel.org/linux-arm-kernel/20210130165225.54047-1-vincenzo.frascino@arm.com/ > [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=akpm&id=dec4728fab910da0c86cf9a97e980f4244ebae9f > > This patchset makes the HW_TAGS mode more efficient, mostly by reworking > poisoning approaches and simplifying/inlining some internal helpers. > > With this change, the overhead of HW_TAGS annotations excluding setting > and checking memory tags is ~3%. The performance impact caused by tags > will be unknown until we have hardware that supports MTE. > > As a side-effect, this patchset speeds up generic KASAN by ~15%. Forgot to include changes v1->v2: - Use EXPORT_SYMBOL_GPL() for arm64 symbols. - Rename kmalloc bool flag argument to is_kmalloc. - Make empty mte_set_mem_tag_range() return void. - Fix build warning in 32-bit systems by using unsigned long instead of u64 in WARN_ON() checks. - Minor changes in comments and commit descriptions. - Use kfence_ksize() before __ksize() to avoid crashes with KFENCE. - Use inline instead of __always_inline. > > Andrey Konovalov (12): > kasan, mm: don't save alloc stacks twice > kasan, mm: optimize kmalloc poisoning > kasan: optimize large kmalloc poisoning > kasan: clean up setting free info in kasan_slab_free > kasan: unify large kfree checks > kasan: rework krealloc tests > kasan, mm: fail krealloc on freed objects > kasan, mm: optimize krealloc poisoning > kasan: ensure poisoning size alignment > arm64: kasan: simplify and inline MTE functions > kasan: inline HW_TAGS helper functions > arm64: kasan: export MTE symbols for KASAN tests > > arch/arm64/include/asm/cache.h | 1 - > arch/arm64/include/asm/kasan.h | 1 + > arch/arm64/include/asm/mte-def.h | 2 + > arch/arm64/include/asm/mte-kasan.h | 65 ++++++++-- > arch/arm64/include/asm/mte.h | 2 - > arch/arm64/kernel/mte.c | 48 +------- > arch/arm64/lib/mte.S | 16 --- > include/linux/kasan.h | 25 ++-- > lib/test_kasan.c | 111 +++++++++++++++-- > mm/kasan/common.c | 187 ++++++++++++++++++++--------- > mm/kasan/kasan.h | 72 +++++++++-- > mm/kasan/shadow.c | 53 ++++---- > mm/slab_common.c | 18 ++- > mm/slub.c | 3 +- > 14 files changed, 418 insertions(+), 186 deletions(-) > > -- > 2.30.0.365.g02bc693789-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel