From owner-freebsd-net@FreeBSD.ORG Mon Sep 15 14:44:39 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05615104 for ; Mon, 15 Sep 2014 14:44:39 +0000 (UTC) Received: from mail-vc0-x231.google.com (mail-vc0-x231.google.com [IPv6:2607:f8b0:400c:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B97FFC11 for ; Mon, 15 Sep 2014 14:44:38 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id la4so3508712vcb.36 for ; Mon, 15 Sep 2014 07:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=xHRHj2DVlv5keevHEKY6NC/9519YXFHuGd650RrMFYA=; b=joLagbM75zP/Vgo/s0GalpuuV8oNsAFWPAtjxhM8baTMKhOlCaXvZ7BZ07ub+H+fZH KBsY+drgum78i/fMjX2ECq0ACbCqmr/LFDXyjJRaFF04Fo+lt5IbpArydzfO5tZ008hn AziHfiBRc9tnSzMvgI7U7jD8XZ2YnY9VJRpoYpbpzZZ/vB5rdePqkXSQrQUzJRgo4q7t Eo+ZevuFP/vfL2nFatKK83OQtrJiGUmiiwAQj7BTkAzK0Zu2lTA6QL8M6Zj84uLLB50W JZox8Z8buyXaaJATubl7DmK69v0zPtyE8PHLj6t2FPZkfSFIF8S64CRpQzTrdLRUfOjL fnmA== MIME-Version: 1.0 X-Received: by 10.52.33.231 with SMTP id u7mr19909972vdi.54.1410792277802; Mon, 15 Sep 2014 07:44:37 -0700 (PDT) Received: by 10.220.222.208 with HTTP; Mon, 15 Sep 2014 07:44:37 -0700 (PDT) Date: Mon, 15 Sep 2014 22:44:37 +0800 Message-ID: Subject: Is this a netmap bug? From: To: freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Sep 2014 14:44:39 -0000 Hi, I wrote a very simple netmap program on FreeBSD 10, run one or more times, kernel crashed. Kernel configuration is GENERIC, only added netmap. The host is VM, running in vmplayer, one nic. How to repeat: 1. log into the system via ssh 2. run one or more times the program in the terminal. Is it a bug? core.txt.0 ---------------------------------------------------------------------------------- bsd10 dumped core - see /var/crash/vmcore.0 Sun Sep 14 05:37:38 CST 2014 FreeBSD bsd10 10.0-RELEASE FreeBSD 10.0-RELEASE #0: Thu Sep 11 02:30:51 CST 2014 root@bsd10:/usr/obj/usr/src/sys/GENERIC amd64 panic: page fault GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "amd64-marcel-freebsd"... Unread portion of the kernel message buffer: Fatal trap 12: page fault while in kernel mode cpuid = 0; apic id = 00 fault virtual address = 0x30 fault code = supervisor read data, page not present instruction pointer = 0x20:0xffffffff80615062 stack pointer = 0x28:0xfffffe00002a5470 frame pointer = 0x28:0xfffffe00002a5520 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 2238 (sshd) trap number = 12 panic: page fault cpuid = 0 KDB: stack backtrace: #0 0xffffffff808f5870 at kdb_backtrace+0x60 #1 0xffffffff808bd355 at panic+0x155 #2 0xffffffff80c9c132 at trap_fatal+0x3a2 #3 0xffffffff80c9c409 at trap_pfault+0x2c9 #4 0xffffffff80c9bb96 at trap+0x5e6 #5 0xffffffff80c82e32 at calltrap+0x8 #6 0xffffffff80979cce at ether_output+0x59e #7 0xffffffff809e48d4 at ip_output+0xf14 #8 0xffffffff80a4db74 at tcp_output+0x1684 #9 0xffffffff80a58f31 at tcp_usr_send+0x3c1 #10 0xffffffff8092e135 at sosend_generic+0x465 #11 0xffffffff809135d9 at soo_write+0x49 #12 0xffffffff8090b35a at dofilewrite+0x8a #13 0xffffffff8090b085 at kern_writev+0x65 #14 0xffffffff8090b013 at sys_write+0x63 #15 0xffffffff80c9ca27 at amd64_syscall+0x357 #16 0xffffffff80c8311b at Xfast_syscall+0xfb Uptime: 9h6m25s Dumping 586 out of 2025 MB:..3%..11%..22%..31%..41%..52%..61%..71%..82%..91% Reading symbols from /boot/kernel/uhid.ko.symbols...done. Loaded symbols for /boot/kernel/uhid.ko.symbols #0 doadump (textdump=) at pcpu.h:219 219 pcpu.h: No such file or directory. in pcpu.h (kgdb) #0 doadump (textdump=) at pcpu.h:219 #1 0xffffffff808bcfd0 in kern_reboot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:447 #2 0xffffffff808bd394 in panic (fmt=) at /usr/src/sys/kern/kern_shutdown.c:754 #3 0xffffffff80c9c132 in trap_fatal (frame=, eva=) at /usr/src/sys/amd64/amd64/trap.c:882 #4 0xffffffff80c9c409 in trap_pfault (frame=0xfffffe00002a53c0, usermode=0) at /usr/src/sys/amd64/amd64/trap.c:699 #5 0xffffffff80c9bb96 in trap (frame=0xfffffe00002a53c0) at /usr/src/sys/amd64/amd64/trap.c:463 #6 0xffffffff80c82e32 in calltrap () at /usr/src/sys/amd64/amd64/exception.S:232 #7 0xffffffff80615062 in netmap_start (ifp=0xfffff800027d8800, m=0xfffff80037766c00) at /usr/src/sys/dev/netmap/netmap.c:2346 #8 0xffffffff80979cce in ether_output (ifp=0xfffff800027d8800, m=0xfffff80037766c00, dst=0xfffffe00002a5774, ro=) at /usr/src/sys/net/if_ethersubr.c:437 #9 0xffffffff809e48d4 in ip_output (m=0xfffff80037766c00, opt=, flags=, imo=, inp=0xfffff80002f76188) at /usr/src/sys/netinet/ip_output.c:635 #10 0xffffffff80a4db74 in tcp_output (tp=0xfffff80002e68c00) at /usr/src/sys/netinet/tcp_output.c:1231 #11 0xffffffff80a58f31 in tcp_usr_send (so=, flags=0, m=0xfffff80002f73400, nam=, control=, td=) at /usr/src/sys/netinet/tcp_usrreq.c:872 #12 0xffffffff8092e135 in sosend_generic (so=0xfffff80002d20000, addr=0x0, uio=0xfffffe00002a5ab0, top=, control=, flags=, td=) at /usr/src/sys/kern/uipc_socket.c:1271 #13 0xffffffff809135d9 in soo_write (fp=, uio=0xfffffe00002a5ab0, active_cred=, flags=, td=) at /usr/src/sys/kern/sys_socket.c:103 #14 0xffffffff8090b35a in dofilewrite (td=0xfffff80037650490, fd=3, fp=0xfffff80002c2a500, auio=0xfffffe00002a5ab0, offset=, flags=0) at file.h:303 #15 0xffffffff8090b085 in kern_writev (td=0xfffff80037650490, fd=3, auio=0xfffffe00002a5ab0) at /usr/src/sys/kern/sys_generic.c:467 #16 0xffffffff8090b013 in sys_write (td=, uap=) at /usr/src/sys/kern/sys_generic.c:382 #17 0xffffffff80c9ca27 in amd64_syscall (td=0xfffff80037650490, traced=0) at subr_syscall.c:134 #18 0xffffffff80c8311b in Xfast_syscall () at /usr/src/sys/amd64/amd64/exception.S:391 #19 0x000000080320f0ca in ?? () Previous frame inner to this frame (corrupt stack?) Current language: auto; currently minimal (kgdb) ------------------------------------------------------------------------------------- program: ------------------------------------------------------------------------------------- mmap_size = nmr.nr_memsize; mmap_addr = mmap(0, mmap_size, PROT_WRITE | PROT_READ, MAP_SHARED, fd_netmap, 0); if (mmap_addr == MAP_FAILED) { printf("Can't map %s ring.\n", txifn); return 1; } nmr.nr_version = NETMAP_API; if (ioctl(fd_netmap, NIOCREGIF, &nmr) == -1) { printf("Can't register %s ring.\n", txifn); } printf("go on ......\n"); /* kernel will not crash if sleep for a while */ //sleep(4); munmap(mmap_addr, mmap_size); close(fd_netmap); ----------------------------------------------------------------------------------------------- Thank you, Paul