Modify

Opened 2 years ago

Last modified 2 years ago

#20930 new defect

Linux compilation failure

Reported by: spk.punith Owned by: developers
Priority: high Milestone:
Component: kernel Version: Trunk
Keywords: Cc:

Description

Facing compilation error while compiling linux as shown below

Error source as per analysis is from one of the generic patch target/linux/generic/patches-3.18/911-kobject_add_broadcast_uevent.patch,

when CONFIG_NET is not defined then sources under net/core/ will not be compiled and kfree_skb() definition defined at net/core/skbuff.c also will not available

LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03

AS usr/initramfs_data.o
LD usr/built-in.o
LDS arch/mips/kernel/vmlinux.lds
LINK vmlinux
LD vmlinux.o
MODPOST vmlinux.o
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
LD vmlinux

lib/lib.a(kobject_uevent.o): In function `broadcast_uevent':
kobject_uevent.c:(.text.broadcast_uevent+0x8): undefined reference to `kfree_skb'
make[4]: * [vmlinux] Error 1
make[4]: Leaving directory `openwrt/core/build_dir/target-mips-openwrt-linux-uclibc/linux-xxx/linux-3.18.23
make[3]:
* [openwrt/core/build_dir/target-mips-openwrt-linux-uclibc/linux-xx/symtab.h] Error 2
make[3]: Leaving directory `openwrt_model/target/target_linux_lantiq'
make[2]: * [install] Error 2
make[2]: Leaving directory `openwrt/core/target/linux'
make[1]:
* [target/linux/install] Error 2

Attachments (0)

Change History (6)

comment:1 Changed 2 years ago by nbd

the directory names, e.g. build_dir/target-mips-openwrt-linux-uclibc and openwrt_model/target/target_linux_lantiq look really weird.

did you manually type any of that stuff, or are you using some weird hacked up version of openwrt?

comment:2 Changed 2 years ago by anonymous

The reporter is telling about the issue wrt generic-patch
911-kobject_add_broadcast_uevent.patch.

In this patch

--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -31,6 +31,8 @@

#define UEVENT_NUM_ENVP 32 /* number of env pointers */
#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */

+struct sk_buff;/* This should be protected under the macro CONFIG_NET*/
+

/* path to the userspace helper executed on an event */
extern char uevent_helper[];

@@ -213,4 +215,7 @@ int add_uevent_var(struct kobj_uevent_en

int kobject_action_type(const char *buf, size_t count,

enum kobject_action *type);

/*: This also should be protected under the macro CONFIG_NET, because skbuff is not defined when CONFIG_NET is not enabled*/

+int broadcast_uevent(struct sk_buff *skb, u32 pid, u32 group,
+ gfp_t allocation);
+

#endif /* _KOBJECT_H_ */

--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -382,6 +382,43 @@ int add_uevent_var(struct kobj_uevent_en

EXPORT_SYMBOL_GPL(add_uevent_var);

#if defined(CONFIG_NET)

+int broadcast_uevent(struct sk_buff *skb, u32 pid, u32 group,
+ gfp_t allocation)
+{
....................
....................
....................
}
#else
+int broadcast_uevent(struct sk_buff *skb, u32 pid, u32 group,
+ gfp_t allocation)
+{
+ kfree_skb(skb);
+ return 0;
+}
+#endif
+EXPORT_SYMBOL_GPL(broadcast_uevent);

should be modified to

#if defined(CONFIG_NET)

+int broadcast_uevent(struct sk_buff *skb, u32 pid, u32 group,
+ gfp_t allocation)
+{
....................
....................
....................
}
+EXPORT_SYMBOL_GPL(broadcast_uevent);
+#endif

as there shouldn't be any #else condition when CONFIG_NET is not defined

comment:3 follow-up: Changed 2 years ago by nbd

What's the point of trying to build openwrt without CONFIG_NET, it won't be functional anyway?

comment:4 in reply to: ↑ 3 Changed 2 years ago by spk.punith

Replying to nbd:

In most cases CONFIG_NET is defined, so no one could figure out this bug until now from very old legacy code.
So it does not mean that #else part of code can not be clean.

I am trying a use case where CONFIG_NET will not be defined. So raising the concern.

Last edited 2 years ago by spk.punith (previous) (diff)

comment:5 follow-up: Changed 2 years ago by anonymous

Even I am also facing similar error from the generic patch as shown by author

lib/lib.a(kobject_uevent.o): In function `broadcast_uevent':
kobject_uevent.c:(.text.broadcast_uevent+0x8): undefined reference to `kfree_skb'
make[4]: * [vmlinux] Error 1
make[4]: Leaving directory `/home/nandy/workspace/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.18.23'
make[3]:
* /home/nandy/workspace/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/symtab.h Error 2
make[3]: Leaving directory `/home/nandy/workspace/openwrt/target/linux/ar71xx'

comment:6 in reply to: ↑ 5 Changed 2 years ago by spk.punith

Replying to anonymous:

I have corrected the patch(911-kobject_add_broadcast_uevent.patch).
Replace the patch with following code.

And it worked for me with or without CONFIG_NET

--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -32,6 +32,10 @@
 #define UEVENT_NUM_ENVP            32  /* number of env pointers */
 #define UEVENT_BUFFER_SIZE     2048    /* buffer for the variables */

+#ifdef CONFIG_NET
+struct sk_buff;
+#endif
+
 #ifdef CONFIG_UEVENT_HELPER
 /* path to the userspace helper executed on an event */
 extern char uevent_helper[];
@@ -221,4 +225,10 @@ int add_uevent_var(struct kobj_uevent_en
 int kobject_action_type(const char *buf, size_t count,
            enum kobject_action *type);

+#ifdef CONFIG_NET
+
+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
+            gfp_t allocation);
+#endif
+
 #endif /* _KOBJECT_H_ */
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -424,6 +424,34 @@ int add_uevent_var(struct kobj_uevent_en
 EXPORT_SYMBOL_GPL(add_uevent_var);

 #if defined(CONFIG_NET)
+int broadcast_uevent(struct sk_buff *skb, __u32 pid, __u32 group,
+            gfp_t allocation)
+{
+   struct uevent_sock *ue_sk;
+   int err = 0;
+
+   /* send netlink message */
+   mutex_lock(&uevent_sock_mutex);
+   list_for_each_entry(ue_sk, &uevent_sock_list, list) {
+       struct sock *uevent_sock = ue_sk->sk;
+       struct sk_buff *skb2;
+
+       skb2 = skb_clone(skb, allocation);
+       if (!skb2)
+           break;
+
+       err = netlink_broadcast(uevent_sock, skb2, pid, group,
+                   allocation);
+       if (err)
+           break;
+   }
+   mutex_unlock(&uevent_sock_mutex);
+
+   kfree_skb(skb);
+   return err;
+}
+EXPORT_SYMBOL_GPL(broadcast_uevent);
+
 static int uevent_net_init(struct net *net)
 {
    struct uevent_sock *ue_sk;
Last edited 2 years ago by spk.punith (previous) (diff)

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.