[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQJZCE-Rh4xghLrruY8DW00cRUq9-ct6d=qfKk8Yc+8=pQ@mail.gmail.com>
Date: Sat, 8 Feb 2025 07:47:12 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Yafang Shao <laoar.shao@...il.com>
Cc: Song Liu <song@...nel.org>, bpf <bpf@...r.kernel.org>,
Miroslav Benes <mbenes@...e.cz>, Petr Mladek <pmladek@...e.com>, Josh Poimboeuf <jpoimboe@...nel.org>,
Jiri Kosina <jikos@...nel.org>, Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 0/2] livepatch: Add support for hybrid mode
On Fri, Feb 7, 2025 at 10:42 PM Yafang Shao <laoar.shao@...il.com> wrote:
>
> On Fri, Feb 7, 2025 at 2:01 AM Song Liu <song@...nel.org> wrote:
> >
> > 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.
>
> 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.
Pls avoid copy paste if possible.
Something like:
BTF_SET_START(fexit_deny)
#define NORETURN(fn) BTF_ID(func, fn)
#include "../../tools/objtool/noreturns.h"
Should work?
Josh,
maybe we should move noreturns.h to some common location?
Powered by blists - more mailing lists