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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F10AC43334 for ; Fri, 1 Jul 2022 02:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PiCJkDLC3T5WVDEdHTKZnZKOLjyWbuJ0bB+/cRDQN50=; b=ZMq3tifkDC5k1J trlNSzLVfuE2PdpHew35edBcXwAlGjH6qlUPfDpwHK1irvhVRA5m5HvANnHtuG71m7AOUhbj6smSF 8jZ6MS9qI0CZIWujeLJpoCSi9/xQUuAKgWOS6+K7LBzvxdbTBEO0LYKVJfzR9FATY54fUFLCET2+v PVAOdz5jjRLtCed6O9M4XsK4dQgUQlM3CxKTUy7TfFa64wd+oxSNcYO0Tei5++owukKL/S7Y6itH1 Hy4PhInw1iIwdmkMorreyOCK/oyA7vYIu521JlvtBFaliXRA4GVluK22X6NQaRggslWkJRfsuP0Ku dl36CZwH8sck2P/87Jbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7685-002MwD-3H; Fri, 01 Jul 2022 02:11:33 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7681-002Muq-9q; Fri, 01 Jul 2022 02:11:32 +0000 X-UUID: 593a4a7b361440ed922bc0ffc350c75d-20220630 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.7,REQID:09fe5091-b442-497e-8684-ed4a28a306a6,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:87442a2,CLOUDID:df054ed6-5d6d-4eaf-a635-828a3ee48b7c,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:-5,EDM:-3,IP:nil,URL:1,File:ni l,QS:nil,BEC:nil,COL:0 X-UUID: 593a4a7b361440ed922bc0ffc350c75d-20220630 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1132874403; Thu, 30 Jun 2022 19:11:18 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.186) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 1 Jul 2022 10:10:43 +0800 Received: from mszsdtcf10.gcn.mediatek.inc (10.16.4.60) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.3 via Frontend Transport; Fri, 1 Jul 2022 10:10:42 +0800 From: Haibo Li To: CC: , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH 1/2] ANDROID: cfi: enable sanitize for cfi.c Date: Fri, 1 Jul 2022 10:10:42 +0800 Message-ID: <20220701021042.48037-1-haibo.li@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220630_191129_393626_AEB7EB17 X-CRM114-Status: GOOD ( 13.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Thu, Jun 30, 2022 at 2:47 AM Haibo Li wrote: > > > > currenly,cfi.c is excluded from cfi sanitize because of cfi handler. > > The side effect is that we can not transfer function pointer to other > > files which enable cfi sanitize. > > > > Enable cfi sanitize for cfi.c and bypass cfi check for > > __cfi_slowpath_diag > > > > Signed-off-by: Haibo Li > > Signed-off-by: Lecopzer Chen > > --- > > kernel/Makefile | 3 --- > > kernel/cfi.c | 8 +++++++- > > 2 files changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/kernel/Makefile b/kernel/Makefile index > > a7e1f49ab2b3..a997bef1a200 100644 > > --- a/kernel/Makefile > > +++ b/kernel/Makefile > > @@ -40,9 +40,6 @@ KCSAN_SANITIZE_kcov.o := n > UBSAN_SANITIZE_kcov.o := > > n CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) > > -fno-stack-protector > > > > -# Don't instrument error handlers > > -CFLAGS_REMOVE_cfi.o := $(CC_FLAGS_CFI) > > - > > obj-y += sched/ > > obj-y += locking/ > > obj-y += power/ > > diff --git a/kernel/cfi.c b/kernel/cfi.c index > > 08102d19ec15..456771c8e454 100644 > > --- a/kernel/cfi.c > > +++ b/kernel/cfi.c > > @@ -311,7 +311,7 @@ static inline cfi_check_fn find_check_fn(unsigned > long ptr) > > return fn; > > } > > > > -void __cfi_slowpath_diag(uint64_t id, void *ptr, void *diag) > > +static inline void __nocfi _run_cfi_check(u64 id, void *ptr, void > > +*diag) > > { > > cfi_check_fn fn = find_check_fn((unsigned long)ptr); > > > > @@ -320,6 +320,12 @@ void __cfi_slowpath_diag(uint64_t id, void *ptr, > void *diag) > > else /* Don't allow unchecked modules */ > > handle_cfi_failure(ptr); } > > + > > +void __cfi_slowpath_diag(u64 id, void *ptr, void *diag) { > > + /*run cfi check without cfi sanitize to avoid calling cfi handler > recursively*/ > > + _run_cfi_check(id, ptr, diag); } > > EXPORT_SYMBOL(__cfi_slowpath_diag); > > You can just add __nocfi to __cfi_slowpath_diag, right? There's no need for the > separate function. You are right.Now there is no requirement for constant crc of __cfi_slowpath_diag. I will change it later. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel