Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2807689pxu; Mon, 14 Dec 2020 11:20:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyV99pHTLcoqELIZ+aPqfnGPVeQ0mBVh0i5o5Sy24VpPJHHLwHRjCC/ZapMWsNrf+C9STeu X-Received: by 2002:a17:906:d19b:: with SMTP id c27mr24194000ejz.234.1607973601808; Mon, 14 Dec 2020 11:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607973601; cv=none; d=google.com; s=arc-20160816; b=IEZMAynDMBuSZtTvvfGdPXG4c/vI8KuV5kzgR8Zss2yVqdgDdH+2u9kamKhqKz0U8C PEMerrejuJlAm0/SirlZWJA7EN5lE9E3JNrXpdWPjxcfURop/la7TW7ReAlbYZN7HZ+G jOpZF9+nF90XTck+Daz/8QOqzBNxxW5oeeOt/QGBSqNAQlT6vszDsW8MuzWjgds6n+yc LRJbonZ5Eacpm8INrpa5yWzWx3P9LNDIYYU1QSrw00fs4UmRTkGsRlNlgfME0XF7YhrD tj/2ckAccz/OQBFM2xO8NnpFBz6Ca97KXP/UT74G5kFw73Q0qyz8evTsXeEL+m00n9+U 4UmQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=cua0RRUDpq5vj4+UKPJ9zPv9VlykylBAAyEfKgfbwvs=; b=Bn7nOghRTjkBaxh10iPFzm92MsAAjdzWHefF6BhitWRvNeo2PUuevOAteYuJxjqiRc wtCQngpGIAWNfIRFh7BE53OloWRz7YS/CJnAhUY5M86MX2jGQqDLgaiTAupKaagGsmez EbOB0nAjmxi2e+wUNx2tki0I6xbNhu90M4seei+0tsM3xFlmYKslY+O6qbDRsSCk8CFD yza8wNOr0mMAtqBJ7AJenYT2syGj2aW4l4WuUjrEPI9G4pCEwVXNeAJTyRJHRF0DORVa BHGKyo3zkeU0aq6dXoZ6cGu/E8+HWQP+1nTYpM2XRi4oISxCd2pi686kG8NbOODPC9MK bNJw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs21si10673597ejb.468.2020.12.14.11.19.38; Mon, 14 Dec 2020 11:20:01 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732627AbgLNTKJ (ORCPT + 99 others); Mon, 14 Dec 2020 14:10:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:46228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408587AbgLNRhL (ORCPT ); Mon, 14 Dec 2020 12:37:11 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Sami Tolvanen , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 5.9 029/105] samples/ftrace: Mark my_tramp[12]? global Date: Mon, 14 Dec 2020 18:28:03 +0100 Message-Id: <20201214172556.681699000@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201214172555.280929671@linuxfoundation.org> References: <20201214172555.280929671@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sami Tolvanen [ Upstream commit 983df5f2699f83f78643b19d3399b160d1e64f5b ] my_tramp[12]? are declared as global functions in C, but they are not marked global in the inline assembly definition. This mismatch confuses Clang's Control-Flow Integrity checking. Fix the definitions by adding .globl. Link: https://lkml.kernel.org/r/20201113183414.1446671-1-samitolvanen@google.com Fixes: 9d907f1ae80b8 ("ftrace/samples: Add a sample module that implements modify_ftrace_direct()") Reviewed-by: Kees Cook Signed-off-by: Sami Tolvanen Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin --- samples/ftrace/ftrace-direct-modify.c | 2 ++ samples/ftrace/ftrace-direct-too.c | 1 + samples/ftrace/ftrace-direct.c | 1 + 3 files changed, 4 insertions(+) diff --git a/samples/ftrace/ftrace-direct-modify.c b/samples/ftrace/ftrace-direct-modify.c index c13a5bc5095be..5b9a09957c6e0 100644 --- a/samples/ftrace/ftrace-direct-modify.c +++ b/samples/ftrace/ftrace-direct-modify.c @@ -21,6 +21,7 @@ static unsigned long my_ip = (unsigned long)schedule; asm ( " .pushsection .text, \"ax\", @progbits\n" " .type my_tramp1, @function\n" +" .globl my_tramp1\n" " my_tramp1:" " pushq %rbp\n" " movq %rsp, %rbp\n" @@ -29,6 +30,7 @@ asm ( " .size my_tramp1, .-my_tramp1\n" " ret\n" " .type my_tramp2, @function\n" +" .globl my_tramp2\n" " my_tramp2:" " pushq %rbp\n" " movq %rsp, %rbp\n" diff --git a/samples/ftrace/ftrace-direct-too.c b/samples/ftrace/ftrace-direct-too.c index d5c5022be6642..3f0079c9bd6fa 100644 --- a/samples/ftrace/ftrace-direct-too.c +++ b/samples/ftrace/ftrace-direct-too.c @@ -16,6 +16,7 @@ extern void my_tramp(void *); asm ( " .pushsection .text, \"ax\", @progbits\n" " .type my_tramp, @function\n" +" .globl my_tramp\n" " my_tramp:" " pushq %rbp\n" " movq %rsp, %rbp\n" diff --git a/samples/ftrace/ftrace-direct.c b/samples/ftrace/ftrace-direct.c index 63ca06d42c803..a2729d1ef17f5 100644 --- a/samples/ftrace/ftrace-direct.c +++ b/samples/ftrace/ftrace-direct.c @@ -14,6 +14,7 @@ extern void my_tramp(void *); asm ( " .pushsection .text, \"ax\", @progbits\n" " .type my_tramp, @function\n" +" .globl my_tramp\n" " my_tramp:" " pushq %rbp\n" " movq %rsp, %rbp\n" -- 2.27.0