Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3761200pxb; Wed, 13 Oct 2021 12:23:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwPqKT0OQDgMfe6NB66ls0pV1DBINzUdCOXKh8EWjpZs6YxWZ10jY82R7SIW8YzJa9zSyS X-Received: by 2002:a17:90b:3148:: with SMTP id ip8mr1274962pjb.62.1634153023902; Wed, 13 Oct 2021 12:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634153023; cv=none; d=google.com; s=arc-20160816; b=Yqst2I1AF1SGQJkYbu5RHGJbZUc/6dgeC2rowcQDNqIPTaTPaHa/y1rQqkX5qGn8Ly PaEJxUXIQvT5Aub4dl3AO+psNpXth64pibKmx4m3g2KZxnRCFqCbxp7ElCPTmGsXL0V5 C8kePgN7S+aYQel92k7bEcUTm/LSb3HS8mVFwQpoHPTGIpDLu67mOiVM1XZMOfHpoSew VzT3aIEnU8/x51ku2u6/3sP43ac0N8vY3Q93NK8Uv1Yuyk79SH1I08BPYNQZEHyq9X0j HQK17Jq0bDv3F45ud6SazHoOoEawxpaYb7b1Oa9a2zyuWSApnzXi3nBbxCJJhEKND8Ah X6gg== 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=hkFD7hrJ1D/6x8Qf/SVA3DNP+SCGPzSKrS0bp224oIE=; b=P8OFTPVMkokpZQRoGqRNAl4f8zeeNcs5wp1A1Bck01UA1K8Vw3yCHVG55Jkk0wWnJZ EbMryNBEtJUESua7jrrVoafmBKzN6tkHUOk8DPQZUEVIw4bWQdbK8GjpLlxCcXOS0FQH GQHQ6LjRudw7eZySpErBW5xCINU0i8BxIN5/nK64JvH+cCt/rwxsrP6nSfqa+grirJ+Z LB6k1Sd2zcxtFOt6XxYZhEfhgkKn4n2FIYSLSdMasjW0a3+szeSm7MEMCrfP+3ZpCUUt eGe8o+66nNfVtRsGXmjArsbrwDrQRdFDufBRV9WLWLiTz1Bq7n11fgRHembzvvgZAA8I IeAA== 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.23.07; Wed, 13 Oct 2021 12:23:43 -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 S229664AbhJMTXE (ORCPT + 99 others); Wed, 13 Oct 2021 15:23:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:56498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233182AbhJMTXC (ORCPT ); Wed, 13 Oct 2021 15:23:02 -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 232B1611F0; Wed, 13 Oct 2021 19:20:58 +0000 (UTC) Date: Wed, 13 Oct 2021 15:20:56 -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 06/15] ftrace: Use an opaque type for functions not callable from C Message-ID: <20211013152056.3a01d9bb@gandalf.local.home> In-Reply-To: <20211013181658.1020262-7-samitolvanen@google.com> References: <20211013181658.1020262-1-samitolvanen@google.com> <20211013181658.1020262-7-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:49 -0700 Sami Tolvanen wrote: > With CONFIG_CFI_CLANG, the compiler changes function references to > point to the CFI jump table. As ftrace_call, ftrace_regs_call, and > mcount_call are not called by C code, but are trampolines injected > as calls replacing the nops at the start of functions added by the > compiler, use DECLARE_NOT_CALLED_FROM_C to declare them. > > Signed-off-by: Sami Tolvanen > Tested-by: Nick Desaulniers > Tested-by: Sedat Dilek > --- > include/linux/ftrace.h | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h > index 832e65f06754..c53a00b96ba9 100644 > --- a/include/linux/ftrace.h > +++ b/include/linux/ftrace.h > @@ -578,9 +578,10 @@ extern void ftrace_replace_code(int enable); > extern int ftrace_update_ftrace_func(ftrace_func_t func); > extern void ftrace_caller(void); > extern void ftrace_regs_caller(void); > -extern void ftrace_call(void); > -extern void ftrace_regs_call(void); > -extern void mcount_call(void); > + > +DECLARE_NOT_CALLED_FROM_C(ftrace_call); > +DECLARE_NOT_CALLED_FROM_C(ftrace_regs_call); > +DECLARE_NOT_CALLED_FROM_C(mcount_call); > > void ftrace_modify_all_code(int command); > Reviewed-by: Steven Rostedt (VMware) -- Steve