Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp877337pxb; Fri, 22 Apr 2022 13:14:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf/S04K8nmsUDCXbaxwoPTfCeixkMWXllotMlZEc93ai/Kow68m7JornzAlEtw/4UnxJxF X-Received: by 2002:a63:6b43:0:b0:3aa:d07d:6009 with SMTP id g64-20020a636b43000000b003aad07d6009mr2964332pgc.359.1650658471160; Fri, 22 Apr 2022 13:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650658471; cv=none; d=google.com; s=arc-20160816; b=xvQKbdWDcw7WPUZnhOUE4uIDgAIuo84UwmqPZ598NA3V1s1NGVF7TUQBQDGSPGe0MQ OtLzPcZDDRFfRZ7V0h6gzfJhAsLjc5XiAu5r+NQP31Cxa4fPwX+Y7NYq++hITuZp2MK3 kjKchHQcI8PSeLSOJpHxkjoKCweIawzPQy1NH1OiHyZd+5K2N4dELDLJmTsxSOS37C9D xIhsu5HkUS0t1/2KcHqibkVeYVpIwml59zM3iA1OLIJMRORV7dXiQoxsL3VcPeuxp0sW V9SeX5MFBYBKPJ9sZgXKANZtSNHwNiUdr2kTzlHDL/PT9oRVeVZn0PwR5c/czl5eKXWE gkhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mu71EcrM6CS//34lSShcmIEpi6ln3dKHHiAx5OAiSvg=; b=Hof29CXIl6eHftDg2i0zxlWkWL2vIDNSU9oI2ZPGbc5s5qO7FdV/uNmZWlBqoHGPZi Vl9/SrICJmqsqjcf+81YVZGu5CWVp49aqyKn7IzGaIPypcNcoLFr8mtcp5Yiz6mHo7Gn IqsKy9Uub2t9b/geJBPhJEtAPlNhCb3jRLHJN1+jo+eygugVhAuaxb0fPrxrUeHLMEZV mI8fYkAeZp6hGHN3FOdkLEx2oByhCUc18Vr26pGpBBsMO0oImBMRIVkI+7eDC0Rxln9m VHHNLAnY/wljUgCGg/Wj6ZfgkRD+0VVBZOZkLUw6Csy91u4Amabo4/NThf9W+s4oQgh4 iZsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XRG8eAJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d8-20020a170903230800b001587bf7d603si8956177plh.103.2022.04.22.13.14.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XRG8eAJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3CC7924C137; Fri, 22 Apr 2022 12:15:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388916AbiDUOKr (ORCPT + 99 others); Thu, 21 Apr 2022 10:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388847AbiDUOKp (ORCPT ); Thu, 21 Apr 2022 10:10:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 75DEA1A9 for ; Thu, 21 Apr 2022 07:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650550073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mu71EcrM6CS//34lSShcmIEpi6ln3dKHHiAx5OAiSvg=; b=XRG8eAJZ7eYW/fZxS8WS06fLrPeTUrO7Wa95VAyJFN9aa40JrGNnTYjgA/EDFkzO7HE2PB L7NxPQExcY6GtxQvIdXBHl5lcPNGKln1QGZTFsxoiime4eoyo6VaOD6U1N1ZPJl41LaJS8 oYSja5EzVjLnpWlwrfUxfdrZbI0JXK8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-mfu0MqcAOoaEIsbQDeRINw-1; Thu, 21 Apr 2022 10:07:48 -0400 X-MC-Unique: mfu0MqcAOoaEIsbQDeRINw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1786985A5BE; Thu, 21 Apr 2022 14:07:48 +0000 (UTC) Received: from plouf.redhat.com (unknown [10.39.194.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id 013EF40EC002; Thu, 21 Apr 2022 14:07:45 +0000 (UTC) From: Benjamin Tissoires To: Greg KH , Jiri Kosina , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Cc: Tero Kristo , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, bpf@vger.kernel.org, Benjamin Tissoires Subject: [RFC bpf-next v4 1/7] bpf/btf: also allow kfunc in tracing programs Date: Thu, 21 Apr 2022 16:07:34 +0200 Message-Id: <20220421140740.459558-2-benjamin.tissoires@redhat.com> In-Reply-To: <20220421140740.459558-1-benjamin.tissoires@redhat.com> References: <20220421140740.459558-1-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org using fentry/fexit and fmod_ret is very convenient to access module BPF capabilities, so be able to define kfuncs there is a must. Signed-off-by: Benjamin Tissoires --- new in v4: - I think this is where I need to add my new kfuncs, though in the end I need to be able to change the incoming data, so maybe only fmod_ret is the one we need to be able to be RW. --- kernel/bpf/btf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 0493310d981f..76318a4c2d0e 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -202,6 +202,7 @@ enum btf_kfunc_hook { BTF_KFUNC_HOOK_XDP, BTF_KFUNC_HOOK_TC, BTF_KFUNC_HOOK_STRUCT_OPS, + BTF_KFUNC_HOOK_TRACING, BTF_KFUNC_HOOK_MAX, }; @@ -6892,6 +6893,8 @@ static int bpf_prog_type_to_kfunc_hook(enum bpf_prog_type prog_type) return BTF_KFUNC_HOOK_TC; case BPF_PROG_TYPE_STRUCT_OPS: return BTF_KFUNC_HOOK_STRUCT_OPS; + case BPF_PROG_TYPE_TRACING: + return BTF_KFUNC_HOOK_TRACING; default: return BTF_KFUNC_HOOK_MAX; } -- 2.35.1