Project

General

Profile

Bug #246

Failure on building batman-adv for a 4.5.0 kernel

Added by Linus Lüssing about 5 years ago. Updated about 5 years ago.

Status:
Rejected
Priority:
Normal
Target version:
-
Start date:
03/15/2016
Due date:
% Done:

0%

Estimated time:

Description

After a quick glance it seems to me, that maybe Linux 4.5 might be missing an include for uapi/linux/pkt_cls.h in sch_generic.h?


$ make clean; KERNELPATH=/home/tux/dev/linux/headers/usr/src/linux-headers-4.5.0+ /usr/bin/make
rm -f compat-autoconf.h*
make -C /lib/modules/3.2.0-4-amd64/build M=/home/tux/dev/batman-adv-t_x/net/batman-adv CONFIG_BATMAN_ADV=m CONFIG_BATMAN_ADV_DEBUG=n CONFIG_BATMAN_ADV_BLA=y CONFIG_BATMAN_ADV_DAT=y CONFIG_BATMAN_ADV_NC=n CONFIG_BATMAN_ADV_MCAST=y CONFIG_BATMAN_ADV_BATMAN_V=n INSTALL_MOD_DIR=updates/net/batman-adv/ clean
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-4-amd64'
  CLEAN   /home/tux/dev/batman-adv-t_x/net/batman-adv/.tmp_versions
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-4-amd64'
make clean  0,24s user 0,17s system 63% cpu 0,645 total
/home/tux/dev/batman-adv-t_x/gen-compat-autoconf.sh /home/tux/dev/batman-adv-t_x/compat-autoconf.h
/usr/bin/make -C /home/tux/dev/linux/headers/usr/src/linux-headers-4.5.0+ M=/home/tux/dev/batman-adv-t_x/net/batman-adv CONFIG_BATMAN_ADV=m CONFIG_BATMAN_ADV_DEBUG=n CONFIG_BATMAN_ADV_BLA=y CONFIG_BATMAN_ADV_DAT=y CONFIG_BATMAN_ADV_NC=n CONFIG_BATMAN_ADV_MCAST=y CONFIG_BATMAN_ADV_BATMAN_V=n INSTALL_MOD_DIR=updates/net/batman-adv/     modules
make[1]: Entering directory `/home/tux/dev/linux/headers/usr/src/linux-headers-4.5.0+'
  CC [M]  /home/tux/dev/batman-adv-t_x/net/batman-adv/bat_iv_ogm.o
  CC [M]  /home/tux/dev/batman-adv-t_x/net/batman-adv/bitarray.o
  CC [M]  /home/tux/dev/batman-adv-t_x/net/batman-adv/bridge_loop_avoidance.o
  CC [M]  /home/tux/dev/batman-adv-t_x/net/batman-adv/debugfs.o
  CC [M]  /home/tux/dev/batman-adv-t_x/net/batman-adv/distributed-arp-table.o
  CC [M]  /home/tux/dev/batman-adv-t_x/net/batman-adv/fragmentation.o
  CC [M]  /home/tux/dev/batman-adv-t_x/net/batman-adv/gateway_client.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 /home/tux/dev/batman-adv-t_x/net/batman-adv/gateway_client.c:29:
include/net/sch_generic.h: In function ‘skb_at_tc_ingress’:
include/net/sch_generic.h:413:2: error: implicit declaration of function ‘G_TC_AT’ [-Werror=implicit-function-declaration]
include/net/sch_generic.h:413:33: error: ‘AT_INGRESS’ undeclared (first use in this function)
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
make[2]: *** [/home/tux/dev/batman-adv-t_x/net/batman-adv/gateway_client.o] Error 1
make[1]: *** [_module_/home/tux/dev/batman-adv-t_x/net/batman-adv] Error 2
make[1]: Leaving directory `/home/tux/dev/linux/headers/usr/src/linux-headers-4.5.0+'
make: *** [all] Error 2

Files

kernel-report.mbox (2.82 KB) kernel-report.mbox Sven Eckelmann, 03/16/2016 12:02 PM

History

#1

Updated by Sven Eckelmann about 5 years ago

Hm, at least the build test cannot reproduce this problem with master or next against 4.5: https://lists.open-mesh.org/mailman3/hyperkitty/list/linux-merge@lists.open-mesh.org/message/LR4VEFTRRXD6THXVTU35PNJPPOPOB4F2/

#2

Updated by Sven Eckelmann about 5 years ago

  • Assignee set to Linus Lüssing
#3

Updated by Sven Eckelmann about 5 years ago

  • File 0001-net-sched-Add-missing-include-for-G_TC_AT-AT_INGRESS.patch added
#4

Updated by Sven Eckelmann about 5 years ago

Hm, I've just checked my v4.5 include/net/sch_generic.h here :

  4 #include <linux/netdevice.h>
  5 #include <linux/types.h>
  6 #include <linux/rcupdate.h>
  7 #include <linux/pkt_sched.h>
  8 #include <linux/pkt_cls.h>
  9 #include <linux/percpu.h>
 10 #include <linux/dynamic_queue_limits.h>
 11 #include <net/gen_stats.h>
 12 #include <net/rtnetlink.h>

So this header is alread included on line 8. And I would therefore guess that this patch is unnecessary. Please check what is different in your kernel.

#5

Updated by Sven Eckelmann about 5 years ago

  • File deleted (0001-net-sched-Add-missing-include-for-G_TC_AT-AT_INGRESS.patch)
#6

Updated by Sven Eckelmann about 5 years ago

Could it be that this file is included but for some reason the KERNEL is not defined? Can you just test this with this small change:

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 4398737..7d2aee6 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -3,6 +3,7 @@

 #include <linux/types.h>
 #include <linux/pkt_sched.h>
+#warning foo

 #ifdef __KERNEL__
 /* I think i could have done better macros ; for now this is stolen from
@@ -35,6 +36,7 @@ bits 9,10,11: redirect counter -  redirect TTL. Loop avoidance

  *
  * */
+#warning bar

 #define S_TC_FROM          _TC_MAKE32(6)
 #define M_TC_FROM          _TC_MAKEMASK(2,S_TC_FROM)

My complete buildlog for the master is:

,-(sven@bentobox:pts/3:~/tmp/qemu-batman/batman-adv)
'-(1:19:44:%)- (git)-[master]-%> make KERNELPATH=/home/sven/tmp/linux-next
/home/sven/tmp/qemu-batman/batman-adv/gen-compat-autoconf.sh /home/sven/tmp/qemu-batman/batman-adv/compat-autoconf.h
make -C /home/sven/tmp/linux-next M=/home/sven/tmp/qemu-batman/batman-adv/net/batman-adv CONFIG_BATMAN_ADV=m CONFIG_BATMAN_ADV_DEBUG=n CONFIG_BATMAN_ADV_BLA=y CONFIG_BATMAN_ADV_DAT=y CONFIG_BATMAN_ADV_NC=n CONFIG_BATMAN_ADV_MCAST=y CONFIG_BATMAN_ADV_BATMAN_V=n INSTALL_MOD_DIR=updates/net/batman-adv/      modules
make[1]: Entering directory '/home/sven/tmp/linux-next'
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/bat_iv_ogm.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/bitarray.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/bridge_loop_avoidance.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/debugfs.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/distributed-arp-table.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/fragmentation.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/gateway_client.o
In file included from include/net/sch_generic.h:8:0,
                 from include/linux/filter.h:16,
                 from include/net/sock.h:64,
                 from include/linux/tcp.h:22,
                 from include/linux/ipv6.h:72,
                 from /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/gateway_client.c:29:
./include/uapi/linux/pkt_cls.h:6:2: warning: #warning foo [-Wcpp]
 #warning foo
  ^
./include/uapi/linux/pkt_cls.h:39:2: warning: #warning bar [-Wcpp]
 #warning bar
  ^
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/gateway_common.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/hard-interface.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/hash.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/icmp_socket.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/main.o
In file included from include/net/sch_generic.h:8:0,
                 from include/linux/filter.h:16,
                 from include/net/sock.h:64,
                 from include/linux/tcp.h:22,
                 from include/linux/ipv6.h:72,
                 from /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/main.c:30:
./include/uapi/linux/pkt_cls.h:6:2: warning: #warning foo [-Wcpp]
 #warning foo
  ^
./include/uapi/linux/pkt_cls.h:39:2: warning: #warning bar [-Wcpp]
 #warning bar
  ^
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/multicast.o
In file included from include/net/sch_generic.h:8:0,
                 from include/linux/filter.h:16,
                 from include/net/sock.h:64,
                 from include/linux/tcp.h:22,
                 from include/linux/ipv6.h:72,
                 from /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/multicast.c:32:
./include/uapi/linux/pkt_cls.h:6:2: warning: #warning foo [-Wcpp]
 #warning foo
  ^
./include/uapi/linux/pkt_cls.h:39:2: warning: #warning bar [-Wcpp]
 #warning bar
  ^
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/originator.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/routing.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/send.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/soft-interface.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/sysfs.o
  CC [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/translation-table.o
  LD [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/batman-adv.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/batman-adv.mod.o
  LD [M]  /home/sven/tmp/qemu-batman/batman-adv/net/batman-adv/batman-adv.ko
make[1]: Leaving directory '/home/sven/tmp/linux-next'
#7

Updated by Linus Lüssing about 5 years ago

Nope, both #warning's do not fire, the error comes first.

I also tried putting the #warning right on the first line of include/uapi/linux/pkt_cls.h but that did not make a difference either.

To make sure I am using the right directory I have put a #warning in ~/dev/linux/headers/usr/src/linux-headers-4.5.0+/include/net/sch_generic.h after its #includes and that one triggers just fine.

Looking at include/linux/if_bridge.h for instance, that one has an include to the uapi side, "#include <uapi/linux/if_bridge.h>". With grep, I find zero includes for uapi/linux/pkt_cls.h. Also the guard in uapi/linux/pkt_cls.h is weird, should probably be __UAPI_LINUX_PKT_CLS_H instead of __LINUX_PKT_CLS_H?

But it is weird, 4.4 looks very similar to me regarding these includes and my 4.4 header directory has CONFIG_NET_CLS_ACT set just like the 4.5 one has. Hm, hm.

#8

Updated by Linus Lüssing about 5 years ago

Btw., this is the command I usually use to create a bunch of kernel header directories for testing batman-adv compat stuff:


for i in v4.4 v4.5 ...; do
        echo "Building: $i" 
        git reset --hard
        git checkout "$i" || break
        git clean -f -d
        rm -f .config*
        make defconfig
        sed -i "s/^# CONFIG_LIBCRC32C is not set$/CONFIG_LIBCRC32C=m/;s/^# CONFIG_CRC16 is not set$/CONFIG_CRC16=m/" .config
        sed -i "s/\-m elf_x86_64/-m64/;s/\-m elf_i386/-m32/" arch/x86/vdso/Makefile
        fakeroot make-kpkg clean
        fakeroot make-kpkg -j5 kernel_headers || break
done

And then extracting the header directories from the Debian kernel header packages with another bash loop.

So these should(tm) be clean and reproduceable kernel headers, no fancy kernel configuration, just the default one plus CRC stuff. Will retry building the 4.5 kernel headers to check whether it happens again.

#9

Updated by Sven Eckelmann about 5 years ago

Thanks for the snippet. I hope that the arch/x86/vdso/Makefile isn't important because this file doesn't exist anymore since 4.2.

The build against the 4.5 kernel with your config still works without any problems. The build against the kernel-package generated .deb fails as you've described.

Problem is that the file exists inside the headers at multiple places:

$ find asd4.5/usr/src/ -iname "pkt_cls.h"|grep linux/pkt_cls.h  
asd4.5/usr/src/linux-headers-4.5.0+/include/linux/pkt_cls.h
asd4.5/usr/src/linux-headers-4.5.0+/include/uapi/linux/pkt_cls.h

The content of include/linux/pkt_cls.h looks like it was stripped of its __KERNEL__ from include/uapi/linux/pkt_cls.h

$ diff -ruN asd4.5/usr/src/linux-headers-4.5.0+/include/uapi/linux/pkt_cls.h asd4.5/usr/src/linux-headers-4.5.0+/include/linux/pkt_cls.h
--- asd4.5/usr/src/linux-headers-4.5.0+/include/uapi/linux/pkt_cls.h    2016-03-16 11:00:55.900588138 +0100
+++ asd4.5/usr/src/linux-headers-4.5.0+/include/linux/pkt_cls.h    2016-03-16 10:10:46.000000000 +0100
@@ -4,60 +4,6 @@
 #include <linux/types.h>
 #include <linux/pkt_sched.h>

-#ifdef __KERNEL__
-/* I think i could have done better macros ; for now this is stolen from
- * some arch/mips code - jhs
-*/
-#define _TC_MAKE32(x) ((x))
-
-#define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n))
-#define _TC_MAKEMASK(v,n) (_TC_MAKE32((_TC_MAKE32(1)<<(v))-1) << _TC_MAKE32(n))
-#define _TC_MAKEVALUE(v,n) (_TC_MAKE32(v) << _TC_MAKE32(n))
-#define _TC_GETVALUE(v,n,m) ((_TC_MAKE32(v) & _TC_MAKE32(m)) >> _TC_MAKE32(n))
-
-/* verdict bit breakdown 
- *
-bit 0: when set -> this packet has been munged already
-
-bit 1: when set -> It is ok to munge this packet
-
-bit 2,3,4,5: Reclassify counter - sort of reverse TTL - if exceeded
-assume loop
-
-bit 6,7: Where this packet was last seen 
-0: Above the transmit example at the socket level
-1: on the Ingress
-2: on the Egress
-
-bit 8: when set --> Request not to classify on ingress. 
-
-bits 9,10,11: redirect counter -  redirect TTL. Loop avoidance
-
- *
- * */
-
-#define S_TC_FROM          _TC_MAKE32(6)
-#define M_TC_FROM          _TC_MAKEMASK(2,S_TC_FROM)
-#define G_TC_FROM(x)       _TC_GETVALUE(x,S_TC_FROM,M_TC_FROM)
-#define V_TC_FROM(x)       _TC_MAKEVALUE(x,S_TC_FROM)
-#define SET_TC_FROM(v,n)   ((V_TC_FROM(n)) | (v & ~M_TC_FROM))
-#define AT_STACK    0x0
-#define AT_INGRESS    0x1
-#define AT_EGRESS    0x2
-
-#define TC_NCLS          _TC_MAKEMASK1(8)
-#define SET_TC_NCLS(v)   ( TC_NCLS | (v & ~TC_NCLS))
-#define CLR_TC_NCLS(v)   ( v & ~TC_NCLS)
-
-#define S_TC_AT          _TC_MAKE32(12)
-#define M_TC_AT          _TC_MAKEMASK(2,S_TC_AT)
-#define G_TC_AT(x)       _TC_GETVALUE(x,S_TC_AT,M_TC_AT)
-#define V_TC_AT(x)       _TC_MAKEVALUE(x,S_TC_AT)
-#define SET_TC_AT(v,n)   ((V_TC_AT(n)) | (v & ~M_TC_AT))
-
-#define MAX_REC_LOOP 4
-#define MAX_RED_LOOP 4
-#endif

 /* Action attributes */
 enum {

Please report this to the debian package kernel-package:

From: Linus Lüssing <linus.luessing@c0d3.blue>
To: submit@bugs.debian.org
Subject: [make-kpkg] Missing defines AT_INGRESS+G_TC_AT in linux-headers-4.5.0

Package: kernel-package
Version: 13.018
Severity: normal

... please add more information here - this is just stuff which I would expect from the bug report...

make-kpkg was used to generate the
linux-headers-4.5.0+_4.5.0+-10.00.Custom_amd64.deb for 4.5.0
(defconfig). But these headers cannot be used to build some external
modules. Both AT_INGRESS and G_TC_AT are not defined for
include/net/sch_generic.h. This doesn't happen when the external module
is build against the official source code instead of the generated
headers package.

    $ git clone https://git.open-mesh.org/batman-adv.git
    $ make -C batman-adv KERNELPATH=/usr/src/linux-headers-4.5.0+/
    [...]
      CC [M]  /batman-adv/net/batman-adv/gateway_client.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 /batman-adv/net/batman-adv/gateway_client.c:29:
    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

Problem is that the packages generated by make-kpkg has the __KERNEL__
section stripped from the newly generated
/usr/src/linux-headers-4.5.0+/include/linux/pkt_cls.h. But this header
is included by /usr/src/linux-headers-4.5.0+/include/net/sch_generic.h
instead of uapi/linux/pkt_cls.h (which has the __KERNEL__ section).

More information about this problem were gathered at
https://www.open-mesh.org/issues/246
#10

Updated by Sven Eckelmann about 5 years ago

Hm, maybe the kernel-package maintainer is also not the right one here. Just checked the exported

/usr/bin/make INSTALL_HDR_PATH=... headers_install
and the include/linux/pkt_cls.h is also lagging the __KERNEL__ section. So maybe it should be reported to whoever is responsible for the headers_install, Daniel Borkmann <> (author of fdc5432a7b44), Alexei Starovoitov <> and "David S. Miller" <>. Still Cc'ing Manoj Srivastava <> (maintainer of kernel-package) will most likely not hurt because Documentation/kbuild/headers_install.txt clearly states that headers_install is for "use by userspace programs" only. Doesn't seem to be made for builds of external modules against a kernel version.

At least some of these people know more about it and can judge better if make-kpkg or the kernel is to blame

#11

Updated by Sven Eckelmann about 5 years ago

I've already prepared a mail to the kernel folks but I will not submit it because it looks more like the make-kpkg linux-headers are not made to build kernel modules against it (it only has documents about userspace tools and nothing about out-of-tree modules). This is different for the official linux-headers packages (which work even for 4.5-rc7).

Please feel free to still use either this mail or the report to Debian.

#12

Updated by Sven Eckelmann about 5 years ago

  • Status changed from New to Rejected

I am marking this issue as "rejected" because this is not a problem in batman-adv. It is happens because the reporter was trying to compile a kernel module against kernel headers which are not meant to be used for kernel modules.

Also available in: Atom PDF