On Thu, Jun 07, 2018 at 04:30:29PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jun 07, 2018 at 12:05:10PM -0700, Martin KaFai Lau escreveu:
> > On Thu, Jun 07, 2018 at 11:03:37AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Thu, Jun 07, 2018 at 10:54:01AM -0300, Arnald
On Thu, Jun 07, 2018 at 11:03:37AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jun 07, 2018 at 10:54:01AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Jun 05, 2018 at 02:25:48PM -0700, Martin KaFai Lau escreveu:
> > > [ btw, the latest commit (1 commit) shou
On Sat, May 05, 2018 at 03:58:25PM +0300, Julian Anastasov wrote:
> So, except the RTF_LOCAL check in __ip6_rt_update_pmtu
> we should have no other issues.
Hi Julian,
Do you have a chance to work on the IPv6 side?
Thanks,
Martin
On Thu, Apr 19, 2018 at 04:40:34PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 18, 2018 at 03:55:56PM -0700, Martin KaFai Lau escreveu:
> > This patch introduces BPF Type Format (BTF).
> >
> > BTF (BPF Type Format) is the meta data format which describes
> > th
The t->type in BTF_KIND_FWD is not used. It must be 0.
This patch ensures that and also adds a test case in test_btf.c
Signed-off-by: Martin KaFai Lau
---
kernel/bpf/btf.c | 21 -
tools/testing/selftests/bpf/test_btf.c | 22 ++
This patch ensures array's t->size is 0.
The array size is decided by its individual elem's size and the
number of elements. Hence, t->size is not used and
it must be 0.
A test case is added to test_btf.c
Signed-off-by: Martin KaFai Lau
---
kernel/bpf/btf.c
On Fri, May 25, 2018 at 10:23:13AM -0700, Andrey Ignatov wrote:
> install_headers target should contain all headers that are part of
> libbpf. Add missing btf.h
>
> Signed-off-by: Andrey Ignatov <r...@fb.com>
Acked-by: Martin KaFai Lau <ka...@fb.com>
ion to query kernel.
>
> Signed-off-by: Yonghong Song <y...@fb.com>
Acked-by: Martin KaFai Lau <ka...@fb.com>
ce to assume that ubuf can be directly used with
strlen()/printf()... as long as the syscall does not return -1/ENOSPC.
I think the comment change could be done in a follow up patch.
or
always null terminate ubuf as long as input_len > 0
and the output_buf_len should be strlen(buf) instead of
st
Sparse warning:
kernel/bpf/btf.c:1985:34: warning: Variable length array is used.
This patch directly uses ARRAY_SIZE().
Fixes: f80442a4cd18 ("bpf: btf: Change how section is supported in btf_header")
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
kernel/bpf/btf.c | 11 +++
Sparse warning:
kernel/bpf/btf.c:1985:34: warning: Variable length array is used.
This patch moves the nr_secs from btf_check_sec_info() to a macro.
Fixes: f80442a4cd18 ("bpf: btf: Change how section is supported in btf_header")
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
ress is used to initiate a kprobe perf event.
>
> Signed-off-by: Yonghong Song <y...@fb.com>
Acked-by: Martin KaFai Lau <ka...@fb.com>
On Tue, May 22, 2018 at 09:30:46AM -0700, Yonghong Song wrote:
> Currently, suppose a userspace application has loaded a bpf program
> and attached it to a tracepoint/kprobe/uprobe, and a bpf
> introspection tool, e.g., bpftool, wants to show which bpf program
> is attached to which
gt; * `msg_src_ip6` to set source IPv6 for UDPv6.
>
> Signed-off-by: Andrey Ignatov <r...@fb.com>
> Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
On Wed, May 23, 2018 at 12:41:14PM +0200, Daniel Borkmann wrote:
> [ +Martin ]
>
> On 05/21/2018 08:59 AM, Sirio Balmelli wrote:
> > On arm32, 'cd tools/testing/selftests/bpf && make' fails with:
> >
> > libbpf.c:80:10: error: format ‘%ld’ expects argument of type ‘long int’,
> > but argument 4
gt; Summary: 26 PASSED, 0 FAILED
>
> Signed-off-by: Andrey Ignatov <r...@fb.com>
> Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
port .. [PASS]
> Summary: 16 PASSED, 0 FAILED
>
> (stderr contains errors from libbpf when testing load/attach with
> invalid arguments)
>
> Signed-off-by: Andrey Ignatov <r...@fb.com>
> Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
fb.com>
> Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
On Fri, May 18, 2018 at 07:21:10PM -0700, Andrey Ignatov wrote:
> Sync new `BPF_CGROUP_UDP4_SENDMSG` and `BPF_CGROUP_UDP6_SENDMSG`
> attach types to tools/.
>
> Signed-off-by: Andrey Ignatov <r...@fb.com>
> Acked-by: Alexei Starovoitov <a...@kernel.org>
Acked-by: Martin KaFai Lau <ka...@fb.com>
ot;n"
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
tools/lib/bpf/bpf.c| 4 +-
tools/lib/bpf/bpf.h| 4 +-
tools/lib/bpf/btf.c| 5 +-
tools/lib/bpf/libbpf.c | 34 +--
tools/lib/bpf/libbpf.h
This patch exposes check_uarg_tail_zero() which will
be reused by a later BTF patch. Its name is changed to
bpf_check_uarg_tail_zero().
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Yonghong Song <y...@fb.com>
---
include/linux/bpf.h | 2 ++
kernel/bpf/sy
Instead of ingoring the array->index_type field. Enforce that
it must be a BTF_KIND_INT in size 1/2/4/8 bytes.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
kernel/bpf/btf.c | 80 +++-
1 file changed, 56 insertions(+), 24
This patch sync the uapi bpf.h and btf.h to tools.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Yonghong Song <y...@fb.com>
---
tools/include/uapi/linux/bpf.h | 8
tools/include/uapi/linux/btf.h | 37 +++--
2 files changed, 1
further limit BTF_INT_ENCODING
from 8 bits to 4 bits in patch 4
- Adjustments in test_btf.c to reflect changes in v2
Martin KaFai Lau (7):
bpf: Expose check_uarg_tail_zero()
bpf: btf: Change how section is supported in btf_header
bpf: btf: Check array->index_type
bpf: btf: Remove unuse
.
This patch also removes an unnecessary !err check
at the end of btf_parse().
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
include/uapi/linux/btf.h | 8 +-
kernel/bpf/btf.c | 209 +++
2 files changed, 160 insertions(+), 57 deletions(-)
diff
uot; means the BTF type id within
that BTF object.
To make it clear, btf_key_id and btf_value_id are
renamed to btf_key_type_id and btf_value_type_id.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Yonghong Song <y...@fb.c
.
The BTF_INT_ENCODING is limited to 4 bits instead of 8 bits.
The above can be added back later because the verifier
ensures the unused bits are zeros.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Yonghong Song <y...@fb.com>
---
include/uapi/linux/btf.h | 29 +--
On Mon, May 21, 2018 at 02:04:51PM -0700, Yonghong Song wrote:
>
>
> On 5/18/18 5:16 PM, Martin KaFai Lau wrote:
> > Instead of ingoring the array->index_type field. Enforce that
> > it must be an unsigned BTF_KIND_INT.
> >
> > Signed-of
On Mon, May 21, 2018 at 09:41:11PM -0700, Yonghong Song wrote:
>
>
> On 5/18/18 5:16 PM, Martin KaFai Lau wrote:
> > Instead of ingoring the array->index_type field. Enforce that
> > it must be an unsigned BTF_KIND_INT.
> >
> > Signed-of
On Fri, May 18, 2018 at 07:21:09PM -0700, Andrey Ignatov wrote:
> In addition to already existing BPF hooks for sys_bind and sys_connect,
> the patch provides new hooks for sys_sendmsg.
>
> It leverages existing BPF program type `BPF_PROG_TYPE_CGROUP_SOCK_ADDR`
> that provides access to socket
On Mon, May 21, 2018 at 01:15:24PM -0700, Yonghong Song wrote:
>
>
> On 5/18/18 5:16 PM, Martin KaFai Lau wrote:
> > There are currently unused section descriptions in the btf_header. Those
> > sections are here to support future BTF use cases. For example, the
>
On Sun, May 20, 2018 at 02:08:57PM +0100, Mathieu Xhonneux wrote:
> In bpf_parse_prog, if bpf_prog_get_type fails, the function is
> immediately terminated without freeing the previously allocated
> prog->name.
> This patch adds a kfree before the return.
>
> Signed-off-by: Mathieu Xhonneux
This patch sync the uapi's bpf.h and btf.h to tools/.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
tools/include/uapi/linux/bpf.h | 8
tools/include/uapi/linux/btf.h | 28 +++-
2 files changed, 11 insertions(+), 25 deletions(-)
diff --git a/tools/i
Instead of ingoring the array->index_type field. Enforce that
it must be an unsigned BTF_KIND_INT.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
kernel/bpf/btf.c | 83
1 file changed, 59 insertions(+), 24 deletions(-)
d
ot;n"
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
tools/lib/bpf/bpf.c| 4 +-
tools/lib/bpf/bpf.h| 4 +-
tools/lib/bpf/btf.c| 5 +-
tools/lib/bpf/libbpf.c | 34 +--
tools/lib/bpf/libbpf.h
This patch exposes check_uarg_tail_zero() which will
be reused by a later BTF patch. Its name is changed to
bpf_check_uarg_tail_zero().
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
include/linux/bpf.h | 2 ++
kernel/bpf/syscall.c | 14 +++---
2 files changed, 9 insertions
uot; means the BTF type id within
that BTF object.
To make it clear, btf_key_id and btf_value_id are
renamed to btf_key_type_id and btf_value_type_id.
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
include/linux/bpf.h | 4 ++--
in
bits are zeros.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
include/uapi/linux/btf.h | 20 +---
kernel/bpf/btf.c | 34 +-
2 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/include/uapi/linux/btf.h b/include/uapi
This patch set makes some changes to cleanup the unused
bits in BTF uapi. It also makes the btf_header extensible.
Please see individual patches for details.
Martin KaFai Lau (7):
bpf: Expose check_uarg_tail_zero()
bpf: btf: Change how section is supported in btf_header
bpf: btf: Check
.
This patch also removes an unnecessary !err check
at the end of btf_parse().
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
include/uapi/linux/btf.h | 8 +-
kernel/bpf/btf.c | 207 +++
2 files changed, 158 insertions(+), 57 deletions(-)
diff
e latter is split into an extra pass to probe problematic offsets
> on the original program in order to fail early. With that in place
> and carefully tested I no longer hit the panic and the rewrites are
> rejected properly. The above example panic I've seen on bpf-next,
> though the issue itself is generic in that a guard against this issue
> in bpf seems more appropriate in this case.
>
> Signed-off-by: Daniel Borkmann <dan...@iogearbox.net>
Acked-by: Martin KaFai Lau <ka...@fb.com>
;invalid read offset in SK_MSG",
> + .insns = {
> + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1,
> + offsetof(struct sk_msg_md, family) + 1),
> + BPF_EXIT_INSN(),
> + },
> + .errstr = "",
same here.
> + .result = REJECT,
> + .prog_type = BPF_PROG_TYPE_SK_MSG,
> + },
> + {
> "direct packet read for SK_MSG",
> .insns = {
> BPF_LDX_MEM(BPF_DW, BPF_REG_2, BPF_REG_1,
>
Other than the above,
Acked-by: Martin KaFai Lau <ka...@fb.com>
|1
> net/core/filter.c| 114
> +-
It is indeed a lot of dup lines with sock_ops_convert_ctx_access()
as you mentioned in the cover.
Other than that, LGTM.
Acked-by: Martin KaFai Lau <kaf...@fb.com>
> 4 files changed, 121 insertions(+), 3 deletions(-)
g_inc_not_zero could
> dereference a NULL pointer.
>
> Fix this by using variable returned by READ_ONCE() that is checked
> for NULL.
>
> Fixes: 2f857d04601a ("bpf: sockmap, remove STRPARSER map_flags and add
> multi-map support")
> Reported-by: Daniel Borkm
t; Fixes: 2f857d04601a ("bpf: sockmap, remove STRPARSER map_flags and add
> multi-map support")
> Reported-by: Daniel Borkmann <dan...@iogearbox.net>
> Signed-off-by: John Fastabend <john.fastab...@gmail.com>
Acked-by: Martin KaFai Lau <ka...@fb.com>
On Mon, May 14, 2018 at 08:16:59PM -0700, Alexei Starovoitov wrote:
> On Fri, May 11, 2018 at 05:54:33PM -0700, Joe Stringer wrote:
> > On 11 May 2018 at 14:41, Martin KaFai Lau <ka...@fb.com> wrote:
> > > On Fri, May 11, 2018 at 02:08:01PM -0700, Joe Stringer wrote:
> &
On Fri, May 11, 2018 at 02:08:01PM -0700, Joe Stringer wrote:
> On 10 May 2018 at 22:00, Martin KaFai Lau <ka...@fb.com> wrote:
> > On Wed, May 09, 2018 at 02:07:05PM -0700, Joe Stringer wrote:
> >> This patch adds a new BPF helper function, sk_lookup() which allows BPF
&
On Wed, May 09, 2018 at 02:07:05PM -0700, Joe Stringer wrote:
> This patch adds a new BPF helper function, sk_lookup() which allows BPF
> programs to find out if there is a socket listening on this host, and
> returns a socket pointer which the BPF program can then access to
> determine, for
On Sat, May 05, 2018 at 03:58:25PM +0300, Julian Anastasov wrote:
>
> Hello,
>
> On Thu, 3 May 2018, Martin KaFai Lau wrote:
>
> > > - when exactly we start to use the new PMTU, eg. what happens
> > > in case socket caches the route, whether route is kille
en processing the BPF_BTF_GET_FD_BY_ID cmd,
refcount_inc_not_zero() is needed because the BTF object
could be already in the rcu dead row . btf_get() is
removed since its usage is currently limited to btf.c
alone. refcount_inc() is used directly instead.
Signed-off-by: Martin KaFai Lau <ka...@fb.com&g
310
[ 34.872285] ? bad_area_access_error+0x310/0x310
[ 34.872894] do_syscall_64+0x95/0x3f0
This patch uses refcount_set() instead.
Reported-by: Yonghong Song <y...@fb.com>
Tested-by: Yonghong Song <y...@fb.com>
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
kernel/bpf
This series introduces BTF ID which is exposed through
the new BPF_BTF_GET_FD_BY_ID cmd, new "struct bpf_btf_info"
and new members in the "struct bpf_map_info".
Please see individual patch for details.
Martin KaFai Lau (6):
bpf: btf: Avoid WARN_ON when CONFIG_REFCOU
This patch adds a CHECK() macro for condition checking
and error report purpose. Something similar to test_progs.c
It also counts the number of tests passed/skipped/failed and
print them at the end of the test run.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Staro
This patch sync the tools/include/uapi/linux/btf.h with
the newly introduced BTF ID support.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
tools/include/uapi/linux/bpf.h | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t
This patch adds test for BPF_BTF_GET_FD_BY_ID and the new
btf_id/btf_key_id/btf_value_id in the "struct bpf_map_info".
It also modifies the existing BPF_OBJ_GET_INFO_BY_FD test
to reflect the new "struct bpf_btf_info".
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Ac
ata itself is exposed through
the "btf" and "btf_size" members.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/uapi/linux/bpf.h | 6 ++
kernel/bpf/btf.c | 26 +-
kernel/bpf/sys
On Wed, May 02, 2018 at 10:30:32PM +0300, Julian Anastasov wrote:
>
> Hello,
>
> On Wed, 2 May 2018, Martin KaFai Lau wrote:
>
> > On Wed, May 02, 2018 at 09:38:43AM +0300, Julian Anastasov wrote:
> > >
> > > - initial traffic for port 21 does no
On Wed, May 02, 2018 at 09:38:43AM +0300, Julian Anastasov wrote:
>
> Hello,
>
> On Thu, 19 Apr 2018, Martin KaFai Lau wrote:
>
> > This patch is not a proper fix and mainly serves for discussion purpose.
> > It is based on net-next which I have be
On Fri, Apr 27, 2018 at 02:26:50PM -0700, Martin KaFai Lau wrote:
> On Fri, Apr 27, 2018 at 11:31:36PM +0300, Dan Carpenter wrote:
> > On Fri, Apr 27, 2018 at 10:21:17PM +0200, Daniel Borkmann wrote:
> > > On 04/27/2018 09:39 PM, Dan Carpenter wrote:
> > > > On F
On Fri, Apr 27, 2018 at 11:31:36PM +0300, Dan Carpenter wrote:
> On Fri, Apr 27, 2018 at 10:21:17PM +0200, Daniel Borkmann wrote:
> > On 04/27/2018 09:39 PM, Dan Carpenter wrote:
> > > On Fri, Apr 27, 2018 at 10:55:46AM -0700, Martin KaFai Lau wrote:
> > >> On Fri, Ap
On Fri, Apr 27, 2018 at 10:20:25AM -0700, Martin KaFai Lau wrote:
> On Fri, Apr 27, 2018 at 05:04:59PM +0300, Dan Carpenter wrote:
> > We know "err" is zero so we can remove these and pull the code in one
> > indent level.
> >
> > Signed-off-by: Dan Carpente
On Fri, Apr 27, 2018 at 05:04:59PM +0300, Dan Carpenter wrote:
> We know "err" is zero so we can remove these and pull the code in one
> indent level.
>
> Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
Thanks for the simplification!
Acked-by: Ma
On Fri, Apr 27, 2018 at 05:04:09PM +0300, Dan Carpenter wrote:
> Smatch complains that size can be uninitialized if btf_type_id_size()
> returns NULL. It seems reasonable enough to check for that.
>
> Signed-off-by: Dan Carpenter
> ---
> This goes to the BPF tree
On Wed, Apr 25, 2018 at 11:34:48AM -0700, David Ahern wrote:
> Provide a helper for doing a FIB and neighbor lookup in the kernel
> tables from an XDP program. The helper provides a fastpath for forwarding
> packets. If the packet is a local delivery or for any reason is not a
> simple lookup and
This patch cleans up btf.h in uapi:
1) Rename "name" to "name_off" to better reflect it is an offset to the
string section instead of a char array.
2) Remove unused value BTF_FLAGS_COMPR and BTF_MAGIC_SWAP
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-of
On Fri, Apr 20, 2018 at 11:43:59PM +0300, Julian Anastasov wrote:
>
> Hello,
>
> On Thu, 19 Apr 2018, Martin KaFai Lau wrote:
>
> > This patch is not a proper fix and mainly serves for discussion purpose.
> > It is based on net-next which I have be
On Fri, Apr 20, 2018 at 10:05:16AM +0200, Björn Töpel wrote:
> From: Björn Töpel
>
> Commit 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf") did not
> include stdbool.h, so GCC complained when building samples/bpf/.
>
> In file included from
ike this:
> ip -6 r show table local
local 2401:db00:1011:1f01:face:b00c:0:85 dev lo src
2401:db00:1011:10af:face:0:27:0 metric 1024 mtu 1460 advmss 1440 pref medium
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
---
net/netfilter/ipvs/ip_vs_xmit.c | 49 +++
On Thu, Apr 19, 2018 at 04:40:34PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 18, 2018 at 03:55:56PM -0700, Martin KaFai Lau escreveu:
> > This patch introduces BPF Type Format (BTF).
> >
> > BTF (BPF Type Format) is the meta data format which describes
> > th
0 on success, or a negative error in case of failure.
> + *
LGTM. Thanks!
Acked-by: Martin KaFai Lau <ka...@fb.com>
done after the needs_resolve member's type
is resolved. Hence, the above is done together in
btf_struct_resolve().
Each possible member's type (e.g. int, enum, modifier...) implements
the check_member() ops which will be called from btf_struct_resolve().
Signed-off-by: Martin KaFai Lau <ka...@
e done in the second pass. The second
verification pass will be implemented in the next patch.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/uapi/linux/btf.h | 130 +++
kernel/bpf/Makefile | 1 +
of an array). This info will be useful in checking the
struct's members in a later patch. They will also be useful in doing
pretty print later.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/linux/btf.h | 37 +++
kernel/bpf/bt
of the llvm repo for now.
BTF_PAHOLE: The modified pahole with BTF support:
https://github.com/iamkafai/pahole/tree/btf
To add a BTF section: "pahole -J bpf_prog.o"
LLVM_OBJCOPY: Any llvm-objcopy should do
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
cat /sys/fs/bpf/pinned_array_map:
0: {1,2}
1: {3,4}
2: {5,6}
...
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/linux/bpf.h | 20 +-
include/uapi/linux/bpf.h | 3 +
kernel/bpf/arraymap.c| 50 +
.
If it is, the userspace should realloc with the kernel-returned
info.info_len and call the BPF_OBJ_GET_INFO_BY_FD again.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/linux/btf.h | 5 +
kernel/bpf/btf.c | 17 -
kernel/bpf/sy
eep the rev xmas tree in btf.c
Martin KaFai Lau (10):
bpf: btf: Introduce BPF Type Format (BTF)
bpf: btf: Validate type reference
bpf: btf: Check members of struct/union
bpf: btf: Add pretty print capability for data with BTF type info
bpf: btf: Add BPF_BTF_LOAD command
bpf: btf:
This patch adds pretty print capability for data with BTF type info.
The current usage is to allow pretty print for a BPF map.
The next few patches will allow a read() on a pinned map with BTF
type info for its key and value.
This patch uses the seq_printf() infra.
Signed-off-by: Martin KaFai
This patch adds a BPF_BTF_LOAD command which
1) loads and verifies the BTF (implemented in earlier patches)
2) returns a BTF fd to userspace. In the next patch, the
BTF fd can be specified during BPF_MAP_CREATE.
It currently limits to CAP_SYS_ADMIN.
Signed-off-by: Martin KaFai Lau <
btf_key_id and btf_value_id of a map by
finding the BTF type with name "_key" and "_value".
If they cannot be found, it will continue without using the BTF.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
tools/lib/bpf/Build
This patch sync up the bpf.h and btf.h to tools/
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
tools/include/uapi/linux/bpf.h | 12
tools/include/uapi/linux/btf.h | 130 +
2 files
On Wed, Apr 18, 2018 at 10:22:10AM -0700, Jakub Kicinski wrote:
> On Tue, 17 Apr 2018 13:42:36 -0700, Martin KaFai Lau wrote:
> > This patch checks a few things of struct's members:
> >
> > 1) It has a valid size (e.g. a "const void" is invalid)
> > 2) A membe
On Wed, Apr 18, 2018 at 05:20:11PM +0200, Daniel Borkmann wrote:
> Hi Martin,
>
> first of all great work on the set! One issue that puzzled me
> while digesting it further below.
>
> On 04/17/2018 10:42 PM, Martin KaFai Lau wrote:
> > This patch adds pretty print suppo
is a sample output when reading a pinned arraymap
with the following map's value:
struct map_value {
int count_a;
int count_b;
};
cat /sys/fs/bpf/pinned_array_map:
0: {1,2}
1: {3,4}
2: {5,6}
...
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a.
of the llvm repo for now.
BTF_PAHOLE: The modified pahole with BTF support:
https://github.com/iamkafai/pahole/tree/btf
To add a BTF section: "pahole -J bpf_prog.o"
LLVM_OBJCOPY: Any llvm-objcopy should do
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
This patch adds a BPF_BTF_LOAD command which
1) loads and verifies the BTF (implemented in earlier patches)
2) returns a BTF fd to userspace. In the next patch, the
BTF fd can be specified during BPF_MAP_CREATE.
It currently limits to CAP_SYS_ADMIN.
Signed-off-by: Martin KaFai Lau <
.
If it is, the userspace should realloc with the kernel-returned
info.info_len and call the BPF_OBJ_GET_INFO_BY_FD again.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/linux/btf.h | 5 +
kernel/bpf/btf.c | 17 -
kernel/bpf/sy
of an array). This info will be useful in checking the
struct's members in a later patch. They will also be useful in doing
pretty print later.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/linux/btf.h | 37 +++
kernel/bpf/bt
done after the needs_resolve member's type
is resolved. Hence, the above is done together in
btf_struct_resolve().
Each possible member's type (e.g. int, enum, modifier...) implements
the check_member() ops which will be called from btf_struct_resolve().
Signed-off-by: Martin KaFai Lau <ka...@
This patch sync up the bpf.h and btf.h to tools/
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
tools/include/uapi/linux/bpf.h | 13
tools/include/uapi/linux/btf.h | 132 +
2 files
btf_key_id and btf_value_id of a map by
finding the BTF type with name "_key" and "_value".
If they cannot be found, it will continue without using the BTF.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
tools/lib/bpf/Build
rev xmas tree in btf.c
Martin KaFai Lau (10):
bpf: btf: Introduce BPF Type Format (BTF)
bpf: btf: Validate type reference
bpf: btf: Check members of struct/union
bpf: btf: Add pretty print capability for data with BTF type info
bpf: btf: Add BPF_BTF_LOAD command
bpf: btf:
e done in the second pass. The second
verification pass will be implemented in the next patch.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/uapi/linux/btf.h | 132 +++
kernel/bpf/Makefile | 1 +
This patch adds pretty print capability for data with BTF type info.
The current usage is to allow pretty print for a BPF map.
The next few patches will allow a read() on a pinned map with BTF
type info for its key and value.
This patch uses the seq_printf() infra.
Signed-off-by: Martin KaFai
On Mon, Apr 16, 2018 at 05:22:00PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Apr 16, 2018 at 12:33:17PM -0700, Martin KaFai Lau escreveu:
> > This patch introduces BPF Type Format (BTF).
> >
> > BTF (BPF Type Format) is the meta data format which describes
> > th
done after the needs_resolve member's type
is resolved. Hence, the above is done together in
btf_struct_resolve().
Each possible member's type (e.g. int, enum, modifier...) implements
the check_member() ops which will be called from btf_struct_resolve().
Signed-off-by: Martin KaFai Lau <ka...@
e done in the second pass. The second
verification pass will be implemented in the next patch.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/uapi/linux/btf.h | 132 +++
kernel/bpf/Makefile | 1 +
eta()
in patch 1
- Fix an incorrect goto target in map_create() during
the btf-error-path in patch 7
- re-org some local vars to keep the rev xmas tree in btf.c
Martin KaFai Lau (10):
bpf: btf: Introduce BPF Type Format (BTF)
bpf: btf: Validate type reference
bpf: btf: Check members of str
of an array). This info will be useful in checking the
struct's members in a later patch. They will also be useful in doing
pretty print later.
Signed-off-by: Martin KaFai Lau <ka...@fb.com>
Acked-by: Alexei Starovoitov <a...@fb.com>
---
include/linux/btf.h | 37 +++
kernel/bpf/bt
This patch adds a BPF_BTF_LOAD command which
1) loads and verifies the BTF (implemented in earlier patches)
2) returns a BTF fd to userspace. In the next patch, the
BTF fd can be specified during BPF_MAP_CREATE.
It currently limits to CAP_SYS_ADMIN.
Signed-off-by: Martin KaFai Lau <
101 - 200 of 724 matches
Mail list logo