2023-10-12 07:38:19

by Tasmiya Nalatwad

[permalink] [raw]
Subject: [Bisected] [1b4fa28a8b07] Build failure "net/core/gso_test.c"

Greetings,

[net-next] [6.6-rc4] Build failure "net/core/gso_test.c"

--- Traces ---

make -j 33 -s && make modules_install && make install
net/core/gso_test.c:58:48: error: initializer element is not constant
   58 |                 .segs = (const unsigned int[]) { gso_size },
      |                                                ^
net/core/gso_test.c:58:48: note: (near initialization for ‘cases[0]’)
net/core/gso_test.c:65:48: error: initializer element is not constant
   65 |                 .segs = (const unsigned int[]) { gso_size,
gso_size, 1 },
      |                                                ^
net/core/gso_test.c:65:48: note: (near initialization for ‘cases[1]’)
net/core/gso_test.c:72:49: error: initializer element is not constant
   72 |                 .frags = (const unsigned int[]) { gso_size, 1 },
      |                                                 ^
net/core/gso_test.c:72:49: note: (near initialization for ‘cases[2]’)
net/core/gso_test.c:74:48: error: initializer element is not constant
   74 |                 .segs = (const unsigned int[]) { gso_size,
gso_size, 1 },
      |                                                ^
net/core/gso_test.c:74:48: note: (near initialization for ‘cases[2]’)
net/core/gso_test.c:80:49: error: initializer element is not constant
   80 |                 .frags = (const unsigned int[]) { gso_size,
gso_size, 2 },
      |                                                 ^
net/core/gso_test.c:80:49: note: (near initialization for ‘cases[3]’)
net/core/gso_test.c:82:48: error: initializer element is not constant
   82 |                 .segs = (const unsigned int[]) { gso_size,
gso_size, 2 },
      |                                                ^
net/core/gso_test.c:82:48: note: (near initialization for ‘cases[3]’)
net/core/gso_test.c:89:49: error: initializer element is not constant
   89 |                 .frags = (const unsigned int[]) { gso_size, 3 },
      |                                                 ^
net/core/gso_test.c:89:49: note: (near initialization for ‘cases[4]’)
net/core/gso_test.c:91:48: error: initializer element is not constant
   91 |                 .segs = (const unsigned int[]) { 2 * gso_size, 3 },
      |                                                ^
net/core/gso_test.c:91:48: note: (near initialization for ‘cases[4]’)
net/core/gso_test.c:99:53: error: initializer element is not constant
   99 |                 .frag_skbs = (const unsigned int[]) { gso_size,
gso_size },
      |                                                     ^
net/core/gso_test.c:99:53: note: (near initialization for ‘cases[5]’)
net/core/gso_test.c:101:48: error: initializer element is not constant
  101 |                 .segs = (const unsigned int[]) { gso_size,
gso_size, gso_size },
      |                                                ^
net/core/gso_test.c:101:48: note: (near initialization for ‘cases[5]’)
net/core/gso_test.c:107:53: error: initializer element is not constant
  107 |                 .frag_skbs = (const unsigned int[]) { gso_size,
gso_size },
      |                                                     ^
net/core/gso_test.c:107:53: note: (near initialization for ‘cases[6]’)
net/core/gso_test.c:109:48: error: initializer element is not constant
  109 |                 .segs = (const unsigned int[]) { gso_size,
gso_size },
      |                                                ^
net/core/gso_test.c:109:48: note: (near initialization for ‘cases[6]’)
net/core/gso_test.c:117:53: error: initializer element is not constant
  117 |                 .frag_skbs = (const unsigned int[]) { gso_size,
1, gso_size, 2 },
      |                                                     ^
net/core/gso_test.c:117:53: note: (near initialization for ‘cases[7]’)
net/core/gso_test.c:119:48: error: initializer element is not constant
  119 |                 .segs = (const unsigned int[]) { gso_size,
gso_size, gso_size, 3 },
      |                                                ^
net/core/gso_test.c:119:48: note: (near initialization for ‘cases[7]’)
make[4]: *** [scripts/Makefile.build:243: net/core/gso_test.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:480: net/core] Error 2
make[3]: *** Waiting for unfinished jobs....

make[2]: *** [scripts/Makefile.build:480: net] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/root/net-next/Makefile:1913: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2

gitbisect points to below commit, reverting the below commit resolves
the issue

commit 1b4fa28a8b07eb331aeb7fbfc806c0d2e3dc3627
    net: parametrize skb_segment unit test to expand coverage

--
Regards,
Tasmiya Nalatwad
IBM Linux Technology Center


2023-10-12 09:58:42

by Florian Westphal

[permalink] [raw]
Subject: Re: [Bisected] [1b4fa28a8b07] Build failure "net/core/gso_test.c"

Tasmiya Nalatwad <[email protected]> wrote:
> Greetings,
>
> [net-next] [6.6-rc4] Build failure "net/core/gso_test.c"
>
> --- Traces ---
>
> make -j 33 -s && make modules_install && make install
> net/core/gso_test.c:58:48: error: initializer element is not constant
> ?? 58 |???????????????? .segs = (const unsigned int[]) { gso_size },
> ????? |??????????????????????????????????????????????? ^

Ouch, I can reproduce this with: gcc --version
gcc (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.

gcc 13.2.1 and clang-16.0.6 are ok.

Whats the preference here? We could use simple preprocessor constant
or we could require much more recent compiler version for the net
kunit tests via kconfig.

gcc-12.2.0 can compile it after this simple s//g "fix":

diff --git a/net/core/gso_test.c b/net/core/gso_test.c
--- a/net/core/gso_test.c
+++ b/net/core/gso_test.c
@@ -4,7 +4,7 @@
#include <linux/skbuff.h>

static const char hdr[] = "abcdefgh";
-static const int gso_size = 1000;
+#define GSO_TEST_SIZE 1000

static void __init_skb(struct sk_buff *skb)
{
@@ -18,7 +18,7 @@ static void __init_skb(struct sk_buff *skb)

/* proto is arbitrary, as long as not ETH_P_TEB or vlan */
skb->protocol = htons(ETH_P_ATALK);
- skb_shinfo(skb)->gso_size = gso_size;
+ skb_shinfo(skb)->gso_size = GSO_TEST_SIZE;
}

enum gso_test_nr {
@@ -53,70 +53,70 @@ static struct gso_test_case cases[] = {
{
.id = GSO_TEST_NO_GSO,
.name = "no_gso",
- .linear_len = gso_size,
+ .linear_len = GSO_TEST_SIZE,
.nr_segs = 1,
- .segs = (const unsigned int[]) { gso_size },
+ .segs = (const unsigned int[]) { GSO_TEST_SIZE },
},
{
.id = GSO_TEST_LINEAR,
.name = "linear",
- .linear_len = gso_size + gso_size + 1,
+ .linear_len = GSO_TEST_SIZE + GSO_TEST_SIZE + 1,
.nr_segs = 3,
- .segs = (const unsigned int[]) { gso_size, gso_size, 1 },
+ .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
},
{
.id = GSO_TEST_FRAGS,
.name = "frags",
- .linear_len = gso_size,
+ .linear_len = GSO_TEST_SIZE,
.nr_frags = 2,
- .frags = (const unsigned int[]) { gso_size, 1 },
+ .frags = (const unsigned int[]) { GSO_TEST_SIZE, 1 },
.nr_segs = 3,
- .segs = (const unsigned int[]) { gso_size, gso_size, 1 },
+ .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
},
{
.id = GSO_TEST_FRAGS_PURE,
.name = "frags_pure",
.nr_frags = 3,
- .frags = (const unsigned int[]) { gso_size, gso_size, 2 },
+ .frags = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
.nr_segs = 3,
- .segs = (const unsigned int[]) { gso_size, gso_size, 2 },
+ .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
},
{
.id = GSO_TEST_GSO_PARTIAL,
.name = "gso_partial",
- .linear_len = gso_size,
+ .linear_len = GSO_TEST_SIZE,
.nr_frags = 2,
- .frags = (const unsigned int[]) { gso_size, 3 },
+ .frags = (const unsigned int[]) { GSO_TEST_SIZE, 3 },
.nr_segs = 2,
- .segs = (const unsigned int[]) { 2 * gso_size, 3 },
+ .segs = (const unsigned int[]) { 2 * GSO_TEST_SIZE, 3 },
},
{
/* commit 89319d3801d1: frag_list on mss boundaries */
.id = GSO_TEST_FRAG_LIST,
.name = "frag_list",
- .linear_len = gso_size,
+ .linear_len = GSO_TEST_SIZE,
.nr_frag_skbs = 2,
- .frag_skbs = (const unsigned int[]) { gso_size, gso_size },
+ .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
.nr_segs = 3,
- .segs = (const unsigned int[]) { gso_size, gso_size, gso_size },
+ .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE },
},
{
.id = GSO_TEST_FRAG_LIST_PURE,
.name = "frag_list_pure",
.nr_frag_skbs = 2,
- .frag_skbs = (const unsigned int[]) { gso_size, gso_size },
+ .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
.nr_segs = 2,
- .segs = (const unsigned int[]) { gso_size, gso_size },
+ .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
},
{
/* commit 43170c4e0ba7: GRO of frag_list trains */
.id = GSO_TEST_FRAG_LIST_NON_UNIFORM,
.name = "frag_list_non_uniform",
- .linear_len = gso_size,
+ .linear_len = GSO_TEST_SIZE,
.nr_frag_skbs = 4,
- .frag_skbs = (const unsigned int[]) { gso_size, 1, gso_size, 2 },
+ .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, 1, GSO_TEST_SIZE, 2 },
.nr_segs = 4,
- .segs = (const unsigned int[]) { gso_size, gso_size, gso_size, 3 },
+ .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3 },
},
{
/* commit 3953c46c3ac7 ("sk_buff: allow segmenting based on frag sizes") and

2023-10-12 12:03:30

by Tasmiya Nalatwad

[permalink] [raw]
Subject: Re: [Bisected] [1b4fa28a8b07] Build failure "net/core/gso_test.c"

Greetings,

Thank you Florian. I have tried the changes suggested by you and it
fixes the issue. With the suggested changes the problem is not seen.

On 10/12/23 15:27, Florian Westphal wrote:
> .linear_len = GSO_TEST_SIZE,

--
Regards,
Tasmiya Nalatwad
IBM Linux Technology Center

2023-10-12 16:30:04

by Kees Cook

[permalink] [raw]
Subject: Re: [Bisected] [1b4fa28a8b07] Build failure "net/core/gso_test.c"

On Thu, Oct 12, 2023 at 11:57:46AM +0200, Florian Westphal wrote:
> Tasmiya Nalatwad <[email protected]> wrote:
> > Greetings,
> >
> > [net-next] [6.6-rc4] Build failure "net/core/gso_test.c"
> >
> > --- Traces ---
> >
> > make -j 33 -s && make modules_install && make install
> > net/core/gso_test.c:58:48: error: initializer element is not constant
> > ?? 58 |???????????????? .segs = (const unsigned int[]) { gso_size },
> > ????? |??????????????????????????????????????????????? ^
>
> Ouch, I can reproduce this with: gcc --version
> gcc (Debian 12.2.0-14) 12.2.0
> Copyright (C) 2022 Free Software Foundation, Inc.
>
> gcc 13.2.1 and clang-16.0.6 are ok.
>
> Whats the preference here? We could use simple preprocessor constant
> or we could require much more recent compiler version for the net
> kunit tests via kconfig.
>
> gcc-12.2.0 can compile it after this simple s//g "fix":
>
> diff --git a/net/core/gso_test.c b/net/core/gso_test.c
> --- a/net/core/gso_test.c
> +++ b/net/core/gso_test.c
> @@ -4,7 +4,7 @@
> #include <linux/skbuff.h>
>
> static const char hdr[] = "abcdefgh";
> -static const int gso_size = 1000;
> +#define GSO_TEST_SIZE 1000

This fixes the build for me too.

Tested-by: Kees Cook <[email protected]>
Reviewed-by: Kees Cook <[email protected]>

-Kees

>
> static void __init_skb(struct sk_buff *skb)
> {
> @@ -18,7 +18,7 @@ static void __init_skb(struct sk_buff *skb)
>
> /* proto is arbitrary, as long as not ETH_P_TEB or vlan */
> skb->protocol = htons(ETH_P_ATALK);
> - skb_shinfo(skb)->gso_size = gso_size;
> + skb_shinfo(skb)->gso_size = GSO_TEST_SIZE;
> }
>
> enum gso_test_nr {
> @@ -53,70 +53,70 @@ static struct gso_test_case cases[] = {
> {
> .id = GSO_TEST_NO_GSO,
> .name = "no_gso",
> - .linear_len = gso_size,
> + .linear_len = GSO_TEST_SIZE,
> .nr_segs = 1,
> - .segs = (const unsigned int[]) { gso_size },
> + .segs = (const unsigned int[]) { GSO_TEST_SIZE },
> },
> {
> .id = GSO_TEST_LINEAR,
> .name = "linear",
> - .linear_len = gso_size + gso_size + 1,
> + .linear_len = GSO_TEST_SIZE + GSO_TEST_SIZE + 1,
> .nr_segs = 3,
> - .segs = (const unsigned int[]) { gso_size, gso_size, 1 },
> + .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
> },
> {
> .id = GSO_TEST_FRAGS,
> .name = "frags",
> - .linear_len = gso_size,
> + .linear_len = GSO_TEST_SIZE,
> .nr_frags = 2,
> - .frags = (const unsigned int[]) { gso_size, 1 },
> + .frags = (const unsigned int[]) { GSO_TEST_SIZE, 1 },
> .nr_segs = 3,
> - .segs = (const unsigned int[]) { gso_size, gso_size, 1 },
> + .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 1 },
> },
> {
> .id = GSO_TEST_FRAGS_PURE,
> .name = "frags_pure",
> .nr_frags = 3,
> - .frags = (const unsigned int[]) { gso_size, gso_size, 2 },
> + .frags = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
> .nr_segs = 3,
> - .segs = (const unsigned int[]) { gso_size, gso_size, 2 },
> + .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, 2 },
> },
> {
> .id = GSO_TEST_GSO_PARTIAL,
> .name = "gso_partial",
> - .linear_len = gso_size,
> + .linear_len = GSO_TEST_SIZE,
> .nr_frags = 2,
> - .frags = (const unsigned int[]) { gso_size, 3 },
> + .frags = (const unsigned int[]) { GSO_TEST_SIZE, 3 },
> .nr_segs = 2,
> - .segs = (const unsigned int[]) { 2 * gso_size, 3 },
> + .segs = (const unsigned int[]) { 2 * GSO_TEST_SIZE, 3 },
> },
> {
> /* commit 89319d3801d1: frag_list on mss boundaries */
> .id = GSO_TEST_FRAG_LIST,
> .name = "frag_list",
> - .linear_len = gso_size,
> + .linear_len = GSO_TEST_SIZE,
> .nr_frag_skbs = 2,
> - .frag_skbs = (const unsigned int[]) { gso_size, gso_size },
> + .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
> .nr_segs = 3,
> - .segs = (const unsigned int[]) { gso_size, gso_size, gso_size },
> + .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE },
> },
> {
> .id = GSO_TEST_FRAG_LIST_PURE,
> .name = "frag_list_pure",
> .nr_frag_skbs = 2,
> - .frag_skbs = (const unsigned int[]) { gso_size, gso_size },
> + .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
> .nr_segs = 2,
> - .segs = (const unsigned int[]) { gso_size, gso_size },
> + .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE },
> },
> {
> /* commit 43170c4e0ba7: GRO of frag_list trains */
> .id = GSO_TEST_FRAG_LIST_NON_UNIFORM,
> .name = "frag_list_non_uniform",
> - .linear_len = gso_size,
> + .linear_len = GSO_TEST_SIZE,
> .nr_frag_skbs = 4,
> - .frag_skbs = (const unsigned int[]) { gso_size, 1, gso_size, 2 },
> + .frag_skbs = (const unsigned int[]) { GSO_TEST_SIZE, 1, GSO_TEST_SIZE, 2 },
> .nr_segs = 4,
> - .segs = (const unsigned int[]) { gso_size, gso_size, gso_size, 3 },
> + .segs = (const unsigned int[]) { GSO_TEST_SIZE, GSO_TEST_SIZE, GSO_TEST_SIZE, 3 },
> },
> {
> /* commit 3953c46c3ac7 ("sk_buff: allow segmenting based on frag sizes") and

--
Kees Cook