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: <CAEf4BzY=VajaEH_09FX0-wuPFCJ6te=shZa0jj2Jc7ukL-WzMQ@mail.gmail.com>
Date:   Mon, 25 Apr 2022 21:35:13 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Zhengchao Shao <shaozhengchao@...wei.com>
Cc:     bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        john fastabend <john.fastabend@...il.com>,
        Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        KP Singh <kpsingh@...nel.org>,
        Wei Yongjun <weiyongjun1@...wei.com>,
        YueHaibing <yuehaibing@...wei.com>
Subject: Re: [PATCH bpf-next] samples/bpf: detach xdp prog when program exits
 unexpectedly in xdp_rxq_info_user

On Thu, Apr 21, 2022 at 5:07 AM Zhengchao Shao <shaozhengchao@...wei.com> wrote:
>
> When xdp_rxq_info_user program exits unexpectedly, it doesn't detach xdp
> prog of device, and other xdp prog can't be attached to the device. So
> call init_exit() to detach xdp prog when program exits unexpectedly.
>
> Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.com>
> ---
>  samples/bpf/xdp_rxq_info_user.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
>

you are introducing a new compilation warning, please fix it


/data/users/andriin/linux/samples/bpf/xdp_rxq_info_user.c: In function
‘options2str’:
/data/users/andriin/linux/samples/bpf/xdp_rxq_info_user.c:153:1:
warning: control reaches end of non-void function [-Wreturn-type]
  153 | }
      | ^

It also would be good to instead use bpf_link-based XDP attachment
that would be auto-detached automatically on process crash
(bpf_link_create() FTW). Please consider also converting this sample
to skeleton (and then bpf_program__attach_xdp() as high-level
alternative to bpf_link_create()).

> diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
> index f2d90cba5164..6378007e085a 100644
> --- a/samples/bpf/xdp_rxq_info_user.c
> +++ b/samples/bpf/xdp_rxq_info_user.c
> @@ -18,7 +18,7 @@ static const char *__doc__ = " XDP RX-queue info extract example\n\n"
>  #include <getopt.h>
>  #include <net/if.h>
>  #include <time.h>

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ