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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC670C433F5 for ; Wed, 13 Oct 2021 19:20:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9C51611C8 for ; Wed, 13 Oct 2021 19:20:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236976AbhJMTWQ (ORCPT ); Wed, 13 Oct 2021 15:22:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:56254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236935AbhJMTWP (ORCPT ); Wed, 13 Oct 2021 15:22:15 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6453D611CB; Wed, 13 Oct 2021 19:20:10 +0000 (UTC) Date: Wed, 13 Oct 2021 15:20:07 -0400 From: Steven Rostedt To: Sami Tolvanen Cc: x86@kernel.org, Kees Cook , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v5 05/15] tracepoint: Exclude tp_stub_func from CFI checking Message-ID: <20211013152007.7b2e57f4@gandalf.local.home> In-Reply-To: <20211013181658.1020262-6-samitolvanen@google.com> References: <20211013181658.1020262-1-samitolvanen@google.com> <20211013181658.1020262-6-samitolvanen@google.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On Wed, 13 Oct 2021 11:16:48 -0700 Sami Tolvanen wrote: > If allocate_probes fails, func_remove replaces the old function > with a pointer to tp_stub_func, which is called using a mismatching > function pointer that will always trip indirect call checks with > CONFIG_CFI_CLANG. Use DEFINE_CFI_IMMEDATE_RETURN_STUB to define > tp_stub_func to allow it to pass CFI checking. > > Signed-off-by: Sami Tolvanen > Reviewed-by: Nick Desaulniers > Tested-by: Nick Desaulniers > Tested-by: Sedat Dilek > --- > kernel/tracepoint.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c > index 64ea283f2f86..8a0d463c8507 100644 > --- a/kernel/tracepoint.c > +++ b/kernel/tracepoint.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -99,10 +100,7 @@ struct tp_probes { > }; > > /* Called in removal of a func but failed to allocate a new tp_funcs */ > -static void tp_stub_func(void) > -{ > - return; > -} > +static DEFINE_CFI_IMMEDIATE_RETURN_STUB(tp_stub_func); Reviewed-by: Steven Rostedt (VMware) -- Steve > > static inline void *allocate_probes(int count) > {