Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp443819imm; Wed, 3 Oct 2018 19:59:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Z6wa+w/eW26GDCDi/5ER78adHjhy6nLDzYbn4AfEI1OB1CxAxseAuyZqueR+G/qAzOsMf X-Received: by 2002:a62:c60a:: with SMTP id m10-v6mr3725933pfg.15.1538621978858; Wed, 03 Oct 2018 19:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538621978; cv=none; d=google.com; s=arc-20160816; b=XCYdo19ytSNAjpXZpQDt7D0tqi4P8i9ohQ9cYO3FGmF18Bn1asGoo043naWtimBn1C vvbJjl1xlN+O0vYpLpYk+ZNBg8iPKlFJZWut+JaU246CytvPT1OQ/luI0E5YhxhCPAMa +rzyUb9utyNgz1csBAaG2hJ25FU1v0JqPX/KGhD9ATCOnXiCaB6l5swbXRMInz5R/zzJ 85fR/9Rrg2dOg0q2ydV286FY+kruCyh6p4qTCsrH/FZO5j1loiUFIRfzG7MtoXspsBjT DpBer0lJqoYaWFoEHtDlIEbWDLXF1xg2iNF3W/QeLZPlM+0YBCYsxvfBVB07yKRxcHmR 5n7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:smtp-origin-cluster:cc:to :smtp-origin-hostname:from:smtp-origin-hostprefix; bh=VVXclB0sBs/fCngM6R00VLPTXBiGe41C39HXzl43bR4=; b=PZBqkWqZPxFL5411T+Cu37nNpbQqcv88y2nzaQXEbJPPSjTG2lTqMh3zy5pIJEZOdE XK3b+3P7fZB9nN0/K+vhbkBkudI4lHDRI/84Q+DZqMoNeU3VfV9yStJOO2TN+G6LEbKj PC5ZpxpUG/9lFP4XEZ9IFeTZ1k9zbm8AL8+pGTZoiEZJfKzgeu1WqnD6KqsjIlnRh71P 5cJXVhUZr8t/0RXu8r+jFAw9C/C1n/1s48/AwdgOf/7TImS4rn7eRoc2ZlhCGestuLTK sWbTeatPS4NlwuoHtjPJjCghE4G3Nx0ttHtDoJ36RZ6FhSA6KOY6NJdO2lhi3AkZIglw pgLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g69-v6si3633416pfc.284.2018.10.03.19.59.24; Wed, 03 Oct 2018 19:59:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727524AbeJDJtK (ORCPT + 99 others); Thu, 4 Oct 2018 05:49:10 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42126 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727471AbeJDJtJ (ORCPT ); Thu, 4 Oct 2018 05:49:09 -0400 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w942vxZL008539 for ; Wed, 3 Oct 2018 19:57:59 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2mw8fs89dn-3 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 03 Oct 2018 19:57:59 -0700 Received: from mx-out.facebook.com (192.168.52.123) by mail.thefacebook.com (192.168.16.11) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 3 Oct 2018 19:57:55 -0700 Received: by devbig007.ftw2.facebook.com (Postfix, from userid 572438) id 2CA0E760B5E; Wed, 3 Oct 2018 19:57:51 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Alexei Starovoitov Smtp-Origin-Hostname: devbig007.ftw2.facebook.com To: "David S . Miller" CC: , , , , , Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH bpf-next 5/6] libbpf: support BPF_CGROUP_FILE_OPEN in libbpf Date: Wed, 3 Oct 2018 19:57:49 -0700 Message-ID: <20181004025750.498303-6-ast@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181004025750.498303-1-ast@kernel.org> References: <20181004025750.498303-1-ast@kernel.org> X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-04_01:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org add support for BPF_CGROUP_FILE_OPEN in libbpf Signed-off-by: Alexei Starovoitov --- tools/lib/bpf/libbpf.c | 3 +++ tools/testing/selftests/bpf/bpf_helpers.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 9e68fd9fcfca..ceb06d4cb20a 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1503,6 +1503,7 @@ static bool bpf_prog_type__needs_kver(enum bpf_prog_type type) case BPF_PROG_TYPE_LIRC_MODE2: case BPF_PROG_TYPE_SK_REUSEPORT: case BPF_PROG_TYPE_FLOW_DISSECTOR: + case BPF_PROG_TYPE_FILE_FILTER: return false; case BPF_PROG_TYPE_UNSPEC: case BPF_PROG_TYPE_KPROBE: @@ -2162,6 +2163,8 @@ static const struct { BPF_CGROUP_UDP4_SENDMSG), BPF_EAPROG_SEC("cgroup/sendmsg6", BPF_PROG_TYPE_CGROUP_SOCK_ADDR, BPF_CGROUP_UDP6_SENDMSG), + BPF_APROG_SEC("cgroup/file_open", BPF_PROG_TYPE_FILE_FILTER, + BPF_CGROUP_FILE_OPEN), }; #undef BPF_PROG_SEC_IMPL diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h index 1d407b3494f9..2d5b1a2652e2 100644 --- a/tools/testing/selftests/bpf/bpf_helpers.h +++ b/tools/testing/selftests/bpf/bpf_helpers.h @@ -155,6 +155,8 @@ static struct bpf_sock *(*bpf_sk_lookup_udp)(void *ctx, (void *) BPF_FUNC_sk_lookup_udp; static int (*bpf_sk_release)(struct bpf_sock *sk) = (void *) BPF_FUNC_sk_release; +static int (*bpf_get_file_path)(struct bpf_file_info *file, void *buf, int size) = + (void *) BPF_FUNC_get_file_path; /* llvm builtin functions that eBPF C program may use to * emit BPF_LD_ABS and BPF_LD_IND instructions -- 2.17.1