Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2909172pxj; Sun, 20 Jun 2021 04:51:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbo8WmJDBP7DQDEIL8s9PP+/RpUVkc1Hi0qN3Tzl91Nn57aXzulPeDdk8AIoolIiyBcPJY X-Received: by 2002:a17:907:960c:: with SMTP id gb12mr1553512ejc.21.1624189886820; Sun, 20 Jun 2021 04:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624189886; cv=none; d=google.com; s=arc-20160816; b=PNP3vbKdn5thJNi3G621xFRdmw2Kq5H5EaLeMqonofe7DXzZsaOtxf2+TfqZLxN6+d XhEltwzJoC+l+x+Yl1FXflNYKuaynUzZf/vhKBCrQoowRHYTAuaGFUiJ65iUMjQ+1+WZ +NVlVcCjmUwJH7Rg4Y4dOSJx5un2OSUoDo1so57uDHHeYMP9A3U19TYSGwW2jWSBfeOV mHob7/j8jC+gf40euln2g5ZhJ8JCol0Cg6i8cso3fGdMtb4n3ykEq7zjYcvSKpOmozJz BEKua+lcDJQoepcWPA9IC3O/scRtslRYf3x7reBBaFTSLIn5V1Z6JE4EQCo15mu7vF/p j4yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=rz2InlAbffT/WZtCvFC84HB+WD0ok7M/gTk6Q3JWz1k=; b=WPsY18Hc6FbDiJG8U/qtsrvc8Qj6OyrVrPQ2r0EIKq1h5MtWe8MNEDRastgM5j7AgO oaQPSkJ0d+kzbEzyeA8PNQVz2EKWl7vKiEXJx4+MVwSQnLLTIWrh0ILw9WUqCJTgFSM2 eSGUIL+MFjVc6aU2mC1ES2Yv+YGFGniOLMJ41qoPPWXilWuI0xQiAQnJtUkDjyVSYL+r vGI7pb4hgyUtKu1hI2mEgbee1Fo89UYcfYf2tGyaAzFr7cLPL/4e9sC4W1tMETae16c3 sOx35Pzd4C5o2LFZMli3e61jVIwID3/EMC8d6BLG2MJ+EPUhexnJ2Qm1e8EqH5qOFPPd B7xA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si7958172ejn.173.2021.06.20.04.51.03; Sun, 20 Jun 2021 04:51:26 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229637AbhFTLub (ORCPT + 99 others); Sun, 20 Jun 2021 07:50:31 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:60758 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229632AbhFTLu1 (ORCPT ); Sun, 20 Jun 2021 07:50:27 -0400 X-UUID: 4ad91dac93454e12a7fff2379ad760e2-20210620 X-UUID: 4ad91dac93454e12a7fff2379ad760e2-20210620 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1014899775; Sun, 20 Jun 2021 19:48:12 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 20 Jun 2021 19:48:11 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 20 Jun 2021 19:48:11 +0800 From: Kuan-Ying Lee To: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Marco Elver , Dmitry Vyukov , Andrew Morton , Matthias Brugger CC: , , , , , , , , Kuan-Ying Lee Subject: [PATCH v3 3/3] kasan: add memory corruption identification support for hardware tag-based mode Date: Sun, 20 Jun 2021 19:47:56 +0800 Message-ID: <20210620114756.31304-4-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210620114756.31304-1-Kuan-Ying.Lee@mediatek.com> References: <20210620114756.31304-1-Kuan-Ying.Lee@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add memory corruption identification support for hardware tag-based mode. We store one old free pointer tag and free backtrace. Signed-off-by: Kuan-Ying Lee Suggested-by: Marco Elver Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Andrew Morton --- lib/Kconfig.kasan | 2 +- mm/kasan/kasan.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan index 6f5d48832139..2cc25792bc2f 100644 --- a/lib/Kconfig.kasan +++ b/lib/Kconfig.kasan @@ -157,7 +157,7 @@ config KASAN_STACK config KASAN_TAGS_IDENTIFY bool "Enable memory corruption identification" - depends on KASAN_SW_TAGS + depends on KASAN_SW_TAGS || KASAN_HW_TAGS help This option enables best-effort identification of bug type (use-after-free or out-of-bounds) at the cost of increased diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index b0fc9a1eb7e3..d6f982b8a84e 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -153,7 +153,7 @@ struct kasan_track { depot_stack_handle_t stack; }; -#ifdef CONFIG_KASAN_TAGS_IDENTIFY +#if defined(CONFIG_KASAN_TAGS_IDENTIFY) && defined(CONFIG_KASAN_SW_TAGS) #define KASAN_NR_FREE_STACKS 5 #else #define KASAN_NR_FREE_STACKS 1 -- 2.18.0