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: <CACGkMEuiROr4EydSp+HFgG2GPqsda0zpfge5DvsSDEbsyWDuLg@mail.gmail.com>
Date: Wed, 10 Apr 2024 12:00:32 +0800
From: Jason Wang <jasowang@...hat.com>
To: Lei Chen <lei.chen@...rtx.com>
Cc: Andrew Lunn <andrew@...n.ch>, Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org, 
	netdev@...r.kernel.org
Subject: Re: [PATCH] net:tun: limit printing rate when illegal packet received
 by tun dev

On Wed, Apr 10, 2024 at 10:23 AM Lei Chen <lei.chen@...rtx.com> wrote:
>
> On Tue, Apr 9, 2024 at 8:52 PM Andrew Lunn <andrew@...n.ch> wrote:
> >
> > On Tue, Apr 09, 2024 at 02:24:05AM -0400, Lei Chen wrote:
> > > vhost_worker will call tun call backs to receive packets. If too many
> > > illegal packets arrives, tun_do_read will keep dumping packet contents.
> > > When console is enabled, it will costs much more cpu time to dump
> > > packet and soft lockup will be detected.
> > >
> > > Rate limit mechanism can be used to limit the dumping rate.
> > > @@ -2125,14 +2126,16 @@ static ssize_t tun_put_user(struct tun_struct *tun,
> > >                                           tun_is_little_endian(tun), true,
> > >                                           vlan_hlen)) {
> > >                       struct skb_shared_info *sinfo = skb_shinfo(skb);
> > > -                     pr_err("unexpected GSO type: "
> > > -                            "0x%x, gso_size %d, hdr_len %d\n",
> > > -                            sinfo->gso_type, tun16_to_cpu(tun, gso.gso_size),
> > > -                            tun16_to_cpu(tun, gso.hdr_len));
> > > -                     print_hex_dump(KERN_ERR, "tun: ",
> > > -                                    DUMP_PREFIX_NONE,
> > > -                                    16, 1, skb->head,
> > > -                                    min((int)tun16_to_cpu(tun, gso.hdr_len), 64), true);
> > > +
> > > +                     if (__ratelimit(&ratelimit)) {
> >
> > Maybe just use net_ratelimit() rather than add a new ratelimit
> > variable?
>
> Thanks for your suggestion, net_ratelimit is a better way to make it.

+1

Thanks

>
> >
> > A separate issue, i wounder if rather than pr_err(),
> > netdev_err(tun->dev, ...) should be used to indicate which TUN device
> > has been given bad GSO packets?
>
> I got it, I'll remake the patch, thanks.
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ