From: Steven Rostedt <rostedt@goodmis.org>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: Kees Cook <keescook@chromium.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Colin Ian King <colin.king@canonical.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] samples/ftrace: mark my_tramp[12]? global
Date: Mon, 16 Nov 2020 15:38:34 -0500 [thread overview]
Message-ID: <20201116153834.57ace64e@gandalf.local.home> (raw)
In-Reply-To: <CABCJKudNGa2=65vATJMqo--8guvWHZ6-wMWHZQy-ZaH32dXdnA@mail.gmail.com>
On Mon, 16 Nov 2020 12:10:10 -0800
Sami Tolvanen <samitolvanen@google.com> wrote:
> On Mon, Nov 16, 2020 at 8:39 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > On Fri, 13 Nov 2020 10:34:14 -0800
> > Sami Tolvanen <samitolvanen@google.com> wrote:
> >
> > > 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.
> > >
> >
> > Actually, since that function is not really global, would it work if you
> > removed the "extern" from the my_tramp declaration?
>
> Unfortunately not, removing the "extern" doesn't seem to change anything.
>
> > In other words, is there a way to tell C that a function is declared in an
> > inline assembly block?
>
> I'm not sure if there's a way to tell C that a static function is
> declared in inline assembly. At least I couldn't find a way that would
> make the compiler happy.
I'm trying to see the warning. What option makes clang trigger a warning on
this?
From user space, I'm just using the following file:
#include <stdio.h>
void my_direct_func(char *str)
{
printf("%s\n", str);
}
int test(char *str);
asm (
" .pushsection .text, \"ax\", @progbits\n"
" .type test, @function\n"
" test:"
" pushq %rbp\n"
" movq %rsp, %rbp\n"
" pushq %rdi\n"
" call my_direct_func\n"
" popq %rdi\n"
" leave\n"
" ret\n"
" .size test, .-test\n"
" .popsection\n"
);
int main (int argc, char **argv)
{
test("hello");
return 0;
}
next prev parent reply other threads:[~2020-11-16 20:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 18:34 [PATCH] samples/ftrace: mark my_tramp[12]? global Sami Tolvanen
2020-11-13 18:57 ` Kees Cook
2020-11-16 16:39 ` Steven Rostedt
2020-11-16 20:10 ` Sami Tolvanen
2020-11-16 20:38 ` Steven Rostedt [this message]
2020-11-16 21:10 ` Sami Tolvanen
2020-11-16 21:18 ` Steven Rostedt
2020-11-16 21:27 ` Sami Tolvanen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201116153834.57ace64e@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=colin.king@canonical.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samitolvanen@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox