Re: Rust kernel policy

Steven Rostedt
2025-02-21T22:14:28Z

On Fri, 21 Feb 2025 19:23:38 +0100
Martin Uecker <uecker@tugraz.at> wrote:

> > where func is defined as:
> >
> > void func(void) { return ; }
>
> Calling a function declared in this way with arguments
> would be rejected by the compiler, so I am not sure how
> this works now.
>
> If you used
>
> void func();
>
> to declare the function, this is not possible anymore in C23.

As the comment in the code states:

include/linux/static_call.h:

* This feature is strictly UB per the C standard (since it casts a function
* pointer to a different signature) and relies on the architecture ABI to
* make things work. In particular it relies on Caller Stack-cleanup and the
* whole return register being clobbered for short return values. All normal
* CDECL style ABIs conform.

Basically it's assigned via casts.

-- Steve