Re: [PATCH] tracepoint: Fix CFI failures with tp_stub_func

From: Mathieu Desnoyers
Date: Thu Mar 23 2023 - 14:43:55 EST


On 2023-03-23 14:42, Steven Rostedt wrote:
On Thu, 23 Mar 2023 14:37:15 -0400
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx> wrote:

Repeated again so Mathieu doesn't have to search for it.

[ Note, this version does use undefined compiler behavior (assuming that
a stub function with no parameters or return, can be called by a location
that thinks it has parameters but still no return value. Static calls
do the same thing, so this trick is not without precedent.

There's another solution that uses RCU tricks and is more complex, but
can be an alternative if this solution becomes an issue.

Link: https://lore.kernel.org/lkml/20210127170721.58bce7cc@xxxxxxxxxxxxxxxxxx/
]

Ugh. The last thing we need there is more RCU complexity. My brain is still recovering
from fixing the last time the introduction of static calls special-cases ended up subtly
breaking tracepoints.

Well, we can go back to your approach with doing the check in the iterator.
Setting it to 0x1UL I think is what you wanted (to know it's a removed
function and not a random NULL).

I could write that up if you want.

I can write the patch and send an RFC, won't take long.

Thanks,

Mathieu


-- Steve

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