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=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,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 37DF3C07E99 for ; Mon, 5 Jul 2021 10:33:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11171613F7 for ; Mon, 5 Jul 2021 10:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbhGEKgF (ORCPT ); Mon, 5 Jul 2021 06:36:05 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:56953 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230521AbhGEKgE (ORCPT ); Mon, 5 Jul 2021 06:36:04 -0400 X-UUID: 4b55a2b2358d48b3bde728d1ed5ef1f3-20210705 X-UUID: 4b55a2b2358d48b3bde728d1ed5ef1f3-20210705 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1204610253; Mon, 05 Jul 2021 18:33:26 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 5 Jul 2021 18:33:25 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 5 Jul 2021 18:33:24 +0800 From: To: CC: , , , Yee Lee , Matthias Brugger , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" Subject: [PATCH v6 0/2] kasan: solve redzone overwritten issue at debug Date: Mon, 5 Jul 2021 18:32:25 +0800 Message-ID: <20210705103229.8505-1-yee.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yee Lee Issue: In SLUB debug, hwtag kasan_unpoison() would overwrite the redzone in those objects with unaligned size. The first patch Introduces slub_debug_enable_unlikely() to check the state of debug mode. The second patch Adds memzero_explict() to separate the initialization for such condition. The new code path is executed about 1.1% during nromal booting process. The penalty is acceptable since it only works in debug mode. ============= Exp: QEMUv5.2(+mte)/SLUB_debug mode code path exec : 941/80854 (1.1%) Changed since v6: - Move helper instead of introducing a new one. Changed since v5: - Fix format Changed since v4: - Introduce slub_debug_enable_unlikly() to check the debug state. - Include "slab.h" and Add slub_debug_enable_unlikly() to lead the condition statement. - Add comment block about this new code path in source code. Changed since v3: - Apply IS_ENABLED to wrap codes under SLUB debug mode. - Replace memset() by memzero_explict(). --- Marco Elver (1): mm: move helper to check slub_debug_enabled Yee Lee (1): kasan: Add memzero int for unaligned size at DEBUG mm/kasan/kasan.h | 12 ++++++++++++ mm/slab.h | 15 +++++++++++---- mm/slub.c | 14 -------------- 3 files changed, 23 insertions(+), 18 deletions(-) -- 2.18.0