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] [day] [month] [year] [list]
Message-ID: <CAADnVQJneRNysmQNy3vPrMkXUGsW3EM_papHufErKFjnGX8q3g@mail.gmail.com>
Date: Sun, 29 Sep 2024 10:56:54 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Yuan Chen <chenyuan_fl@....com>
Cc: Alexei Starovoitov <ast@...nel.org>, Andrii Nakryiko <andrii@...nel.org>, 
	Network Development <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH] bpf: fix the xdp_adjust_tail sample prog issue

On Sun, Sep 29, 2024 at 5:41 AM Yuan Chen <chenyuan_fl@....com> wrote:
>
> From: Yuan Chen <chenyuan@...inos.cn>
>
> During the xdp_adjust_tail test, probabilistic failure occurs and SKB package
> is discarded by the kernel. After checking the issues by tracking SKB package,
> it is identified that they were caused by checksum errors. Refer to checksum
> of the arch/arm64/include/asm/checksum.h for fixing.
>
> Fixes: c6ffd1ff7856 (bpf: add bpf_xdp_adjust_tail sample prog)
> Signed-off-by: Yuan Chen <chenyuan@...inos.cn>
> ---
>  samples/bpf/xdp_adjust_tail_kern.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/samples/bpf/xdp_adjust_tail_kern.c b/samples/bpf/xdp_adjust_tail_kern.c
> index ffdd548627f0..3543ddd62ef4 100644
> --- a/samples/bpf/xdp_adjust_tail_kern.c
> +++ b/samples/bpf/xdp_adjust_tail_kern.c
> @@ -57,7 +57,8 @@ static __always_inline void swap_mac(void *data, struct ethhdr *orig_eth)
>
>  static __always_inline __u16 csum_fold_helper(__u32 csum)
>  {
> -       return ~((csum & 0xffff) + (csum >> 16));
> +       csum += (csum >> 16) | (csum << 16);
> +       return ~(__sum16)(csum >> 16);
>  }

progs/xdping_kern.c is doing it differently:
static __always_inline __u16 csum_fold_helper(__wsum sum)
{
        sum = (sum & 0xffff) + (sum >> 16);
        return ~((sum & 0xffff) + (sum >> 16));
}

Let's make it common.

pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ