Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp827333iob; Wed, 18 May 2022 14:01:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkp+TTuQGlhQOXZL0+bGfpVKrq4wePTgF77DNDydxV22uCoB3ykSS9lTWovPVmt890Aro8 X-Received: by 2002:a17:90b:48d1:b0:1df:4fc8:c2d7 with SMTP id li17-20020a17090b48d100b001df4fc8c2d7mr1340407pjb.45.1652907682897; Wed, 18 May 2022 14:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652907682; cv=none; d=google.com; s=arc-20160816; b=H9eWeUXFskOPuVzf656sju+Z2vgZboij79VFwNUwz3GXjWl4TNtGPXbf+jnZoeVpBv iuL+XVCCxdzMrGJ2jy6E/QJgYPMrB5+pSW4a6WDLmYvQEmV3ooJYYL5JgWaRK8nSAcIB k51WBKLV+lCkgwSi3HNi64B01/ZnMJxCr+Q1bOtVoTrhKS4W8j5BgmYUtgp+AW2mjnfl 3HSWB47ZX19tieF++n6IeEQcvfvV4Rj+RJ3TkaWTsStZaBboYWIyDbO4v5Dd1U95p5Oy YDxQLLFwAGQOORLZCJYEEjkeFZHbU3No01T7Tp4i7DXkzePWPRlPqs+QMbDJv4Dk7IuJ 61kA== 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=tG6J7OXecG2aHQWxhTipqfUbGWLrMU/iiBvmaxNqXfU=; b=k/EfnUSRDeeOMEzUEr/wj4IBa1Q5yuyu/sLBdQnpf7YwEhpsRbX6ckxjnohW3Xw0GT NuR5DPZF0VJ1zxY9TaKwlCEUWDBgXjnig3MwSqCXESHB7+IytMeMD/OPjPmSHwHjRF+7 8P51zSNcIUT26gXGXdvSJAiuOVDLjKNPJZisTqrqrsx5noFtKMcg8uwOXLeKf58hCAVx AgfkIk6reNpR+fm0+es18d0oxwbkBpKa983PXOX18kydzyDdM925LRyQDt1o/rXemsrG umaKvNa5Ds/pByc7HgWC/zgBlXQ+oFK7gQ0aJT/DFTEBuQQQmgo2VO9AZ3/t9ClRUkjY KwkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YASQpL5q; 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 iz13-20020a170902ef8d00b0015eafbef962si3902906plb.31.2022.05.18.14.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 14:01:22 -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=YASQpL5q; 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 68748255097; Wed, 18 May 2022 13:59:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242888AbiERU7s (ORCPT + 99 others); Wed, 18 May 2022 16:59:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242803AbiERU7l (ORCPT ); Wed, 18 May 2022 16:59:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEAD3226897 for ; Wed, 18 May 2022 13:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652907578; 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=tG6J7OXecG2aHQWxhTipqfUbGWLrMU/iiBvmaxNqXfU=; b=YASQpL5qD04tX4LKgxQsno8DaWxSdFaxZ+D+kex3o2v/T6xWM05h5/e2l6hTfRe1Lh4IRi yPtuZpT0LT5VQ/7C0/gclgKBbIePxOutV+nkVQGDvuiA5kxvuA8y67OZZ72vaB3LzFdPVf md+dDdB1utmbj+FJMGnND9u1oxoEFik= 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-650-40hpmLLpPA-9qBBY7Stp_g-1; Wed, 18 May 2022 16:59:35 -0400 X-MC-Unique: 40hpmLLpPA-9qBBY7Stp_g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9A27101AA44; Wed, 18 May 2022 20:59:34 +0000 (UTC) Received: from plouf.redhat.com (unknown [10.39.192.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 633502166B25; Wed, 18 May 2022 20:59:31 +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 , Shuah Khan , Dave Marchevsky , Joe Stringer , Jonathan Corbet Cc: Tero Kristo , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Benjamin Tissoires Subject: [PATCH bpf-next v5 01/17] bpf/btf: also allow kfunc in tracing and syscall programs Date: Wed, 18 May 2022 22:59:08 +0200 Message-Id: <20220518205924.399291-2-benjamin.tissoires@redhat.com> In-Reply-To: <20220518205924.399291-1-benjamin.tissoires@redhat.com> References: <20220518205924.399291-1-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-2.3 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,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tracing and syscall BPF program types are very convenient to add BPF capabilities to subsystem otherwise not BPF capable. When we add kfuncs capabilities to those program types, we can add BPF features to subsystems without having to touch BPF core. Signed-off-by: Benjamin Tissoires --- changes in v5: - also add syscalls 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 2f0b0440131c..7bccaa4646e5 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -202,6 +202,8 @@ enum btf_kfunc_hook { BTF_KFUNC_HOOK_XDP, BTF_KFUNC_HOOK_TC, BTF_KFUNC_HOOK_STRUCT_OPS, + BTF_KFUNC_HOOK_TRACING, + BTF_KFUNC_HOOK_SYSCALL, BTF_KFUNC_HOOK_MAX, }; @@ -7110,6 +7112,10 @@ 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; + case BPF_PROG_TYPE_SYSCALL: + return BTF_KFUNC_HOOK_SYSCALL; default: return BTF_KFUNC_HOOK_MAX; } -- 2.36.1