lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201116153834.57ace64e@gandalf.local.home>
Date:   Mon, 16 Nov 2020 15:38:34 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Sami Tolvanen <samitolvanen@...gle.com>
Cc:     Kees Cook <keescook@...omium.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Colin Ian King <colin.king@...onical.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] samples/ftrace: mark my_tramp[12]? global

On Mon, 16 Nov 2020 12:10:10 -0800
Sami Tolvanen <samitolvanen@...gle.com> wrote:

> On Mon, Nov 16, 2020 at 8:39 AM Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > On Fri, 13 Nov 2020 10:34:14 -0800
> > Sami Tolvanen <samitolvanen@...gle.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;
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ