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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 B330CC433E0 for ; Mon, 18 Jan 2021 11:08:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FAD0221F8 for ; Mon, 18 Jan 2021 11:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389293AbhARKuz (ORCPT ); Mon, 18 Jan 2021 05:50:55 -0500 Received: from foss.arm.com ([217.140.110.172]:60282 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389638AbhARKZk (ORCPT ); Mon, 18 Jan 2021 05:25:40 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 888901FB; Mon, 18 Jan 2021 02:24:54 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.39.202]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 019A63F66E; Mon, 18 Jan 2021 02:24:51 -0800 (PST) Date: Mon, 18 Jan 2021 10:24:26 +0000 From: Mark Rutland To: Vincenzo Frascino Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Marco Elver , Catalin Marinas , Branislav Rankov , Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Andrey Ryabinin , Will Deacon , Dmitry Vyukov Subject: Re: [PATCH v3 1/4] kasan, arm64: Add KASAN light mode Message-ID: <20210118102426.GA29688@C02TD0UTHF1T.local> References: <20210115120043.50023-1-vincenzo.frascino@arm.com> <20210115120043.50023-2-vincenzo.frascino@arm.com> <20210115150811.GA44111@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 16, 2021 at 01:47:08PM +0000, Vincenzo Frascino wrote: > On 1/15/21 3:08 PM, Mark Rutland wrote: > > On Fri, Jan 15, 2021 at 12:00:40PM +0000, Vincenzo Frascino wrote: > >> #ifdef CONFIG_KASAN_HW_TAGS > >> -#define arch_enable_tagging() mte_enable_kernel() > >> +#define arch_enable_tagging(mode) mte_enable_kernel(mode) > > > > Rather than passing a mode in, I think it'd be better to have: > > > > * arch_enable_tagging_prod() > > * arch_enable_tagging_light() > > > > ... that we can map in the arch code to separate: > > > > * mte_enable_kernel_sync() > > * mte_enable_kernel_async() > > > > ... as by construction that avoids calls with an unhandled mode, and we > > wouldn't need the mode enum kasan_hw_tags_mode... > > > >> +static inline int hw_init_mode(enum kasan_arg_mode mode) > >> +{ > >> + switch (mode) { > >> + case KASAN_ARG_MODE_LIGHT: > >> + return KASAN_HW_TAGS_ASYNC; > >> + default: > >> + return KASAN_HW_TAGS_SYNC; > >> + } > >> +} > > > > ... and we can just have a wrapper like this to call either of the two functions directly, i.e. > > > > static inline void hw_enable_tagging_mode(enum kasan_arg_mode mode) > > { > > if (mode == KASAN_ARG_MODE_LIGHT) > > arch_enable_tagging_mode_light(); > > else > > arch_enable_tagging_mode_prod(); > > } > > > > Fine by me, this would remove the need of adding a new enumeration as well and > reflect on the arch code. I would keep "arch_enable_tagging_mode_sync" and > "arch_enable_tagging_mode_async" though to give a clear indication in the KASAN > code of the mode we are setting. I will adapt my code accordingly for v4. Thanks, that sounds great! I completely agree on keeping the '_sync' and '_aync' suffixes in the the core code. Mark. 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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 5C0B2C433E0 for ; Mon, 18 Jan 2021 10:26:14 +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 07115227C3 for ; Mon, 18 Jan 2021 10:26:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07115227C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PF6Gq64qGPhkcHkQfuwHWaRekust63QnjbhdLRWx6AY=; b=R6R5ZXprgBCFuk54u6KDY/HPC x6gqEUtL4z1HMato72nsHFXWk5Qnp/tO/sTS2ueKdmN/N8/7zf5f4//6Tf0cbqFz/AW/Q34YIRYpo 6PqwsqR2fvPaU2G87YRLwbJXrc0BNRBE3plNUf17QtSMfLmX+bppQReBC+2KpCaijH1U6vkL53BYi wK8C/ksehs+coRbn4vu0PWLm7t2gkleeD5Nl3U7MZdVnwhlPlSpHxyTBzGw24r420ypg9KJ0mdHVr aGRy1ucYnZRDLv1MmPEdJG0ud7hF4ASHaWWiQt37pW364AXqt1243J+8b496mFtOv8kdbWpJIlmcK ZAKSCFhAA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1RiY-0005js-Kj; Mon, 18 Jan 2021 10:25:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1RiV-0005j2-V5 for linux-arm-kernel@lists.infradead.org; Mon, 18 Jan 2021 10:25:00 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 888901FB; Mon, 18 Jan 2021 02:24:54 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.39.202]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 019A63F66E; Mon, 18 Jan 2021 02:24:51 -0800 (PST) Date: Mon, 18 Jan 2021 10:24:26 +0000 From: Mark Rutland To: Vincenzo Frascino Subject: Re: [PATCH v3 1/4] kasan, arm64: Add KASAN light mode Message-ID: <20210118102426.GA29688@C02TD0UTHF1T.local> References: <20210115120043.50023-1-vincenzo.frascino@arm.com> <20210115120043.50023-2-vincenzo.frascino@arm.com> <20210115150811.GA44111@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210118_052500_042956_1DAC773A X-CRM114-Status: GOOD ( 17.22 ) 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: Marco Elver , Catalin Marinas , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , Will Deacon , linux-arm-kernel@lists.infradead.org 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 Sat, Jan 16, 2021 at 01:47:08PM +0000, Vincenzo Frascino wrote: > On 1/15/21 3:08 PM, Mark Rutland wrote: > > On Fri, Jan 15, 2021 at 12:00:40PM +0000, Vincenzo Frascino wrote: > >> #ifdef CONFIG_KASAN_HW_TAGS > >> -#define arch_enable_tagging() mte_enable_kernel() > >> +#define arch_enable_tagging(mode) mte_enable_kernel(mode) > > > > Rather than passing a mode in, I think it'd be better to have: > > > > * arch_enable_tagging_prod() > > * arch_enable_tagging_light() > > > > ... that we can map in the arch code to separate: > > > > * mte_enable_kernel_sync() > > * mte_enable_kernel_async() > > > > ... as by construction that avoids calls with an unhandled mode, and we > > wouldn't need the mode enum kasan_hw_tags_mode... > > > >> +static inline int hw_init_mode(enum kasan_arg_mode mode) > >> +{ > >> + switch (mode) { > >> + case KASAN_ARG_MODE_LIGHT: > >> + return KASAN_HW_TAGS_ASYNC; > >> + default: > >> + return KASAN_HW_TAGS_SYNC; > >> + } > >> +} > > > > ... and we can just have a wrapper like this to call either of the two functions directly, i.e. > > > > static inline void hw_enable_tagging_mode(enum kasan_arg_mode mode) > > { > > if (mode == KASAN_ARG_MODE_LIGHT) > > arch_enable_tagging_mode_light(); > > else > > arch_enable_tagging_mode_prod(); > > } > > > > Fine by me, this would remove the need of adding a new enumeration as well and > reflect on the arch code. I would keep "arch_enable_tagging_mode_sync" and > "arch_enable_tagging_mode_async" though to give a clear indication in the KASAN > code of the mode we are setting. I will adapt my code accordingly for v4. Thanks, that sounds great! I completely agree on keeping the '_sync' and '_aync' suffixes in the the core code. Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel