Skip to contentSkip to conversation

skb_at_tc_ingress helper breaks compilation of oot modules

DISCUSSION Ingo Saitz 3 participants 4 messages Apr 20, 2016

Subsystems (2)
lore
Share & tools
lore

Ingo Saitz

author
#0 lore raw

In Linux 4.5, when CONFIG_NET_CLS_ACT is defined, compilation of out of tree modules breaks with undeclared functions/constants. The culprit is:

commit fdc5432a7b44ab7de17141beec19d946b9344e91

Author: Daniel Borkmann <[email protected]>
Date:   Thu Jan 7 15:50:22 2016 +0100

net, sched: add skb_at_tc_ingress helper

which uses G_TC_AT and AT_INGRESS but only includes linux/pkt_cls.h, which does not include these #defines for oot builds. Unfortunately I'm not sure what the correct fix is, maybe the uapi folks could help, but i attached a simple testcase and build log (Makefile is straight from kernelnewbies).

Ingo

Signature · 4 lines
 ╭─╮  Kennedy's Lemma:
╭│───╮  If you can parse Perl, you can solve the Halting Problem.
│╰─│─╯
╰──╯  http://www.perlmonks.org/?node_id=663393

#include <net/ipv6.h>

obj-m := fail.o

all:

	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:

	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

make -C /lib/modules/4.5.0-pinguin20160314/build M=/home/ingo/src/linux/pkt_cls-bug modules make[1]: Entering directory '/usr/src/linux-headers-4.5.0-pinguin20160314'
CC [M] /home/ingo/src/linux/pkt_cls-bug/fail.o
In file included from include/linux/filter.h:16:0,

                 from include/net/sock.h:64,
                 from include/linux/tcp.h:22,
                 from include/linux/ipv6.h:72,
                 from include/net/ipv6.h:16,
                 from /home/ingo/src/linux/pkt_cls-bug/fail.c:1:
include/net/sch_generic.h: In function ‘skb_at_tc_ingress’:
include/net/sch_generic.h:413:9: error: implicit declaration of function ‘G_TC_AT’ [-Werror=implicit-function-declaration]
  return G_TC_AT(skb->tc_verd) & AT_INGRESS;
         ^
include/net/sch_generic.h:413:33: error: ‘AT_INGRESS’ undeclared (first use in this function)
  return G_TC_AT(skb->tc_verd) & AT_INGRESS;
                                 ^

include/net/sch_generic.h:413:33: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
scripts/Makefile.build:264: recipe for target '/home/ingo/src/linux/pkt_cls-bug/fail.o' failed make[2]: *** [/home/ingo/src/linux/pkt_cls-bug/fail.o] Error 1
Makefile:1391: recipe for target '_module_/home/ingo/src/linux/pkt_cls-bug' failed
make[1]: *** [_module_/home/ingo/src/linux/pkt_cls-bug] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.5.0-pinguin20160314'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

#1 lore raw
Quoted 7 lines · Ingo Saitz

In Linux 4.5, when CONFIG_NET_CLS_ACT is defined, compilation of out of tree modules breaks with undeclared functions/constants. The culprit is:

commit fdc5432a7b44ab7de17141beec19d946b9344e91

Author: Daniel Borkmann <[email protected]>
Date:   Thu Jan 7 15:50:22 2016 +0100
Quoted 7 lines

net, sched: add skb_at_tc_ingress helper

which uses G_TC_AT and AT_INGRESS but only includes linux/pkt_cls.h, which does not include these #defines for oot builds. Unfortunately I'm not sure what the correct fix is, maybe the uapi folks could help, but i attached a simple testcase and build log (Makefile is straight from kernelnewbies).

Hmm, your fail.c test case only contains '#include <net/ipv6.h>'?

Note, upstream kernel never cared about out-of-tree modules, only in-tree code. ;) Did you run into an issue with any in-tree code?

Thanks,
Daniel

author
#2 lore raw
Quoted 1 line · Daniel Borkmann

Hmm, your fail.c test case only contains '#include <net/ipv6.h>'?

No, only when building oot modules (virtualbox, and I found batman-adv having the same issue), so I reduced it to the most simple test case. This actually builds a fail.ko on 4.4.7 with CONFIG_NET_CLS_ACT=y without errors.

Quoted 2 lines

Note, upstream kernel never cared about out-of-tree modules, only in-tree code. ;) Did you run into an issue with any in-tree code?

A current fix for oot modules would be to add:

#include <uapi/linux/pkt_cls.h>

in front of that include for kernel >= 4.5…

Ingo

Signature · 4 lines
Kennedy's Lemma:
    If you can parse Perl, you can solve the Halting Problem.

http://www.perlmonks.org/?node_id=663393
#3 lore raw
In reply to Daniel Borkmann
Quoted 16 lines · Daniel Borkmann
Quoted 7 lines · Ingo Saitz

In Linux 4.5, when CONFIG_NET_CLS_ACT is defined, compilation of out of tree modules breaks with undeclared functions/constants. The culprit is:

commit fdc5432a7b44ab7de17141beec19d946b9344e91

Author: Daniel Borkmann <[email protected]>
Date:   Thu Jan 7 15:50:22 2016 +0100
Quoted 7 lines

net, sched: add skb_at_tc_ingress helper

which uses G_TC_AT and AT_INGRESS but only includes linux/pkt_cls.h, which does not include these #defines for oot builds. Unfortunately I'm not sure what the correct fix is, maybe the uapi folks could help, but i attached a simple testcase and build log (Makefile is straight from kernelnewbies).

Quoted 4 lines

Hmm, your fail.c test case only contains '#include <net/ipv6.h>'?

Note, upstream kernel never cared about out-of-tree modules, only in-tree code. ;) Did you run into an issue with any in-tree code?

I'm glad it broke out of tree module. We should do it more often. llvm constantly reshuffles internal api to incentivize upstreaming and working with the community.