netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] xt_bpf: fix handling of pinned objects
@ 2017-09-17 11:20 Shmulik Ladkani
  2017-09-17 11:20 ` [PATCH v2 1/2] iptables: support match info fixup after tc_init Shmulik Ladkani
  2017-09-17 11:20 ` [PATCH v2 2/2] extensions: xt_bpf: get the pinned ebpf object when match is initialized Shmulik Ladkani
  0 siblings, 2 replies; 12+ messages in thread
From: Shmulik Ladkani @ 2017-09-17 11:20 UTC (permalink / raw)
  To: netfilter-devel, Pablo Neira Ayuso
  Cc: Willem de Bruijn, rbk, shmulik, Rafael Buchbinder

From: Rafael Buchbinder <rafi@rbk.ms>

From: Rafael Buchbinder <rafi@rbk.ms>

Following set of commits fixes xt_bpf extension to correctly handle
pinned eBPF programs.

The origin of the bug lies in the fact that xt_bpf_info_v1 structure
requires an open file descriptor to create an eBPF match. 
This file descriptor is checked on every replace. However, as this file
descriptor is valid only for the iptables invocation which loads the
eBPF for the first time, all subsequent iptables invocations fail in
bpf_mt_check (kernel) function.

See discussion in [1] for more details.

The following patches add a hook in extensions which is called
immediately after TC_INIT to fixup whatever needs to be fixed up.
In case of xt_bpf, the fixup function gets the eBPF object by path to
populate xt_bpf_info_v1 structure with a valid file descriptor.

[1] https://marc.info/?l=netfilter-devel&m=150530909630143&w=2

Since v1:
  - fixed From field

Rafael Buchbinder (2):
  iptables: support match info fixup after tc_init
  extensions: xt_bpf: get the pinned ebpf object when match is
    initialized

 extensions/libxt_bpf.c |  9 +++++++++
 include/xtables.h      |  3 +++
 iptables/ip6tables.c   | 35 +++++++++++++++++++++++++++++++++++
 iptables/iptables.c    | 34 ++++++++++++++++++++++++++++++++++
 4 files changed, 81 insertions(+)

-- 
2.14.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-04 14:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-17 11:20 [PATCH v2 0/2] xt_bpf: fix handling of pinned objects Shmulik Ladkani
2017-09-17 11:20 ` [PATCH v2 1/2] iptables: support match info fixup after tc_init Shmulik Ladkani
2017-09-18 16:28   ` Pablo Neira Ayuso
2017-09-18 17:00     ` Shmulik Ladkani
2017-09-18 17:23       ` Pablo Neira Ayuso
2017-09-18 17:50         ` Willem de Bruijn
2017-09-18 17:54           ` Pablo Neira Ayuso
2017-10-04 14:33             ` Pablo Neira Ayuso
2017-10-04 14:38               ` Shmulik Ladkani
2017-09-18 18:04       ` Jan Engelhardt
2017-09-17 11:20 ` [PATCH v2 2/2] extensions: xt_bpf: get the pinned ebpf object when match is initialized Shmulik Ladkani
2017-09-18 16:22   ` Willem de Bruijn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).