lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0yzNh9Kih1Z9KsK@C02YVCJELVCG>
Date:   Sun, 16 Oct 2022 21:43:18 -0400
From:   Andy Gospodarek <andrew.gospodarek@...adcom.com>
To:     Gerhard Engleder <gerhard@...leder-embedded.com>
Cc:     andrew.gospodarek@...adcom.com, ast@...nel.org,
        daniel@...earbox.net, davem@...emloft.net, kuba@...nel.org,
        hawk@...nel.org, john.fastabend@...il.com, bpf@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH net-next] samples/bpf: Fix MAC address swapping in
 xdp2_kern

On Sat, Oct 15, 2022 at 11:30:50PM +0200, Gerhard Engleder wrote:
> xdp2_kern rewrites and forwards packets out on the same interface.
> Forwarding still works but rewrite got broken when xdp multibuffer
> support has been added.
> 
> With xdp multibuffer a local copy of the packet has been introduced. The
> MAC address is now swapped in the local copy, but the local copy in not
> written back.
> 
> Fix MAC address swapping be adding write back of modified packet.
> 

Nice catch!  Thanks for posting this.

> Fixes: 772251742262 ("samples/bpf: fixup some tools to be able to support xdp multibuffer")
> Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
Reviewed-by: Andy Gospodarek <gospo@...adcom.com>

> ---
>  samples/bpf/xdp2_kern.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/samples/bpf/xdp2_kern.c b/samples/bpf/xdp2_kern.c
> index 3332ba6bb95f..67804ecf7ce3 100644
> --- a/samples/bpf/xdp2_kern.c
> +++ b/samples/bpf/xdp2_kern.c
> @@ -112,6 +112,10 @@ int xdp_prog1(struct xdp_md *ctx)
>  
>  	if (ipproto == IPPROTO_UDP) {
>  		swap_src_dst_mac(data);
> +
> +		if (bpf_xdp_store_bytes(ctx, 0, pkt, sizeof(pkt)))
> +			return rc;
> +
>  		rc = XDP_TX;
>  	}
>  
> -- 
> 2.30.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ