Re: [RFC PATCH 0/2] kpatch: dynamic kernel patching

From: Andi Kleen
Date: Thu May 01 2014 - 16:45:38 EST


Josh Poimboeuf <jpoimboe@xxxxxxxxxx> writes:
>
> kpatch checks the backtraces of all tasks in stop_machine() to ensure
> that no instances of the old function are running when the new function
> is applied.

How does that work for tail calls?

call foo
foo:
...
jmp bar

bar:
... code executing ...

When you backtrace you will see foo, but you are running in bar.

Note that tail calls can be indirect, so they cannot be resolved
statically.

CONFIG_DEBUG_INFO usually disables tail calls, but not supporting
it would seem like a large limitation, as the cost can be high.

It wouldn't surprise me if there are some similar special cases that
can even happen with them disabled.

In theory you could read LBRs, but even that may miss some extreme
cases.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/