[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW51E4epDCrdNcQCG+SzHiyGhE+AocjmXoD-G0JExs9N1A@mail.gmail.com>
Date: Thu, 6 Feb 2025 10:00:51 -0800
From: Song Liu <song@...nel.org>
To: Yafang Shao <laoar.shao@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Miroslav Benes <mbenes@...e.cz>, Petr Mladek <pmladek@...e.com>,
jpoimboe@...nel.org, jikos@...nel.org, joe.lawrence@...hat.com,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 0/2] livepatch: Add support for hybrid mode
On Wed, Feb 5, 2025 at 6:55 PM Yafang Shao <laoar.shao@...il.com> wrote:
[...]
> > 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.
Thanks,
Song
> >
> > > We could either add functions annotated as "__noreturn" to the deny
> > > list for fexit as follows, or we could explore a more generic
> > > solution, such as embedding the "noreturn" information into the BTF
> > > and extracting it when attaching fexit.
> >
> > I personally don't think this is really necessary. It is good to have.
> > But a reasonable user should not expect noreturn function to
> > generate fexit events.
Powered by blists - more mailing lists