Re: [PATCH 4/4] ipvs: reduce kernel stack usage

To: Julian Anastasov <ja@xxxxxx>
Subject: Re: [PATCH 4/4] ipvs: reduce kernel stack usage
Cc: Kees Cook <keescook@xxxxxxxxxxxx>, Wensong Zhang <wensong@xxxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Alexey Kuznetsov <kuznet@xxxxxxxxxxxxx>, Hideaki YOSHIFUJI <yoshfuji@xxxxxxxxxxxxxx>, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>, Florian Westphal <fw@xxxxxxxxx>, James Smart <>, Dick Kennedy <dick.kennedy@xxxxxxxxxxxx>, "James E . J . Bottomley" <jejb@xxxxxxxxxxxxx>, "Martin K . Petersen" <martin.petersen@xxxxxxxxxx>, Larry Finger <Larry.Finger@xxxxxxxxxxxx>, Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, James Morris <jmorris@xxxxxxxxx>, linux-scsi <linux-scsi@xxxxxxxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, driverdevel <devel@xxxxxxxxxxxxxxxxxxxx>, Networking <netdev@xxxxxxxxxxxxxxx>, lvs-devel@xxxxxxxxxxxxxxx, netfilter-devel <netfilter-devel@xxxxxxxxxxxxxxx>, coreteam@xxxxxxxxxxxxx, Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
From: Arnd Bergmann <arnd@xxxxxxxx>
Date: Mon, 22 Jul 2019 12:16:51 +0200
On Sun, Jun 30, 2019 at 10:37 PM Julian Anastasov <ja@xxxxxx> wrote:
> On Fri, 28 Jun 2019, Arnd Bergmann wrote:

> >       struct ip_vs_conn *ctl_cp = cp->control;
> >       if (!ctl_cp) {
> > -             IP_VS_ERR_BUF("request control DEL for uncontrolled: "
> > -                           "%s:%d to %s:%d\n",
> > -                           IP_VS_DBG_ADDR(cp->af, &cp->caddr),
> > -                           ntohs(cp->cport),
> > -                           IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
> > -                           ntohs(cp->vport));
> > +             pr_err("request control DEL for uncontrolled: "
> > +                    "%pISp to %pISp\n",

(replying a bit late)

>         ip_vs_dbg_addr() used compact form (%pI6c), so it would be
> better to use %pISc and %pISpc everywhere in IPVS...


>         Also, note that before now port was printed with %d and
> ntohs() was used, now port should be in network order, so:
> - ntohs() should be removed


> - htons() should be added, if missing. At first look, this case
> is not present in IPVS, we have only ntohs() usage

I found one case in ip_vs_ftp_in() that needs it in order to subtract one:

                IP_VS_DBG(7, "protocol %s %pISpc %pISpc\n",
-                         IP_VS_DBG_SOCKADDR(cp->af, &to, ntohs(port)),
+                         IP_VS_DBG_SOCKADDR(cp->af, &to, port),
                          IP_VS_DBG_SOCKADDR(cp->af, &cp->vaddr,
-                                             ntohs(cp->vport)-1));
+                                            htons(ntohs(cp->vport)-1)));

Thanks for the review, I'll send a new patch after some more
build testing on the new version.


<Prev in Thread] Current Thread [Next in Thread>