From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65669C00140 for ; Mon, 8 Aug 2022 17:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236766AbiHHR6t (ORCPT ); Mon, 8 Aug 2022 13:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235853AbiHHR6s (ORCPT ); Mon, 8 Aug 2022 13:58:48 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10D46A448 for ; Mon, 8 Aug 2022 10:58:48 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id x10so9227176plb.3 for ; Mon, 08 Aug 2022 10:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=zj2XQsOgKZZnHB19kV8QSPhVGsC1xRdcFksQYVJJAqQ=; b=Vo13qczpWav996hYCXHzPxMM1g+UyIl6fegNqT4sWMp3msiCl+mFbD1iIgnHdRcwJo f1U7/Ch1wglriKegyZLCABplwH9VcngfsZeh7Q9YgP9KrYdcFhgW2g1khWpinFvXgEC5 X2KOWNIadK2Wb3WcqsZ6WVzKMponJIAr8Ml05CuG2vUXHhgpmkKruiBB5QcpzI/vjqPx 8Pzmaa+inhHvlCDkWvFHFPCHjn09MwMONH7jhXnHXG1WhMZrzhx9kKhpnTIZfPWowpvl Pfr8hsLxcDZHNZxoVU1/rOi6T91tNNVnb8iyBAzwh9IQJVOlx4RdzAkg6o5uTbx0s2Al o8fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=zj2XQsOgKZZnHB19kV8QSPhVGsC1xRdcFksQYVJJAqQ=; b=a0URDVLWO56xlSGzOb2/cvon+6zwUJbdtn+Qckq1gSJvGFyi9j3biX29FIejIWwFF7 OkvMw92LnVfBxeFX6BcdzFrRWtx9iuZfAm4qWEDhlfMf+IeXQ1qEHO0qk/KVHpohBUa8 VAB3DAF5NYe8QrKQJGMdJdaiYQXTFITJlfAE35GK9BRm3S0AVCOZYeeAk54DYmPgah72 FFSNEAh3DFS6r2mAUuftvjl66vgLxnueIQybeFS57pbp+1fUhhp4Un860xplnfq7ehx7 faQCRmrz00OybiUreIOb4rQsgICJLbzSgaGLICjpfuWBwSIuamp0nyrVizdLD1c/4MQW 7GOA== X-Gm-Message-State: ACgBeo1vZXxWr6t1gqVvhQ8+RbvU/SV9+tOJvPtxeZiqP3WJ5X71GSxt z1qaxpTDrr1Qu/HnozGhqqyeU+APuSaD0Xl0oll4Wg== X-Google-Smtp-Source: AA6agR6UD0upph0YRRy6meK/jXEyAoWTCjFo2SxI6GA0/8dshFfEyeNRIEfusbtQ/HFihyS2aMkwikAewOIkGPlh+ow= X-Received: by 2002:a17:902:70c7:b0:170:9030:2665 with SMTP id l7-20020a17090270c700b0017090302665mr10594378plt.73.1659981527409; Mon, 08 Aug 2022 10:58:47 -0700 (PDT) MIME-Version: 1.0 References: <20220808140626.422731-1-jolsa@kernel.org> <20220808140626.422731-2-jolsa@kernel.org> In-Reply-To: From: Stanislav Fomichev Date: Mon, 8 Aug 2022 10:58:36 -0700 Message-ID: Subject: Re: [RFC PATCH bpf-next 01/17] bpf: Link shimlink directly in trampoline To: Song Liu Cc: Jiri Olsa , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, Aug 8, 2022 at 10:40 AM Song Liu wrote: > > On Mon, Aug 8, 2022 at 7:06 AM Jiri Olsa wrote: > > > > We are going to get rid of struct bpf_tramp_link in following > > changes and cgroup_shim_find logic does not fit to that. > > > > We can store the link directly in the trampoline and omit the > > cgroup_shim_find searching logic. > > > > Signed-off-by: Jiri Olsa > > --- > > include/linux/bpf.h | 3 +++ > > kernel/bpf/trampoline.c | 23 +++-------------------- > > 2 files changed, 6 insertions(+), 20 deletions(-) > > > > diff --git a/include/linux/bpf.h b/include/linux/bpf.h > > index 20c26aed7896..ed2a921094bc 100644 > > --- a/include/linux/bpf.h > > +++ b/include/linux/bpf.h > > @@ -841,6 +841,8 @@ struct bpf_tramp_image { > > }; > > }; > > > > +struct bpf_shim_tramp_link; > > + > > struct bpf_trampoline { > > /* hlist for trampoline_table */ > > struct hlist_node hlist; > > @@ -868,6 +870,7 @@ struct bpf_trampoline { > > struct bpf_tramp_image *cur_image; > > u64 selector; > > struct module *mod; > > + struct bpf_shim_tramp_link *shim_link; > > }; > > Hi Stanislav, > > Is it possible to have multiple shim_link per bpf_trampoline? If so, I guess > this won't work. There is only one shim_link per bpf_trampoline. But I'm not sure storing the pointer is enough. We have to do 'shim_link=NULL' when the (final) shim is removed. (multiple lsm_cgroup progs can share the same shim)