All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@google.com>
To: Yonghong Song <yhs@fb.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org
Subject: Re: [PATCH bpf-next v7 01/11] bpf: add bpf_func_t and trampoline helpers
Date: Fri, 20 May 2022 17:03:25 -0700	[thread overview]
Message-ID: <CAKH8qBsntN_T1DFsCzg6ZRaae-AwTxgvUW5diY-cwZ4qGNcWCw@mail.gmail.com> (raw)
In-Reply-To: <787b0ed8-00f7-3a94-85a8-0cc301b11470@fb.com>

On Thu, May 19, 2022 at 5:45 PM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 5/18/22 3:55 PM, Stanislav Fomichev wrote:
> > I'll be adding lsm cgroup specific helpers that grab
> > trampoline mutex.
> >
> > No functional changes.
> >
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > ---
> >   include/linux/bpf.h     | 11 ++++----
> >   kernel/bpf/trampoline.c | 62 ++++++++++++++++++++++-------------------
> >   2 files changed, 38 insertions(+), 35 deletions(-)
> >
> [...]
> > +
> > +int bpf_trampoline_link_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr)
> > +{
> > +     int err;
> > +
> > +     mutex_lock(&tr->mutex);
> > +     err = __bpf_trampoline_link_prog(link, tr);
> >       mutex_unlock(&tr->mutex);
> >       return err;
> >   }
> >
> >   /* bpf_trampoline_unlink_prog() should never fail. */
>
> The comment here can be removed.

Will do, thank you!


> > -int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr)
> > +static int __bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr)
> >   {
> >       enum bpf_tramp_prog_type kind;
> >       int err;
> >
> >       kind = bpf_attach_type_to_tramp(link->link.prog);
> > -     mutex_lock(&tr->mutex);
> >       if (kind == BPF_TRAMP_REPLACE) {
> >               WARN_ON_ONCE(!tr->extension_prog);
> >               err = bpf_arch_text_poke(tr->func.addr, BPF_MOD_JUMP,
> >                                        tr->extension_prog->bpf_func, NULL);
> >               tr->extension_prog = NULL;
> > -             goto out;
> > +             return err;
> >       }
> >       hlist_del_init(&link->tramp_hlist);
> >       tr->progs_cnt[kind]--;
> > -     err = bpf_trampoline_update(tr);
> > -out:
> > +     return bpf_trampoline_update(tr);
> > +}
> > +
> > +/* bpf_trampoline_unlink_prog() should never fail. */
> > +int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr)
> > +{
> > +     int err;
> > +
> > +     mutex_lock(&tr->mutex);
> > +     err = __bpf_trampoline_unlink_prog(link, tr);
> >       mutex_unlock(&tr->mutex);
> >       return err;
> >   }

  reply	other threads:[~2022-05-21  0:03 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 22:55 [PATCH bpf-next v7 00/11] bpf: cgroup_sock lsm flavor Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 01/11] bpf: add bpf_func_t and trampoline helpers Stanislav Fomichev
2022-05-20  0:45   ` Yonghong Song
2022-05-21  0:03     ` Stanislav Fomichev [this message]
2022-05-18 22:55 ` [PATCH bpf-next v7 02/11] bpf: convert cgroup_bpf.progs to hlist Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 03/11] bpf: per-cgroup lsm flavor Stanislav Fomichev
2022-05-20  1:00   ` Yonghong Song
2022-05-21  0:03     ` Stanislav Fomichev
2022-05-23 15:41       ` Yonghong Song
2022-05-21  0:53   ` Martin KaFai Lau
2022-05-24  2:15     ` Stanislav Fomichev
2022-05-24  5:40       ` Martin KaFai Lau
2022-05-24 15:56         ` Stanislav Fomichev
2022-05-24  5:57       ` Martin KaFai Lau
2022-05-18 22:55 ` [PATCH bpf-next v7 04/11] bpf: minimize number of allocated lsm slots per program Stanislav Fomichev
2022-05-21  6:56   ` Martin KaFai Lau
2022-05-24  2:14     ` Stanislav Fomichev
2022-05-24  5:53       ` Martin KaFai Lau
2022-05-18 22:55 ` [PATCH bpf-next v7 05/11] bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP Stanislav Fomichev
2022-05-19  2:31   ` kernel test robot
2022-05-19 14:57   ` kernel test robot
2022-05-23 23:23   ` Andrii Nakryiko
2022-05-24  2:15     ` Stanislav Fomichev
2022-05-24  3:48   ` Martin KaFai Lau
2022-05-24 15:55     ` Stanislav Fomichev
2022-05-24 17:50       ` Martin KaFai Lau
2022-05-24 23:45         ` Andrii Nakryiko
2022-05-25  4:03           ` Stanislav Fomichev
2022-05-25  4:39             ` Andrii Nakryiko
2022-05-25 16:01               ` Stanislav Fomichev
2022-05-25 17:02                 ` Stanislav Fomichev
2022-05-25 20:39                   ` Martin KaFai Lau
2022-05-25 21:25                     ` sdf
2022-05-26  0:03                       ` Martin KaFai Lau
2022-05-26  1:23                         ` Martin KaFai Lau
2022-05-26  2:50                           ` Stanislav Fomichev
2022-05-31 23:08                             ` Andrii Nakryiko
2022-05-18 22:55 ` [PATCH bpf-next v7 06/11] bpf: allow writing to a subset of sock fields from lsm progtype Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 07/11] libbpf: implement bpf_prog_query_opts Stanislav Fomichev
2022-05-23 23:22   ` Andrii Nakryiko
2022-05-24  2:15     ` Stanislav Fomichev
2022-05-24  3:45       ` Andrii Nakryiko
2022-05-24  4:01         ` Martin KaFai Lau
2022-05-18 22:55 ` [PATCH bpf-next v7 08/11] libbpf: add lsm_cgoup_sock type Stanislav Fomichev
2022-05-23 23:26   ` Andrii Nakryiko
2022-05-24  2:15     ` Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 09/11] bpftool: implement cgroup tree for BPF_LSM_CGROUP Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 10/11] selftests/bpf: lsm_cgroup functional test Stanislav Fomichev
2022-05-18 22:55 ` [PATCH bpf-next v7 11/11] selftests/bpf: verify lsm_cgroup struct sock access Stanislav Fomichev
2022-05-23 23:33   ` Andrii Nakryiko
2022-05-24  2:15     ` Stanislav Fomichev
2022-05-24  3:46       ` Andrii Nakryiko
2022-05-19 23:34 ` [PATCH bpf-next v7 00/11] bpf: cgroup_sock lsm flavor Yonghong Song
2022-05-19 23:39   ` Stanislav Fomichev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKH8qBsntN_T1DFsCzg6ZRaae-AwTxgvUW5diY-cwZ4qGNcWCw@mail.gmail.com \
    --to=sdf@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.