Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3759827pxb; Wed, 13 Oct 2021 12:21:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwClNEJNb1JwpG/UZoBTQH6Qm8MhoLQU2zF88dsvrLIDRvJF+2Tb8yc8IkqmUW8Kd0rjoD6 X-Received: by 2002:a17:902:9a04:b0:13a:1ae3:add2 with SMTP id v4-20020a1709029a0400b0013a1ae3add2mr912385plp.28.1634152895162; Wed, 13 Oct 2021 12:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634152895; cv=none; d=google.com; s=arc-20160816; b=Wb4InlkF476O+a7kaJrqoYtu3t/NUBnrDaSAmAdhegksJ5Gjtu47aVICELzWPookR3 ++k8Ls/sUbZjikiMwrRyk8pRbVGlUdW9ionyvCRQ5NxzlXCYR/KC6btD8FVNMPR0+0Yv KRrgVbaxaStaHbFyYQWu/RE8AxSh7mJsAj4HmoKE12n//5fIqVdW0T4HfCTmAoHTvtPY QY1OAbTYzNMoxaiPSlRpeKuJP5pFXofJqULKgR2eWcW0pI6WC4HmjHzb8iSu9fHoequP Oj2b4I66aGC3t5JijO3BO1WFILuqS/Qrsqy2Tr8jsSUM3hz4gozCdTVig6tJeEMrQrXa cMXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=sb3+PXEuFiy8mwAOftayR6RKlZ8hr0TnFKfp0ak4h+E=; b=ZXGKE9M70ap9nmQw1aRSJNI1tXk6Bn28GfOnQ4UwARbEH39z0Ua3jjTnybrduunvfX YUMZp1R9ateyUiqHYcjQE8yTJlZsAHmtEPLkX+IDmVKv/bV5fUTlXyFfvsGT3fLnrToA ceyLIaXNraQsiMRSz9P48PkWYNVFu7fvl0HxoXXJ9dUDCNWViEsRe1HVLqCxNeaWlUY3 L0KQ3RKIUSKOgnjZImeFLBCyuPwJLx6HVlzzXJtqGwyOqn9kDHGo2xidA1exhSvjzKAN zA1FuLb9RNfi8icJLE3ukPLDZvcIa++mW7feeCmZ3KKIk/ZErhkLVvcKMCBPih49cEb5 i+ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z129si559716pgb.508.2021.10.13.12.21.21; Wed, 13 Oct 2021 12:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235560AbhJMTWX (ORCPT + 99 others); Wed, 13 Oct 2021 15:22:23 -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-kernel@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) > {