[SRU][F][PATCH 0/1] tc/ebpf: unable to use BPF_FUNC_skb_change_head

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][F][PATCH 0/1] tc/ebpf: unable to use BPF_FUNC_skb_change_head

Ian May
BugLink: https://bugs.launchpad.net/bugs/1896504

[Impact]

tc ebpf programs that uses BPF_FUNC_skb_change_head are rejected.

[FIX]

Clean cherry pick from the upstream commit 6f3f65d80dac ("net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head"):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f3f65d80dac

[Test Case]

Create an ebpf program that uses this helper and load it with tc.

[Regression Potential]

This patch is enabling an additional feature of ebpf, the potential regressions should be low.

Lorenzo Colitti (1):
  net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head

 net/core/filter.c | 2 ++
 1 file changed, 2 insertions(+)

--
2.25.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/1] net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head

Ian May
From: Lorenzo Colitti <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1896504

This allows TC eBPF programs to modify and forward (redirect) packets
from interfaces without ethernet headers (for example cellular)
to interfaces with (for example ethernet/wifi).

The lack of this appears to simply be an oversight.

Tested:
  in active use in Android R on 4.14+ devices for ipv6
  cellular to wifi tethering offload.

Signed-off-by: Lorenzo Colitti <[hidden email]>
Signed-off-by: Maciej ┼╗enczykowski <[hidden email]>
Signed-off-by: Alexei Starovoitov <[hidden email]>
(cherry picked from commit 6f3f65d80dac8f2bafce2213005821fccdce194c)
Signed-off-by: Ian May <[hidden email]>
---
 net/core/filter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/filter.c b/net/core/filter.c
index 5c490d473df1..8340892884e8 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6159,6 +6159,8 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
  return &bpf_skb_adjust_room_proto;
  case BPF_FUNC_skb_change_tail:
  return &bpf_skb_change_tail_proto;
+ case BPF_FUNC_skb_change_head:
+ return &bpf_skb_change_head_proto;
  case BPF_FUNC_skb_get_tunnel_key:
  return &bpf_skb_get_tunnel_key_proto;
  case BPF_FUNC_skb_set_tunnel_key:
--
2.25.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: [SRU][F][PATCH 0/1] tc/ebpf: unable to use BPF_FUNC_skb_change_head

Colin Ian King-2
In reply to this post by Ian May
On 08/10/2020 15:07, Ian May wrote:

> BugLink: https://bugs.launchpad.net/bugs/1896504
>
> [Impact]
>
> tc ebpf programs that uses BPF_FUNC_skb_change_head are rejected.
>
> [FIX]
>
> Clean cherry pick from the upstream commit 6f3f65d80dac ("net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head"):
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f3f65d80dac
>
> [Test Case]
>
> Create an ebpf program that uses this helper and load it with t>
> [Regression Potential]
>
> This patch is enabling an additional feature of ebpf, the potential regressions should be low.
>
> Lorenzo Colitti (1):
>   net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head
>
>  net/core/filter.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Small, unintrusive fix, looks fine to me. Thanks Ian.

Acked-by: Colin Ian King <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH 1/1] net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head

Kleber Souza
In reply to this post by Ian May
On 08.10.20 16:07, Ian May wrote:

> From: Lorenzo Colitti <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1896504
>
> This allows TC eBPF programs to modify and forward (redirect) packets
> from interfaces without ethernet headers (for example cellular)
> to interfaces with (for example ethernet/wifi).
>
> The lack of this appears to simply be an oversight.
>
> Tested:
>   in active use in Android R on 4.14+ devices for ipv6
>   cellular to wifi tethering offload.
>
> Signed-off-by: Lorenzo Colitti <[hidden email]>
> Signed-off-by: Maciej ┼╗enczykowski <[hidden email]>
> Signed-off-by: Alexei Starovoitov <[hidden email]>
> (cherry picked from commit 6f3f65d80dac8f2bafce2213005821fccdce194c)
> Signed-off-by: Ian May <[hidden email]>

Acked-by: Kleber Sacilotto de Souza <[hidden email]>

> ---
>  net/core/filter.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 5c490d473df1..8340892884e8 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -6159,6 +6159,8 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
>   return &bpf_skb_adjust_room_proto;
>   case BPF_FUNC_skb_change_tail:
>   return &bpf_skb_change_tail_proto;
> + case BPF_FUNC_skb_change_head:
> + return &bpf_skb_change_head_proto;
>   case BPF_FUNC_skb_get_tunnel_key:
>   return &bpf_skb_get_tunnel_key_proto;
>   case BPF_FUNC_skb_set_tunnel_key:
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [SRU][F][PATCH 0/1] tc/ebpf: unable to use BPF_FUNC_skb_change_head

Ian May
In reply to this post by Ian May
Applied to Focal/master-next.  Thanks!

Ian

On 2020-10-08 09:07:34 , Ian May wrote:

> BugLink: https://bugs.launchpad.net/bugs/1896504
>
> [Impact]
>
> tc ebpf programs that uses BPF_FUNC_skb_change_head are rejected.
>
> [FIX]
>
> Clean cherry pick from the upstream commit 6f3f65d80dac ("net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head"):
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f3f65d80dac
>
> [Test Case]
>
> Create an ebpf program that uses this helper and load it with tc.
>
> [Regression Potential]
>
> This patch is enabling an additional feature of ebpf, the potential regressions should be low.
>
> Lorenzo Colitti (1):
>   net: bpf: Allow TC programs to call BPF_FUNC_skb_change_head
>
>  net/core/filter.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> --
> 2.25.1
>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team