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: <87764612d480432134b5253f17e3d6fff816e147.camel@redhat.com>
Date:   Thu, 17 Mar 2022 09:33:45 +0100
From:   Paolo Abeni <pabeni@...hat.com>
To:     Menglong Dong <menglong8.dong@...il.com>,
        David Ahern <dsahern@...nel.org>
Cc:     Jakub Kicinski <kuba@...nel.org>,
        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 v3 2/3] net: icmp: introduce
 __ping_queue_rcv_skb() to report drop reasons

On Thu, 2022-03-17 at 13:25 +0800, Menglong Dong wrote:
> On Thu, Mar 17, 2022 at 11:56 AM David Ahern <dsahern@...nel.org> wrote:
> > 
> > On 3/16/22 12:31 AM, menglong8.dong@...il.com wrote:
> > > diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
> > > index 3ee947557b88..9a1ea6c263f8 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)
> > >  {
> > > +     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);
> > > 
> > 
> > This is a generic proto callback and you are now changing its return
> > code in a way that seems to conflict with existing semantics
> 
> The return value of ping_queue_rcv_skb() seems not changed.
> In the previous code, -1 is returned on failure and 0 for success.
> This logic isn't changed, giving __ping_queue_rcv_skb() != 0 means
> failure and -1 is returned. Isn't it?

With this patch, on failure __ping_queue_rcv_skb() returns 'reason' (>
0) and ping_queue_rcv_skb() returns the same value.

On success __ping_queue_rcv_skb() returns SKB_NOT_DROPPED_YET (==0) and
ping_queue_rcv_skb() return -1.

You need to preserve the old ping_queue_rcv_skb() return values, under
the same circumstances.

Thanks,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ