Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp444488imm; Wed, 3 Oct 2018 20:00:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV61xkKcNfaDtMZLHI1GEGessTatKpHLnX0zc4+GlZeJKzxZMa1jI/MGk0tpLwcIRfAr6ZBO6 X-Received: by 2002:a17:902:710e:: with SMTP id a14-v6mr4513919pll.179.1538622033890; Wed, 03 Oct 2018 20:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538622033; cv=none; d=google.com; s=arc-20160816; b=MDA8nhZVTctuDZ76eJQuLTYUnnDKU9u7HCbZBbpNojC4pFGw0uJ/gqaxbxDItEJMGT bFLp/kJiNv/LTJmTBJ4JkE5fvlRyCIAULysbPBZUcL1fl0gDgmlm8g5bwYRd5m+sfaNy 8O+RyAGTbj6q7mdV++K7O1IddIE4GE1QvGM7gxb9694u7Fb/m/n9OYqXl2sbgzdhHJsP 3cAtUVHGeCumfwsHwB3Cm68xf7XTxPsAxTYslJAn1vwCUudmeJ+vhluysnOkGhYujMqV qKxjVb+COuv7VhsMghJnjntwJ/nZU1E+kLo3yZZG0GQDvkwmZh7jVF635txMN9WFjO2w c8Lw== 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=Ys3PSarkNXpUb8gOnKdJ62logwm3t/pjlaJz8ahyuR0=; b=lI8wnYMF7IXMioy4uz9Bt7mqjBZtJsu9lg+8hTATqoNmWdfnLV7C2Od1Wcwb1ryT1C rrgRFfivrO2yEEVz8agDkTZY9RKQ8ZdwDnkw8Np0nkj5MaSHqAa1YHd+oC2pc9ZsXMqG AF5G0X7xrOd2onduSXSdf/oOlAHaMIK2K2R58fNweY1adt9omOoyXVDO/OOQgzIbNwzl yJmeQZNvzsJhp0k9UHNAnUTleFRbrxXjMTxCRKif/UwaPnve9AY3rtU1yegEO4Jv43tC NZUUxaAEG1+BrXNxg9g4I1TqTi0c0djDeoBcA+xLRil6QSUDoPOCvJqSJZGgVOa8evho 1dqg== 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 t18-v6si3450955plo.191.2018.10.03.20.00.18; Wed, 03 Oct 2018 20:00:33 -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 S1727357AbeJDJtH (ORCPT + 99 others); Thu, 4 Oct 2018 05:49:07 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42118 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727312AbeJDJtG (ORCPT ); Thu, 4 Oct 2018 05:49:06 -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 w942vxZI008539 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-1 (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:54 -0700 Received: by devbig007.ftw2.facebook.com (Postfix, from userid 572438) id 16AAE760B52; 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 3/6] tools/bpf: sync uapi/bpf.h Date: Wed, 3 Oct 2018 19:57:47 -0700 Message-ID: <20181004025750.498303-4-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 sync uapi/bpf.h from kernel into tools Signed-off-by: Alexei Starovoitov --- tools/include/uapi/linux/bpf.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index f9187b41dff6..c0df8dd99edc 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -154,6 +154,7 @@ enum bpf_prog_type { BPF_PROG_TYPE_LIRC_MODE2, BPF_PROG_TYPE_SK_REUSEPORT, BPF_PROG_TYPE_FLOW_DISSECTOR, + BPF_PROG_TYPE_FILE_FILTER, }; enum bpf_attach_type { @@ -175,6 +176,7 @@ enum bpf_attach_type { BPF_CGROUP_UDP6_SENDMSG, BPF_LIRC_MODE2, BPF_FLOW_DISSECTOR, + BPF_CGROUP_FILE_OPEN, __MAX_BPF_ATTACH_TYPE }; @@ -2215,6 +2217,18 @@ union bpf_attr { * pointer that was returned from bpf_sk_lookup_xxx\ (). * Return * 0 on success, or a negative error in case of failure. + * + * int bpf_get_file_path(struct bpf_file_info *file, char *buf, u32 size_of_buf) + * Description + * Reconstruct the full path of *file* and store it into *buf* of + * *size_of_buf*. The *size_of_buf* must be strictly positive. + * On success, the helper makes sure that the *buf* is NUL-terminated. + * On failure, it is filled with string "(error)". + * This helper should only be used for debugging. + * 'char *path' should never be used for permission checks. + * Return + * 0 on success, or a negative error in case of failure. + * */ #define __BPF_FUNC_MAPPER(FN) \ FN(unspec), \ @@ -2303,7 +2317,8 @@ union bpf_attr { FN(skb_ancestor_cgroup_id), \ FN(sk_lookup_tcp), \ FN(sk_lookup_udp), \ - FN(sk_release), + FN(sk_release), \ + FN(get_file_path), /* integer value in 'imm' field of BPF_CALL instruction selects which helper * function eBPF program intends to call @@ -2896,4 +2911,15 @@ struct bpf_flow_keys { }; }; +struct bpf_file_info { + __u64 inode; + __u32 dev_major; + __u32 dev_minor; + __u32 fs_magic; + __u32 mnt_id; + __u32 nlink; + __u32 mode; /* file mode S_ISDIR, S_ISLNK, 0755, etc */ + __u32 flags; /* open flags O_RDWR, O_CREAT, etc */ +}; + #endif /* _UAPI__LINUX_BPF_H__ */ -- 2.17.1