lkml.org 
[lkml]   [2020]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: violating function pointer signature
----- On Nov 18, 2020, at 9:02 AM, rostedt rostedt@goodmis.org wrote:

> On Wed, 18 Nov 2020 14:21:36 +0100
> Peter Zijlstra <peterz@infradead.org> wrote:
>
>> I think that as long as the function is completely empty (it never
>> touches any of the arguments) this should work in practise.
>>
>> That is:
>>
>> void tp_nop_func(void) { }
>
> My original version (the OP of this thread) had this:
>
> +static void tp_stub_func(void)
> +{
> + return;
> +}
>
>>
>> can be used as an argument to any function pointer that has a void
>> return. In fact, I already do that, grep for __static_call_nop().
>>
>> I'm not sure what the LLVM-CFI crud makes of it, but that's their
>> problem.
>
> If it is already done elsewhere in the kernel, then I will call this
> precedence, and keep the original version.

It works for me. Bonus points if you can document in a comment that this
trick depends on the cdecl calling convention.

Thanks,

Mathieu

>
> This way Alexei can't complain about adding a check in the fast path of
> more than one callback attached.
>
> -- Steve

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

\
 
 \ /
  Last update: 2020-11-18 17:03    [W:0.124 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site