All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [COMMITTED] setsockopt08: includes netinet/in.h
Date: Fri, 6 Aug 2021 07:55:18 +0200	[thread overview]
Message-ID: <YQzOxg35JjpDOj7X@pevik> (raw)
In-Reply-To: <YQzLUUKbLcoJjRVb@pevik>

Hi Li, Cyril,

> Hi Li,

> > We have to put netinet/in.h on the top to get rid of conflict
> > of glibc and kernel headers for old unbuntu.

> >   -----------
> >   /usr/include/linux/in.h:28:3: error: redeclaration of enumerator 'IPPROTO_IP'
> >         IPPROTO_IP = 0,  /* Dummy protocol for TCP  */
> >    ^
> >   /usr/include/netinet/in.h:42:5: note: previous definition of 'IPPROTO_IP' was here
> >        IPPROTO_IP = 0,    /* Dummy protocol for TCP.  */
> >   ...
> >   -----------

> > See: https://www.mail-archive.com/netdev@vger.kernel.org/msg132711.html

> Thanks for fixing it, it's not a first time we got hit by this.
> I wonder where <linux/in.h> is included. It's not directly in setsockopt08.c,
> it must be in our lapi header. But it's not in tst_safe_net.h, not in
> safe_net_fn.h nor in tst_net.h and both actually include <netinet/in.h>, thus it must be
> before. But there is only tst_test.h.

> I'm asking because it'd be better to add <netinet/in.h> into header before
> <linux/in.h>.

OK, it's in lapi/ip_tables.h, which includes <linux/netfilter_ipv4/ip_tables.h>
which includes <linux/if.h>. But I wonder why inclusion of <netinet/in.h> from
safe_net_fn.h or in tst_net.h does not work. Anyway, I'll test including
<netinet/in.h> in include/lapi/ip_tables.h helps.

Kind regards,
Petr

> Kind regards,
> Petr

> > Fixes: ebf3a4fbd39a (Add setsockopt08, CVE-2021-22555)
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> >  testcases/kernel/syscalls/setsockopt/setsockopt08.c | 2 ++
> >  1 file changed, 2 insertions(+)

> > diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt08.c b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
> > index f758dcbdc..f7052f27b 100644
> > --- a/testcases/kernel/syscalls/setsockopt/setsockopt08.c
> > +++ b/testcases/kernel/syscalls/setsockopt/setsockopt08.c
> > @@ -79,6 +79,8 @@
> >   *  - sizeof(struct xt_entry_target) = 32
> >   */

> > +#include <netinet/in.h>
> > +
> >  #include "tst_test.h"
> >  #include "tst_safe_net.h"
> >  #include "lapi/ip_tables.h"

  reply	other threads:[~2021-08-06  5:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06  2:56 [LTP] [COMMITTED] setsockopt08: includes netinet/in.h Li Wang
2021-08-06  5:40 ` Petr Vorel
2021-08-06  5:55   ` Petr Vorel [this message]
2021-08-06  8:29     ` Li Wang
2021-08-06  9:37       ` Petr Vorel
2021-08-06 10:18         ` Li Wang
2021-08-06 10:52           ` Richard Palethorpe
2021-08-09  4:03             ` Li Wang
2021-08-20  9:37             ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YQzOxg35JjpDOj7X@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.