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]
Date:   Wed, 16 Mar 2022 14:02:42 +0800
From:   Menglong Dong <menglong8.dong@...il.com>
To:     David Ahern <dsahern@...nel.org>, Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>, xeb@...l.ru,
        David Miller <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        Menglong Dong <imagedong@...cent.com>,
        Eric Dumazet <edumazet@...gle.com>, Martin Lau <kafai@...com>,
        Talal Ahmad <talalahmad@...gle.com>,
        Kees Cook <keescook@...omium.org>,
        Alexander Lobakin <alobakin@...me>,
        Hao Peng <flyingpeng@...cent.com>,
        Mengen Sun <mengensun@...cent.com>, dongli.zhang@...cle.com,
        LKML <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        Biao Jiang <benbjiang@...cent.com>
Subject: Re: [PATCH net-next v2 2/3] net: icmp: introduce __ping_queue_rcv_skb()
 to report drop reasons

On Wed, Mar 16, 2022 at 10:47 AM <menglong8.dong@...il.com> wrote:
>
> From: Menglong Dong <imagedong@...cent.com>
>
> In order to avoid to change the return value of ping_queue_rcv_skb(),
> introduce the function __ping_queue_rcv_skb(), which is able to report
> the reasons of skb drop as its return value, as Paolo suggested.
>
> Meanwhile, make ping_queue_rcv_skb() a simple call to
> __ping_queue_rcv_skb().
>
> The kfree_skb() and sock_queue_rcv_skb() used in ping_queue_rcv_skb()
> are replaced with kfree_skb_reason() and sock_queue_rcv_skb_reason()
> now.
>
> Reviewed-by: Hao Peng <flyingpeng@...cent.com>
> Reviewed-by: Biao Jiang <benbjiang@...cent.com>
> Signed-off-by: Menglong Dong <imagedong@...cent.com>
> ---
> v2:
> - introduce __ping_queue_rcv_skb() instead of change the return value
>   of ping_queue_rcv_skb()
> ---
>  net/ipv4/ping.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> index 3ee947557b88..138eeed7727b 100644
> --- a/net/ipv4/ping.c
> +++ b/net/ipv4/ping.c
> @@ -934,16 +934,24 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
>  }
>  EXPORT_SYMBOL_GPL(ping_recvmsg);
>
> -int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> +static enum skb_drop_reason __ping_queue_rcv_skb(struct sock *sk,
> +                                         struct sk_buff *skb)

Oops, there is an alignment problem here...I'll send a new version.

>  {
> +       enum skb_drop_reason reason;
> +
>         pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n",
>                  inet_sk(sk), inet_sk(sk)->inet_num, skb);
> -       if (sock_queue_rcv_skb(sk, skb) < 0) {
> -               kfree_skb(skb);
> +       if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) {
> +               kfree_skb_reason(skb, reason);
>                 pr_debug("ping_queue_rcv_skb -> failed\n");
> -               return -1;
> +               return reason;
>         }
> -       return 0;
> +       return SKB_NOT_DROPPED_YET;
> +}
> +
> +int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
> +{
> +       return __ping_queue_rcv_skb(sk, skb) ?: -1;
>  }
>  EXPORT_SYMBOL_GPL(ping_queue_rcv_skb);
>
> --
> 2.35.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ