Re: [RFC PATCH 0/2] livepatch: Add support for hybrid mode

From
Yafang Shao <hidden>
Date
2025-02-08 06:42:03
Also in
bpf, lkml
Reply to
Song Liu, 2025-02-06
On Fri, Feb 7, 2025 at 2:01 AM Song Liu [off-list ref] wrote:
On Wed, Feb 5, 2025 at 6:55 PM Yafang Shao [off-list ref] wrote:
[...]
quoted
quoted
I think we should first understand why the trampoline is not
freed.
IIUC, the fexit works as follows,

  bpf_trampoline
    + __bpf_tramp_enter
       + percpu_ref_get(&tr->pcref);

    + call do_exit()

    + __bpf_tramp_exit
       + percpu_ref_put(&tr->pcref);

Since do_exit() never returns, the refcnt of the trampoline image is
never decremented, preventing it from being freed.
Thanks for the explanation. In this case, I think it makes sense to
disallow attaching fexit programs on __noreturn functions. I am not
sure what is the best solution for it though.
There is a tools/objtool/noreturns.h. Perhaps we could create a
similar noreturns.h under kernel/bpf and add all relevant functions to
the fexit deny list.

--
Regards
Yafang
Thread (36 messages) 36 messages, 6 authors, last reply 2025-02-10
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help