* Adding bridge interface to non-default network namespace crashes kernel
@ 2009-09-07 15:07 Atis Elsts
2009-09-08 8:40 ` Daniel Lezcano
0 siblings, 1 reply; 4+ messages in thread
From: Atis Elsts @ 2009-09-07 15:07 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
[-- Attachment #1: Type: text/plain, Size: 491 bytes --]
Trying to add bridge interface from userspace program, after moving the
program to a new network namespace, causes kernel to crash. I am using latest
kernel version from git (2.6.31-rc9).
The bug is easy to reproduce - just compile and run the attached C program.
I see that bridge interface has NETIF_F_NETNS_LOCAL flag, but as I understand,
this flag simply means that a device cannot be *moved* across network
namespaces, not that it cannot be *created* in other namespaces.
--Atis
[-- Attachment #2: crash.c --]
[-- Type: text/x-csrc, Size: 571 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <linux/sched.h>
#include <linux/sockios.h>
int main() {
if (unshare(CLONE_NEWNET)) {
perror("unshare");
return -1;
}
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
perror("socket");
return -1;
}
const char *name = "lobridge";
if (ioctl(fd, SIOCBRADDBR, name) < 0) {
perror("ioctl SIOCBRADDBR");
return -1;
}
system("ip addr");
for (;;) {
printf("still running\n");
sleep(5);
}
}
[-- Attachment #3: syslog --]
[-- Type: text/plain, Size: 3289 bytes --]
Sep 7 16:06:19 debian kernel: [ 91.040000] ------------[ cut here ]------------
Sep 7 16:06:19 debian kernel: [ 91.040000] kernel BUG at fs/sysfs/group.c:65!
Sep 7 16:06:19 debian kernel: [ 91.040000] invalid opcode: 0000 [#1] SMP
Sep 7 16:06:19 debian kernel: [ 91.040000] last sysfs file: /sys/devices/virtual/net/lo/operstate
Sep 7 16:06:19 debian kernel: [ 91.040000] Modules linked in:
Sep 7 16:06:19 debian kernel: [ 91.040000]
Sep 7 16:06:19 debian kernel: [ 91.040000] Pid: 1667, comm: a.out Not tainted (2.6.31-rc9 #16)
Sep 7 16:06:19 debian kernel: [ 91.040000] EIP: 0060:[<c0218c5e>] EFLAGS: 00000246 CPU: 0
Sep 7 16:06:19 debian kernel: [ 91.040000] EIP is at internal_create_group+0x14e/0x180
Sep 7 16:06:19 debian kernel: [ 91.040000] EAX: 00000000 EBX: c71fb000 ECX: c053aae0 EDX: 00000000
Sep 7 16:06:19 debian kernel: [ 91.040000] ESI: 00000000 EDI: c71fb25c EBP: c6dede58 ESP: c6dede30
Sep 7 16:06:19 debian kernel: [ 91.040000] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Sep 7 16:06:19 debian kernel: [ 91.040000] Process a.out (pid: 1667, ti=c6dec000 task=c6df1920 task.ti=c6dec000)
Sep 7 16:06:19 debian kernel: [ 91.040000] Stack:
Sep 7 16:06:19 debian kernel: [ 91.040000] c71fb008 c053aae0 00000000 c71fb25c 00000000 00000000 c6dede58 c71fb000
Sep 7 16:06:19 debian kernel: [ 91.040000] <0> 00000000 c71fb25c c6dede60 c0218cbc c6dede84 c03c6bc3 00000000 00000000
Sep 7 16:06:19 debian kernel: [ 91.040000] <0> 00000000 c7102000 c71fb000 00000000 c7102000 c6dedea0 c03c348f 00000001
Sep 7 16:06:19 debian kernel: [ 91.040000] Call Trace:
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c0218cbc>] ? sysfs_create_group+0xc/0x10
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c03c6bc3>] ? br_sysfs_addbr+0x23/0xf0
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c03c348f>] ? br_add_bridge+0x18f/0x1a0
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c03c4328>] ? br_ioctl_deviceless_stub+0x1f8/0x210
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c03c4130>] ? br_ioctl_deviceless_stub+0x0/0x210
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c032e0cf>] ? sock_ioctl+0xbf/0x220
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c032e010>] ? sock_ioctl+0x0/0x220
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c01d4e28>] ? vfs_ioctl+0x28/0x80
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c01d4faa>] ? do_vfs_ioctl+0x6a/0x520
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c032d2a3>] ? sock_map_fd+0x43/0x70
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c032db22>] ? sys_socket+0x52/0x70
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c0118138>] ? do_page_fault+0x168/0x310
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c01d54b3>] ? sys_ioctl+0x53/0x70
Sep 7 16:06:19 debian kernel: [ 91.040000] [<c0102c04>] ? sysenter_do_call+0x12/0x22
Sep 7 16:06:19 debian kernel: [ 91.040000] Code: bd 8b 5d e0 83 45 ec 01 85 db 0f 84 63 ff ff ff 8b 12 89 f8 e8 e4 ce ff ff 8b 16 e9 53 ff ff ff 8b 40 18 85 c0 0f 85 e9 fe ff ff <0f> 0b eb fe 89 f8 e8 47 ea ff ff 8b 45 e8 83 c4 1c 5b 5e 5f 5d
Sep 7 16:06:19 debian kernel: [ 91.040000] EIP: [<c0218c5e>] internal_create_group+0x14e/0x180 SS:ESP 0068:c6dede30
Sep 7 16:06:19 debian kernel: [ 91.040000] ---[ end trace beadcfdb06c985eb ]---
[-- Attachment #4: Type: text/plain, Size: 206 bytes --]
_______________________________________________
Containers mailing list
Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Adding bridge interface to non-default network namespace crashes kernel
2009-09-07 15:07 Adding bridge interface to non-default network namespace crashes kernel Atis Elsts
@ 2009-09-08 8:40 ` Daniel Lezcano
2009-09-14 11:19 ` more troubles with bridge in netns Atis Elsts
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Lezcano @ 2009-09-08 8:40 UTC (permalink / raw)
To: Atis Elsts; +Cc: netdev, containers
Atis Elsts wrote:
> Trying to add bridge interface from userspace program, after moving the
> program to a new network namespace, causes kernel to crash. I am using latest
> kernel version from git (2.6.31-rc9).
> The bug is easy to reproduce - just compile and run the attached C program.
>
> I see that bridge interface has NETIF_F_NETNS_LOCAL flag, but as I understand,
> this flag simply means that a device cannot be *moved* across network
> namespaces, not that it cannot be *created* in other namespaces.
>
Yep, very easy to reproduce :/
The sysfs has not been disabled for the bridge. I will try to fix it as
soon as I can.
Thanks
-- Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* more troubles with bridge in netns
2009-09-08 8:40 ` Daniel Lezcano
@ 2009-09-14 11:19 ` Atis Elsts
2009-09-14 11:28 ` Daniel Lezcano
0 siblings, 1 reply; 4+ messages in thread
From: Atis Elsts @ 2009-09-14 11:19 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]
On Tuesday 08 September 2009 11:40:44 Daniel Lezcano wrote:
> Atis Elsts wrote:
> > Trying to add bridge interface from userspace program, after moving the
> > program to a new network namespace, causes kernel to crash. I am using
> > latest kernel version from git (2.6.31-rc9).
> > The bug is easy to reproduce - just compile and run the attached C
> > program.
> >
> > I see that bridge interface has NETIF_F_NETNS_LOCAL flag, but as I
> > understand, this flag simply means that a device cannot be *moved* across
> > network namespaces, not that it cannot be *created* in other namespaces.
>
> Yep, very easy to reproduce :/
> The sysfs has not been disabled for the bridge. I will try to fix it as
> soon as I can.
>
> Thanks
> -- Daniel
Hello,
please let me know when the sysfs patch for bridge is available. At the moment
I managed to get it to work by just commenting out all sysfs stuff for bridge
module. However, a new problem appears now. After running C program
(attached) that creates a bridge in network namespace and attaches an
interface to it, I got this message repeatedly:
kernel:[ 466.758908] unregister_netdevice: waiting for lo to become free.
Usage count = 2
It sems pretty unlikely that my kernel changes could have caused this?
The unregister_netdevice message does not appear, however, if I uncomment this
line in child.c:
system("brctl setfd sim_br0 0");
--Atis
[-- Attachment #2: brtest.tgz --]
[-- Type: application/x-tgz, Size: 10767 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: more troubles with bridge in netns
2009-09-14 11:19 ` more troubles with bridge in netns Atis Elsts
@ 2009-09-14 11:28 ` Daniel Lezcano
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2009-09-14 11:28 UTC (permalink / raw)
To: Atis Elsts; +Cc: netdev
Atis Elsts wrote:
> On Tuesday 08 September 2009 11:40:44 Daniel Lezcano wrote:
>
>> Atis Elsts wrote:
>>
>>> Trying to add bridge interface from userspace program, after moving the
>>> program to a new network namespace, causes kernel to crash. I am using
>>> latest kernel version from git (2.6.31-rc9).
>>> The bug is easy to reproduce - just compile and run the attached C
>>> program.
>>>
>>> I see that bridge interface has NETIF_F_NETNS_LOCAL flag, but as I
>>> understand, this flag simply means that a device cannot be *moved* across
>>> network namespaces, not that it cannot be *created* in other namespaces.
>>>
>> Yep, very easy to reproduce :/
>> The sysfs has not been disabled for the bridge. I will try to fix it as
>> soon as I can.
>>
>> Thanks
>> -- Daniel
>>
>
> Hello,
>
> please let me know when the sysfs patch for bridge is available. At the moment
> I managed to get it to work by just commenting out all sysfs stuff for bridge
> module. However, a new problem appears now. After running C program
> (attached) that creates a bridge in network namespace and attaches an
> interface to it, I got this message repeatedly:
> kernel:[ 466.758908] unregister_netdevice: waiting for lo to become free.
> Usage count = 2
>
> It sems pretty unlikely that my kernel changes could have caused this?
>
> The unregister_netdevice message does not appear, however, if I uncomment this
> line in child.c:
> system("brctl setfd sim_br0 0");
>
I was about to send a patch to disable the bridge per namespace as it
seems it was never tested.
Can you send me your kernel patch ?
Thanks.
-- Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-14 11:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-07 15:07 Adding bridge interface to non-default network namespace crashes kernel Atis Elsts
2009-09-08 8:40 ` Daniel Lezcano
2009-09-14 11:19 ` more troubles with bridge in netns Atis Elsts
2009-09-14 11:28 ` Daniel Lezcano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).