From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AAF02C87 for ; Wed, 13 Oct 2021 19:20:12 +0000 (UTC) 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) Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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) > {