.
Stanislav Fomichev (2):
selftests/bpf: rename flow dissector section to flow_dissector
bpftool: support loading flow dissector
.../bpftool/Documentation/bpftool-prog.rst| 16 ++-
tools/bpf/bpftool/common.c| 32 +++--
tools/bpf/bpftool/main.h | 1
Makes it compatible with the logic that derives program type
from section name in libbpf_prog_type_by_name.
Signed-off-by: Stanislav Fomichev
---
tools/testing/selftests/bpf/bpf_flow.c | 2 +-
tools/testing/selftests/bpf/test_flow_dissector.sh | 2 +-
2 files changed, 2 insertions
-by: Stanislav Fomichev
---
.../bpftool/Documentation/bpftool-prog.rst| 16 ++-
tools/bpf/bpftool/common.c| 32 +++--
tools/bpf/bpftool/main.h | 1 +
tools/bpf/bpftool/prog.c | 135 +++---
4 files changed, 141 insertions
On 11/07, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 11:35:52 -0800, Stanislav Fomichev wrote:
> > This commit adds support for loading/attaching/detaching flow
> > dissector program. The structure of the flow dissector program is
> > assumed to be the sam
/0
bpftool prog attach pinned /sys/fs/bpf/flow/flow_dissector/0 flow_dissector
Tested by using the above lines to load the prog in
the test_flow_dissector.sh selftest.
Signed-off-by: Stanislav Fomichev
---
.../bpftool/Documentation/bpftool-prog.rst| 26 +++--
tools/bpf/bpftool/bash
ails.
Stanislav Fomichev (3):
selftests/bpf: rename flow dissector section to flow_dissector
libbpf: cleanup after partial failure in bpf_object__pin
bpftool: support loading flow dissector
.../bpftool/Documentation/bpftool-prog.rst| 26 +++--
tools/bpf/bpftool/bash-completion/bpftool
bpftool will use bpf_object__pin in the next commit to pin all programs
and maps from the file; in case of a partial failure, we need to get
back to the clean state (undo previous program/map pins).
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 58
Makes it compatible with the logic that derives program type
from section name in libbpf_prog_type_by_name.
Signed-off-by: Stanislav Fomichev
---
tools/testing/selftests/bpf/bpf_flow.c | 2 +-
tools/testing/selftests/bpf/test_flow_dissector.sh | 2 +-
2 files changed, 2 insertions
On 11/07, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 15:13:33 -0800, Stanislav Fomichev wrote:
> > On 11/07, Jakub Kicinski wrote:
> > > On Wed, 7 Nov 2018 14:43:56 -0800, Stanislav Fomichev wrote:
> > > > bpftool map update pinned /sys/fs/bpf/flow/jmp_table
On 11/07, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 15:34:48 -0800, Stanislav Fomichev wrote:
> > On 11/07, Jakub Kicinski wrote:
> > > On Wed, 7 Nov 2018 15:13:33 -0800, Stanislav Fomichev wrote:
> > > > On 11/07, Jakub Kicinski wrote:
> > > > >
On 11/07, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 14:43:55 -0800, Stanislav Fomichev wrote:
> > bpftool will use bpf_object__pin in the next commit to pin all programs
> > and maps from the file; in case of a partial failure, we need to get
> > back to the clean state (
On 11/07, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 14:43:56 -0800, Stanislav Fomichev wrote:
> > bpftool map update pinned /sys/fs/bpf/flow/jmp_table \
> > key 0 0 0 0 \
> > value pinned /sys/fs/bpf/flow/IP/0
>
> Where is that /0 coming from ? Is th
On 11/07, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 14:15:06 -0800, Stanislav Fomichev wrote:
> > On 11/07, Quentin Monnet wrote:
> > > 2018-11-07 12:32 UTC-0800 ~ Jakub Kicinski
> > >
> > > > On Wed, 7 Nov 2018 20:08:53 +, Quentin Monnet wrote:
&g
On 11/07, Quentin Monnet wrote:
> Hi Stanislav,
>
> 2018-11-07 11:35 UTC-0800 ~ Stanislav Fomichev
> > This commit adds support for loading/attaching/detaching flow
> > dissector program. The structure of the flow dissector program is
> > assumed to be t
On 11/07, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 15:00:21 -0800, Stanislav Fomichev wrote:
> > > > +err_unpin_programs:
> > > > + bpf_object__for_each_program(prog, obj) {
> > > > + char buf[PATH_MAX];
> > > > +
On 11/07, Quentin Monnet wrote:
> 2018-11-07 12:32 UTC-0800 ~ Jakub Kicinski
> > On Wed, 7 Nov 2018 20:08:53 +, Quentin Monnet wrote:
> > > > + err = bpf_obj_pin(bpf_program__fd(prog), pinfile);
> > > > + if (err) {
> > > > + p_err("failed to
hich is now being
used to attach all flow dissector progs/maps
* third patch adds special case in bpf_program__pin for programs with
single instances (we don't create /0 pin anymore, just )
* forth patch adds actual support to the bpftool
See forth patch for the description/details.
Stani
prog attach pinned /sys/fs/bpf/flow/flow_dissector flow_dissector
Tested by using the above lines to load the prog in
the test_flow_dissector.sh selftest.
Signed-off-by: Stanislav Fomichev
---
.../bpftool/Documentation/bpftool-prog.rst| 36 --
tools/bpf/bpftool/bash-completion/bpftool
on the case
where '/0' is always created. However, I couldn't find any serious
usage of bpf_program__pin inside the kernel tree and I suppose there
should be none outside.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 10 ++
1 file changed, 10 insertions(+)
diff --git
bpftool will use bpf_object__pin in the next commit to pin all programs
and maps from the file; in case of a partial failure, we need to get
back to the clean state (undo previous program/map pins).
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 248
Makes it compatible with the logic that derives program type
from section name in libbpf_prog_type_by_name.
Signed-off-by: Stanislav Fomichev
---
tools/testing/selftests/bpf/bpf_flow.c | 2 +-
tools/testing/selftests/bpf/test_flow_dissector.sh | 2 +-
2 files changed, 2 insertions
On 11/08, Quentin Monnet wrote:
> 2018-11-08 10:01 UTC-0800 ~ Stanislav Fomichev
> > On 11/08, Quentin Monnet wrote:
> >> Hi Stanislav, thanks for the changes! More comments below.
> > Thank you for another round of review!
> >
> >> 2018-11
On 11/08, Quentin Monnet wrote:
> Hi Stanislav, thanks for the changes! More comments below.
Thank you for another round of review!
> 2018-11-07 21:39 UTC-0800 ~ Stanislav Fomichev
> > This commit adds support for loading/attaching/detaching flow
> > dissector program. The str
On 11/08, Jakub Kicinski wrote:
> On Wed, 7 Nov 2018 21:39:57 -0800, Stanislav Fomichev wrote:
> > This commit adds support for loading/attaching/detaching flow
> > dissector program. The structure of the flow dissector program is
> > assumed to be the sam
On 11/08, Jakub Kicinski wrote:
> On Thu, 8 Nov 2018 11:16:43 +, Quentin Monnet wrote:
> > > - bpf_program__set_ifindex(prog, ifindex);
> > > if (attr.prog_type == BPF_PROG_TYPE_UNSPEC) {
> > > + if (!prog) {
> > > + p_err("can not guess program type when
On 11/08, Jakub Kicinski wrote:
> On Thu, 8 Nov 2018 18:21:24 +, Quentin Monnet wrote:
> > >>> @@ -79,8 +82,11 @@ DESCRIPTION
> > >>> contain a dot character ('.'), which is reserved for
> > >>> future
> > >>> extensions of *bpffs*.
> > >>> -
From: Stanislav Fomichev
Makes it compatible with the logic that derives program type
from section name in libbpf_prog_type_by_name.
Signed-off-by: Stanislav Fomichev
---
tools/testing/selftests/bpf/bpf_flow.c | 2 +-
tools/testing/selftests/bpf/test_flow_dissector.sh | 2 +-
2
From: Stanislav Fomichev
pin_name is the same as section_name where '/' is replaced
by '_'. bpf_object__pin_programs is converted to use pin_name
to avoid the situation where section_name would require creating another
subdirectory for a pin (as, for example, when calling
From: Stanislav Fomichev
When bpf_program has only one instance, don't create a subdirectory with
per-instance pin files (/0). Instead, just create a single pin file
for that single instance. This simplifies object pinning by not creating
unnecessary subdirectories.
This can potentially break
From: Stanislav Fomichev
v4 changes:
* addressed another round of comments/style issues from Jakub Kicinski &
Quentin Monnet (thanks!)
* implemented bpf_object__pin_maps and bpf_object__pin_programs helpers and
used them in bpf_program__pin
* added new pin_name to bpf_progra
From: Stanislav Fomichev
This patch adds new *loadall* command which slightly differs from the
existing *load*. *load* command loads all programs from the obj file,
but pins only the first programs. *loadall* pins all programs from the
obj file under specified directory.
The intended usecase
From: Stanislav Fomichev
This new additional argument lets users pin all maps from the object at
specified path.
Signed-off-by: Stanislav Fomichev
---
.../bpftool/Documentation/bpftool-prog.rst| 4 +++-
tools/bpf/bpftool/bash-completion/bpftool | 3 ++-
tools/bpf/bpftool/prog.c
From: Stanislav Fomichev
bpftool will use bpf_object__pin in the next commits to pin all programs
and maps from the file; in case of a partial failure, we need to get
back to the clean state (undo previous program/map pins).
As part of a cleanup, I've added and exported separate routines to
pin
From: Stanislav Fomichev
This commit adds support for loading/attaching/detaching flow
dissector program. The structure of the flow dissector program is
assumed to be the same as in the selftests:
* flow_dissector section with the main entry point
* a bunch of tail call progs
* a jmp_table map
On 11/12, Martin Lau wrote:
> On Mon, Nov 12, 2018 at 02:10:11PM -0800, Stanislav Fomichev wrote:
> > On 11/12, Martin Lau wrote:
> > > On Fri, Nov 09, 2018 at 08:21:41AM -0800, Stanislav Fomichev wrote:
> > > [ ... ]
> > > > @@ -1918,23 +2160,20 @@ void *
On 11/13, Quentin Monnet wrote:
> 2018-11-12 14:02 UTC-0800 ~ Jakub Kicinski
> > On Mon, 12 Nov 2018 13:44:10 -0800, Stanislav Fomichev wrote:
> >> Make it possible to build bpftool without libbfd. libbfd and libopcodes are
> >> typically provided in dev/dbg packa
On 11/13, Quentin Monnet wrote:
> 2018-11-12 14:02 UTC-0800 ~ Jakub Kicinski
> > On Mon, 12 Nov 2018 13:44:10 -0800, Stanislav Fomichev wrote:
> >> Make it possible to build bpftool without libbfd. libbfd and libopcodes are
> >> typically provided in dev/dbg packa
On 11/09, Quentin Monnet wrote:
> 2018-11-08 16:22 UTC-0800 ~ Stanislav Fomichev
> > From: Stanislav Fomichev
> >
> > This patch adds new *loadall* command which slightly differs from the
> > existing *load*. *load* command loads all programs from the obj file,
On 11/08, Jakub Kicinski wrote:
> On Thu, 8 Nov 2018 16:22:08 -0800, Stanislav Fomichev wrote:
> > + for (map = bpf_map__prev(map, obj);
> > +map != NULL;
> > +map = bpf_map__prev(map, obj)) {
>
> nit pick: if you need to respin all these for
ad/loadall to let users pin
all maps of the obj file
* seventh patch adds actual flow_dissector support to the bpftool and
an example
Stanislav Fomichev (7):
selftests/bpf: rename flow dissector section to flow_dissector
libbpf: cleanup after partial failure in bpf_object__pin
libbpf:
(bpf_object__pin_maps) and progs (bpf_object__pin_programs)
of an object.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 324 ++---
tools/lib/bpf/libbpf.h | 18 +++
2 files changed, 319 insertions(+), 23 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools
0 0 0 \
value pinned /sys/fs/bpf/flow/VLAN
bpftool prog attach pinned /sys/fs/bpf/flow/flow_dissector flow_dissector
Tested by using the above lines to load the prog in
the test_flow_dissector.sh selftest.
Signed-off-by: Stanislav Fomichev
Acked-by: Jakub Kicinski
---
.../bpftool
This new additional argument lets users pin all maps from the object at
specified path.
Signed-off-by: Stanislav Fomichev
Acked-by: Jakub Kicinski
---
.../bpftool/Documentation/bpftool-prog.rst| 4 +++-
tools/bpf/bpftool/bash-completion/bpftool | 3 ++-
tools/bpf/bpftool/prog.c
want to load a bunch
of progs, pin them all and after that construct a jump table.
Signed-off-by: Stanislav Fomichev
Acked-by: Jakub Kicinski
---
.../bpftool/Documentation/bpftool-prog.rst| 14 ++--
tools/bpf/bpftool/bash-completion/bpftool | 4 +-
tools/bpf/bpftool/common.c
on the case
where '/0' is always created. However, I couldn't find any serious
usage of bpf_program__pin inside the kernel tree and I suppose there
should be none outside.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 10 ++
1 file changed, 10 insertions(+)
diff --git
Makes it compatible with the logic that derives program type
from section name in libbpf_prog_type_by_name.
Signed-off-by: Stanislav Fomichev
---
tools/testing/selftests/bpf/bpf_flow.c | 2 +-
tools/testing/selftests/bpf/test_flow_dissector.sh | 2 +-
2 files changed, 2 insertions
like "cgroup/connect6").
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 29 ++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 97ce9f214002..e827542ffa3a 100644
--- a/too
Make it possible to build bpftool without libbfd. This excludes support for
disassembling jit-ted code and prints an error if the user tries to use
these features.
Tested by:
cat > FEATURES_DUMP.bpftool <
---
tools/bpf/bpftool/Makefile | 13 +++--
tools/bpf/bpftool/jit_disasm.c | 7
Make it possible to build bpftool without libbfd. libbfd and libopcodes are
typically provided in dev/dbg packages (binutils-dev in debian) which we
usually don't have installed on the fleet machines and we'd like a way to have
bpftool version that works without installing any additional packages.
On 11/12, Martin Lau wrote:
> On Fri, Nov 09, 2018 at 08:21:41AM -0800, Stanislav Fomichev wrote:
> [ ... ]
> > @@ -1918,23 +2160,20 @@ void *bpf_object__priv(struct bpf_object *obj)
> > }
> >
> > static struct bpf_program *
> > -__bpf_program__next(struct
On 11/12, Jakub Kicinski wrote:
> On Mon, 12 Nov 2018 10:53:28 -0800, Stanislav Fomichev wrote:
> > Make it possible to build bpftool without libbfd. This excludes support for
> > disassembling jit-ted code and prints an error if the user tries to use
> > these feat
On 11/12, Jakub Kicinski wrote:
> On Mon, 12 Nov 2018 11:58:27 -0800, Stanislav Fomichev wrote:
> > On 11/12, Jakub Kicinski wrote:
> > > On Mon, 12 Nov 2018 10:53:28 -0800, Stanislav Fomichev wrote:
> > > > diff --git a/tools/bpf/bpftool/main.h b/tools/bp
On 11/16, Alexei Starovoitov wrote:
> On Fri, Nov 16, 2018 at 08:52:23PM -0800, Stanislav Fomichev wrote:
> > I actually wanted to follow up with a v2 when
> > https://lkml.org/lkml/2018/11/16/243 reaches bpf-next (I got an ack
> > already).
>
> it will go via pe
Use existing pkt_v4 and pkt_v6 to make sure flow_keys are what we want.
Also, add new bpf_flow_load routine (and flow_dissector_load.h header)
that loads bpf_flow.o program and does all required setup.
Signed-off-by: Stanislav Fomichev
---
tools/testing/selftests/bpf/Makefile | 3
, ...) to __skb_flow_bpf_dissect
* set test iterations to 10
Stanislav Fomichev (5):
net/flow_dissector: move bpf case into __skb_flow_bpf_dissect
bpf: add BPF_PROG_TEST_RUN support for flow dissector
selftests/bpf: use thoff instead of nhoff in BPF flow dissector
net/flow_dissector: correctly cap nhoff and thoff
We want to make sure that the following condition holds:
0 <= nhoff <= thoff <= skb->len
BPF program can set out-of-bounds nhoff and thoff, which is dangerous, see
recent commit d0c081b49137 ("flow_dissector: properly cap thoff field")'.
Signed-off-by: Stanislav F
much sense (this is relevant
in the context of the next patch, where I add simple selftest
and manually construct expected flow_keys).
Signed-off-by: Stanislav Fomichev
---
net/core/flow_dissector.c | 1 +
tools/testing/selftests/bpf/bpf_flow.c | 36 --
2 files
The input is packet data, the output is struct bpf_flow_key. This should
make it easy to test flow dissector programs without elaborate
setup.
Signed-off-by: Stanislav Fomichev
---
include/linux/bpf.h | 3 ++
net/bpf/test_run.c | 71 -
net/core
This way, we can reuse it for flow dissector in BPF_PROG_TEST_RUN.
No functional changes.
Signed-off-by: Stanislav Fomichev
---
include/linux/skbuff.h| 5 +++
net/core/flow_dissector.c | 85 +++
2 files changed, 56 insertions(+), 34 deletions(-)
diff
On 12/03, Stanislav Fomichev wrote:
> On 12/03, Song Liu wrote:
> > On Mon, Dec 3, 2018 at 11:00 AM Stanislav Fomichev wrote:
> > >
> > > The input is packet data, the output is struct bpf_flow_key. This should
> > > make it easy to test flow dissector pr
Use existing pkt_v4 and pkt_v6 to make sure flow_keys are what we want.
Also, add new bpf_flow_load routine (and flow_dissector_load.h header)
that loads bpf_flow.o program and does all required setup.
Signed-off-by: Stanislav Fomichev
---
tools/testing/selftests/bpf/Makefile | 3
This way, we can reuse it for flow dissector in BPF_PROG_TEST_RUN.
No functional changes.
Signed-off-by: Stanislav Fomichev
---
include/linux/skbuff.h| 5 +++
net/core/flow_dissector.c | 83 +++
2 files changed, 54 insertions(+), 34 deletions(-)
diff
test_progs.c test to do a simple flow
dissector run as well.
* first patch introduces new __skb_flow_bpf_dissect to simplify
sharing between __skb_flow_bpf_dissect and BPF_PROG_TEST_RUN
* second patch adds actual BPF_PROG_TEST_RUN support
* third patch adds example usage to the selftests
Stanislav
The input is packet data, the output is struct bpf_flow_key. This should
make it easy to test flow dissector programs without elaborate
setup.
Signed-off-by: Stanislav Fomichev
---
include/linux/bpf.h | 3 ++
net/bpf/test_run.c | 76 +
net/core
much sense.
Signed-off-by: Stanislav Fomichev
---
net/core/flow_dissector.c | 1 +
tools/testing/selftests/bpf/bpf_flow.c | 36 --
2 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index
We want to make sure that the following condition holds:
0 <= nhoff <= thoff <= skb->len
BPF program can set out-of-bounds nhoff and thoff, which is dangerous, see
recent commit d0c081b49137 ("flow_dissector: properly cap thoff field")'.
Signed-off-by: Stanislav F
Include "autoconf.h" header in the test_maps.c and selectively
disable test_sockmap if CONFIG_BPF_STREAM_PARSER is not specified
in the kernel config.
When building out of tree/without autoconf.h, fall back to 'enabled'.
Signed-off-by: Stanislav Fomichev
---
tools/testing/sel
I get a segfault without it, other fixups always do dereference, and
without dereference I don't understand how it can ever work.
Fixes: 7c85c448e7d74 ("selftests/bpf: test_verifier, check
bpf_map_lookup_elem access in bpf prog")
Signed-off-by: Stanislav Fomichev
---
tools/testing
On 12/04, Song Liu wrote:
> On Mon, Dec 3, 2018 at 8:01 PM Stanislav Fomichev wrote:
> >
> > We are returning thoff from the flow dissector, not the nhoff. Pass
> > thoff along with nhoff to the bpf program (initially thoff == nhoff)
> > and expect flow dissector am
On 12/04, Song Liu wrote:
> On Mon, Dec 3, 2018 at 8:01 PM Stanislav Fomichev wrote:
> >
> > We want to make sure that the following condition holds:
> > 0 <= nhoff <= thoff <= skb->len
> >
> > BPF program can set out-of-bounds nhoff and tho
On 12/04, Song Liu wrote:
> On Mon, Dec 3, 2018 at 3:08 PM Stanislav Fomichev wrote:
> >
> > On 12/03, Song Liu wrote:
> > > On Mon, Dec 3, 2018 at 11:00 AM Stanislav Fomichev
> > > wrote:
> > > >
> > > > The input is packet data, th
On 12/03, Song Liu wrote:
> On Mon, Dec 3, 2018 at 11:00 AM Stanislav Fomichev wrote:
> >
> > The input is packet data, the output is struct bpf_flow_key. This should
> > make it easy to test flow dissector programs without elaborate
> > setup.
> >
>
On 12/05, Song Liu wrote:
> On Mon, Dec 3, 2018 at 8:01 PM Stanislav Fomichev wrote:
> >
> > This patch series adds support for testing flow dissector BPF programs by
> > extending already existing BPF_PROG_TEST_RUN. The goal is to have a
> > packet as an inp
To be in line with the previous commit ("bpf: libbpf: retry program
creation without the name"), do the retry at the higher level, not the
syscall level.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/bpf.c| 11 +--
tools/lib/bpf/libbpf.c | 11 +++
2 files c
;name
for programs. Pre v4.14 kernels don't know about programs names and
return an error about unexpected non-zero data. Retry
bpf_load_program_xattr without a program name to cover older kernels.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 12
1 file changed, 12 in
On 11/20, Alexei Starovoitov wrote:
> On Mon, Nov 19, 2018 at 04:46:25PM -0800, Stanislav Fomichev wrote:
> > [Recent commit 23499442c319 ("bpf: libbpf: retry map creation without
> > the name") fixed this issue for maps, let's do the same for programs.]
> >
>
On 11/20, Y Song wrote:
> On Tue, Nov 20, 2018 at 10:19 AM Stanislav Fomichev wrote:
> >
> > Wrap headers in extern "C", to turn off C++ mangling.
> > This simplifies including libbpf in c++ and linking against it.
> >
> > Signed-off-by: Stanislav Fomich
Wrap headers in extern "C", to turn off C++ mangling.
This simplifies including libbpf in c++ and linking against it.
v2 changes:
* do the same for btf.h
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/bpf.h| 9 +
tools/lib/bpf/btf.h| 8
tools/lib/bpf/li
On 11/20, Alexei Starovoitov wrote:
> On Tue, Nov 20, 2018 at 04:05:55PM -0800, Stanislav Fomichev wrote:
> > On 11/20, Alexei Starovoitov wrote:
> > > On Tue, Nov 20, 2018 at 01:37:23PM -0800, Stanislav Fomichev wrote:
> > > > Wrap headers in extern
On 11/20, Alexei Starovoitov wrote:
> On Tue, Nov 20, 2018 at 01:37:23PM -0800, Stanislav Fomichev wrote:
> > Wrap headers in extern "C", to turn off C++ mangling.
> > This simplifies including libbpf in c++ and linking against it.
> >
> > v2 changes:
> &
It currently only checks whether kernel supports map/prog names.
This capability check will be used in the next two commits to skip setting
prog/map names.
Suggested-by: Daniel Borkmann
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 58
Use recently added capability check.
See commit 23499442c319 ("bpf: libbpf: retry map creation without the
name") for rationale.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/libbpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b
Instead, check for a newly created caps.name bpf_object capability.
If kernel doesn't support names, don't specify the attribute.
See commit 23499442c319 ("bpf: libbpf: retry map creation without the
name") for rationale.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/bpf
On 11/20, Alexei Starovoitov wrote:
> On Wed, Nov 21, 2018 at 12:18:57AM +0100, Daniel Borkmann wrote:
> > On 11/21/2018 12:04 AM, Alexei Starovoitov wrote:
> > > On Tue, Nov 20, 2018 at 01:19:05PM -0800, Stanislav Fomichev wrote:
> > >> On 11/20, Alexei Starovoitov
;name
for programs. Pre v4.14 kernels don't know about programs names and
return an error about unexpected non-zero data. Retry sys_bpf without
a program name to cover older kernels.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/bpf.c | 10 ++
1 file changed, 10 insertions(+)
dif
o cover older kernels.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/bpf.c | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 03f9bcc4ef50..673175bc06ee 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -69,6
o cover older kernels.
v2 changes:
* check for errno == EINVAL as suggested by Daniel Borkmann
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/bpf.c | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 03f9bcc4ef50..961e1b
On 11/20, Daniel Borkmann wrote:
> On 11/19/2018 11:49 PM, Stanislav Fomichev wrote:
> > Since commit 88cda1c9da02 ("bpf: libbpf: Provide basic API support
> > to specify BPF obj name"), libbpf unconditionally sets bpf_attr->name
> > for maps. Pre v4.14
On 11/21, Quentin Monnet wrote:
> 2018-11-20 15:26 UTC-0800 ~ Stanislav Fomichev
> > On 11/20, Alexei Starovoitov wrote:
> >> On Wed, Nov 21, 2018 at 12:18:57AM +0100, Daniel Borkmann wrote:
> >>> On 11/21/2018 12:04 AM, Alexei Starovoitov wrote:
> >>>
Wrap headers in extern "C", to turn off C++ mangling.
This simplifies including libbpf in c++ and linking against it.
v2 changes:
* do the same for btf.h
v3 changes:
* test_libbpf.cpp to test for possible future c++ breakages
Signed-off-by: Stanislav Fomichev
---
tools/lib/bp
Wrap headers in extern "C", to turn off C++ mangling.
This simplifies including libbpf in c++ and linking against it.
Signed-off-by: Stanislav Fomichev
---
tools/lib/bpf/bpf.h| 9 +
tools/lib/bpf/libbpf.h | 9 +
2 files changed, 18 insertions(+)
diff --git a/too
91 matches
Mail list logo