Hi,
On 01.10.2020 15:43, Nicolai Stange wrote:
Miroslav Benes <mbenes@xxxxxxx> writes:
On Wed, 30 Sep 2020, Evgenii Shatokhin wrote:
Is that so? Are there any workarounds?
Petr, do you remember the crazy workarounds we talked about? My head is
empty now. And I am sure, Nicolai could come up with something.
There might be some clever tricks ycou could play, but that depends on
the diff you want to turn into a livepatch. For example, sometimes it's
possible to livepatch a callee and make it trick the unpatchable caller
into the desired behaviour.
In this particular case, we needed to add a kind of lock/unlock pair
around the request processing part of the function. Unfortunately, there
is no suitable callee there.
However, in your case it might be easier to simply kill the running
kthread and start it again, e.g. from a ->post_patch() callback. Note
that KLP's callbacks are a bit subtle though, at a minimum you'd
probably also want to implement ->pre_unpatch() to roll everything back
and perhaps also disable (->replace) downgrades by means of the klp_state API.
Interesting.
Something like: block submitting of new requests to the thread, wait for
the old requests to be processed, kill the thread, then start it again,
unblock the requests.
Thanks for the idea!
You can find some good docs on callbacks and klp_state at
Documentation/livepatch/.
Thanks,
Nicolai
Evgenii