mpd does not work on FreeBSD/sparc64. Kernel panic with "memory address not aligned" trap message. Fix: Unknown. netgraph(4) on sparc64 is totally broken? How-To-Repeat: Configure and run mpd for VPN over pptp. After connect to VPN, start nmap scanner. Kernel right away crashed. I have coredump: root@bel# gdb53 -k /usr/obj/usr/src/sys/SUNC3D/kernel.debug vmcore.12 GNU gdb 5.3 (FreeBSD) [...] panic: trap: memory address not aligned panic messages: --- panic: trap: memory address not aligned cpuid = 0 KDB: enter: panic panic: from debugger cpuid = 0 boot() called on cpu#0 Uptime: 4m16s Dumping 1024 MB (2 chunks) chunk at 0x80000000: 536870912 bytes --- #0 doadump () at /usr/src/sys/kern/kern_shutdown.c:246 246 savectx(&dumppcb); (kgdb) bt #0 doadump () at /usr/src/sys/kern/kern_shutdown.c:246 #1 0x00000000c01642d8 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:409 #2 0x00000000c0164be4 in panic (fmt=0xc038edc8 "from debugger") at /usr/src/sys/kern/kern_shutdown.c:565 #3 0x00000000c0065ae8 in db_panic (addr=3222812472, have_addr=0, count=-1, modif=0xe002e950 "") at /usr/src/sys/ddb/db_command.c:435 #4 0x00000000c0065c24 in db_command_loop () at /usr/src/sys/ddb/db_command.c:349 #5 0x00000000c00686a8 in db_trap (type=107, code=0) at /usr/src/sys/ddb/db_main.c:210 #6 0x00000000c0183d28 in kdb_trap (type=107, code=0, tf=0x1) at /usr/src/sys/kern/subr_kdb.c:418 #7 0x00000000c0304aa4 in trap (tf=0xe002ed20) at /usr/src/sys/sparc64/sparc64/trap.c:307 #8 0x00000000c0183738 in kdb_enter (msg=---Can't read userspace from dump, or kernel process--- ) at /usr/src/sys/kern/subr_kdb.c:238 #9 0x00000000c0183730 in kdb_enter (msg=0xc03a60d0 "panic") at /usr/src/sys/kern/subr_kdb.c:238 #10 0x00000000c0164c54 in panic (fmt=0xc03beb88 "trap: %s") at atomic.h:278 #11 0x00000000c03049bc in trap (tf=0xe002f120) at /usr/src/sys/sparc64/sparc64/trap.c:369 #12 0x00000000c020f1cc in tcp_input (m=0xfffff800a9760f00, off0=40) at /usr/src/sys/netinet/tcp_input.c:536 ---Type <return> to continue, or q <return> to quit--- #13 0x00000000c020f1b8 in tcp_input (m=0xfffff800a9760f00, off0=20) at /usr/src/sys/netinet/tcp_input.c:533 #14 0x00000000c0205af0 in ip_input (m=0xfffff800a9760f00) at /usr/src/sys/netinet/ip_input.c:776 #15 0x00000000c01f039c in netisr_processqueue (ni=0xc0424350) at /usr/src/sys/net/netisr.c:233 #16 0x00000000c01f0714 in swi_net (dummy=0x0) at atomic.h:278 #17 0x00000000c014bb84 in ithread_loop (arg=0xfffff8008042f700) at /usr/src/sys/kern/kern_intr.c:547 #18 0x00000000c014a448 in fork_exit (callout=0xc014ba60 <ithread_loop>, arg=0xfffff8008042f700, frame=0xe002f880) at /usr/src/sys/kern/kern_fork.c:790 (kgdb) frame 14 #14 0x00000000c0205af0 in ip_input (m=0xfffff800a9760f00) at /usr/src/sys/netinet/ip_input.c:776 776 (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen); (kgdb) p ip $1 = (struct ip *) 0xfffff800a915b035 (kgdb) p ip[0] $2 = {ip_v = 0, ip_hl = 0, ip_tos = 0 '\0', ip_len = 0, ip_id = 0, ip_off = 0, ip_ttl = 0 '\0', ip_p = 6 '\006', ip_sum = 28984, ip_src = { s_addr = 167772161}, ip_dst = {s_addr = 168430081}}
FreeBSD-8 with mpd-5.1 still panics on sun4u (Netra X1). Coredump and server access available on request. FreeBSD 8.0-STABLE #5: Fri Mar 19 09:23:54 MSK 2010 root@netra-x1.*****.ru:/usr/obj/usr/src/sys/MOKR-S64 sparc64 # kldstat Id Refs Address Size Name 1 37 0xc0000000 7455d8 kernel 2 3 0xc0746000 1554a0 usb.ko 3 1 0xc089c000 117448 ohci.ko 4 1 0xc09b4000 120708 ehci.ko 5 1 0xc0ad6000 17d6d0 ipl.ko 6 1 0xc1314000 2a8000 zfs.ko 7 1 0xc15bc000 122000 krpc.ko 8 1 0xc16e2000 104000 opensolaris.ko 9 1 0xc1e1c000 108000 if_vlan.ko 10 1 0xc1f24000 106000 ng_socket.ko 11 3 0xc202a000 116000 netgraph.ko 12 1 0xc2144000 104000 ng_mppc.ko 13 1 0xc2248000 102000 rc4.ko 14 1 0xc238c000 108000 ng_ksocket.ko Mar 24 20:01:12 netra-x1 mpd: [L-1] LCP: SendConfigReq #3 Mar 24 20:01:12 netra-x1 mpd: [L-1] ACFCOMP Mar 24 20:01:12 netra-x1 mpd: [L-1] PROTOCOMP Mar 24 20:01:12 netra-x1 mpd: [L-1] MRU 1500 Mar 24 20:01:12 netra-x1 mpd: [L-1] MAGICNUM e361cfb8 Mar 24 20:01:12 netra-x1 mpd: [L-1] AUTHPROTO CHAP MSOFTv2 Mar 24 20:01:12 net panic: trap: memory address not aligned cpuid = 0 KDB: stack backtrace: panic() at 0xc01ce588 = panic+0x1c8 trap() at 0xc046da10 = trap+0x4d0 -- memory address not aligned sfar=0xfffff800011fad8e sfsr=0x4002d %o7=0xc02cdd58 -- rip_output() at 0xc02cdb44 = rip_output+0x124 rip_send() at 0xc02cddec = rip_send+0x4c sosend_generic() at 0xc0249164 = sosend_generic+0x5e4 sosend() at 0xc0245a4c = sosend+0x2c ng_ksocket_rcvdata() at 0xc2390218 = ng_ksocket_rcvdata+0xb8 ng_apply_item() at 0xc2037ff0 = ng_apply_item+0x250 ngthread() at 0xc203944c = ngthread+0x16c fork_exit() at 0xc0197510 = fork_exit+0xd0 fork_trampoline() at 0xc00891e8 = fork_trampoline+0x8 Uptime: 7m39s Dumping 2048 MB (4 chunks) chunk at 0: 536870912 bytes ... ok chunk at 0x20000000: 536870912 bytes ... ok chunk at 0x40000000: 536870912 bytes ... ok chunk at 0x60000000: 536870912 bytes ... ok Dump complete Automatic reboot in 15 seconds - press a key on the console to abort
State Changed From-To: open->feedback Can you please merge the revision 1.57 of src/sys/netgraph/ng_ksocket.c into your kernel and try to reproduce the problem.
State Changed From-To: feedback->closed Feedback timeout (> 1 month).
State Changed From-To: closed->open From email from Marius Strobl: Actually there was feedback, it just didn't make it into GNATS: http://lists.freebsd.org/pipermail/freebsd-sparc64/2005-October/003509.html [quoting: This revision does not resolve problem. The problem is sparc specific. i386 has no alignment constraints (a small speed hit though).] http://www.freebsd.org/cgi/query-pr.cgi?pr=80410
On Wed, Mar 24, 2010 at 05:30:05PM +0000, Sergey Mokryshev wrote: > The following reply was made to PR sparc64/80410; it has been noted by GNATS. > > From: "Sergey Mokryshev" <mokr@mokr.net> > To: <bug-followup@FreeBSD.org>, <bel@orel.ru> > Cc: > Subject: Re: sparc64/80410: [netgraph] netgraph is causing crash with mpd on sparc64 > Date: Wed, 24 Mar 2010 20:07:47 +0300 > > FreeBSD-8 with mpd-5.1 still panics on sun4u (Netra X1). > Coredump and server access available on request. > > FreeBSD 8.0-STABLE #5: Fri Mar 19 09:23:54 MSK 2010 > root@netra-x1.*****.ru:/usr/obj/usr/src/sys/MOKR-S64 sparc64 > > # kldstat > Id Refs Address Size Name > 1 37 0xc0000000 7455d8 kernel > 2 3 0xc0746000 1554a0 usb.ko > 3 1 0xc089c000 117448 ohci.ko > 4 1 0xc09b4000 120708 ehci.ko > 5 1 0xc0ad6000 17d6d0 ipl.ko > 6 1 0xc1314000 2a8000 zfs.ko > 7 1 0xc15bc000 122000 krpc.ko > 8 1 0xc16e2000 104000 opensolaris.ko > 9 1 0xc1e1c000 108000 if_vlan.ko > 10 1 0xc1f24000 106000 ng_socket.ko > 11 3 0xc202a000 116000 netgraph.ko > 12 1 0xc2144000 104000 ng_mppc.ko > 13 1 0xc2248000 102000 rc4.ko > 14 1 0xc238c000 108000 ng_ksocket.ko > > > Mar 24 20:01:12 netra-x1 mpd: [L-1] LCP: SendConfigReq #3 > Mar 24 20:01:12 netra-x1 mpd: [L-1] ACFCOMP > Mar 24 20:01:12 netra-x1 mpd: [L-1] PROTOCOMP > Mar 24 20:01:12 netra-x1 mpd: [L-1] MRU 1500 > Mar 24 20:01:12 netra-x1 mpd: [L-1] MAGICNUM e361cfb8 > Mar 24 20:01:12 netra-x1 mpd: [L-1] AUTHPROTO CHAP MSOFTv2 > Mar 24 20:01:12 net > panic: trap: memory address not aligned > cpuid = 0 > KDB: stack backtrace: > panic() at 0xc01ce588 = panic+0x1c8 > trap() at 0xc046da10 = trap+0x4d0 > -- memory address not aligned sfar=0xfffff800011fad8e sfsr=0x4002d > %o7=0xc02cdd58 -- > rip_output() at 0xc02cdb44 = rip_output+0x124 > rip_send() at 0xc02cddec = rip_send+0x4c > sosend_generic() at 0xc0249164 = sosend_generic+0x5e4 > sosend() at 0xc0245a4c = sosend+0x2c > ng_ksocket_rcvdata() at 0xc2390218 = ng_ksocket_rcvdata+0xb8 > ng_apply_item() at 0xc2037ff0 = ng_apply_item+0x250 > ngthread() at 0xc203944c = ngthread+0x16c > fork_exit() at 0xc0197510 = fork_exit+0xd0 > fork_trampoline() at 0xc00891e8 = fork_trampoline+0x8 This is a bit of a blind shot due to insufficient debugging information but could you please give the following patch a try: http://people.freebsd.org/~marius/raw_ip_alignment.diff Note that this backtrace is different from the one originally reported in this PR, i.e. is caused by a different problem. Marius
Author: mav Date: Wed Mar 31 20:37:44 2010 New Revision: 206000 URL: http://svn.freebsd.org/changeset/base/206000 Log: Make ng_ppp fulfill upper protocol stack layers alignment requirements on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410 Modified: head/sys/netgraph/ng_ppp.c Modified: head/sys/netgraph/ng_ppp.c ============================================================================== --- head/sys/netgraph/ng_ppp.c Wed Mar 31 20:15:20 2010 (r205999) +++ head/sys/netgraph/ng_ppp.c Wed Mar 31 20:37:44 2010 (r206000) @@ -907,7 +907,21 @@ ng_ppp_proto_recv(node_p node, item_p it const priv_p priv = NG_NODE_PRIVATE(node); hook_p outHook = NULL; int error; +#ifdef ALIGNED_POINTER + struct mbuf *m, *n; + NGI_GET_M(item, m); + if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) { + n = m_defrag(m, M_NOWAIT); + if (n == NULL) { + m_freem(m); + NG_FREE_ITEM(item); + return (ENOBUFS); + } + m = n; + } + NGI_M(item) = m; +#endif /* ALIGNED_POINTER */ switch (proto) { case PROT_IP: if (priv->conf.enableIP) _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Author: mav Date: Wed Mar 31 22:16:05 2010 New Revision: 206017 URL: http://svn.freebsd.org/changeset/base/206017 Log: Make ng_ksocket fulfill lower protocol stack layers alignment requirements on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410 Modified: head/sys/netgraph/ng_ksocket.c Modified: head/sys/netgraph/ng_ksocket.c ============================================================================== --- head/sys/netgraph/ng_ksocket.c Wed Mar 31 22:11:19 2010 (r206016) +++ head/sys/netgraph/ng_ksocket.c Wed Mar 31 22:16:05 2010 (r206017) @@ -902,12 +902,24 @@ ng_ksocket_rcvdata(hook_p hook, item_p i struct sockaddr *sa = NULL; int error; struct mbuf *m; +#ifdef ALIGNED_POINTER + struct mbuf *n; +#endif /* ALIGNED_POINTER */ struct sa_tag *stag; /* Extract data */ NGI_GET_M(item, m); NG_FREE_ITEM(item); - +#ifdef ALIGNED_POINTER + if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) { + n = m_defrag(m, M_NOWAIT); + if (n == NULL) { + m_freem(m); + return (ENOBUFS); + } + m = n; + } +#endif /* ALIGNED_POINTER */ /* * Look if socket address is stored in packet tags. * If sockaddr is ours, or provided by a third party (zero id), _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
State Changed From-To: open->patched Several related patches committed to HEAD.
Responsible Changed From-To: freebsd-sparc64->mav I'll track it.
Author: mav Date: Thu Apr 15 12:38:55 2010 New Revision: 206657 URL: http://svn.freebsd.org/changeset/base/206657 Log: NFC r206000: Make ng_ppp fulfill upper protocol stack layers alignment requirements on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410, sparc/118932, sparc/113556 Modified: stable/8/sys/netgraph/ng_ppp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netgraph/ng_ppp.c ============================================================================== --- stable/8/sys/netgraph/ng_ppp.c Thu Apr 15 12:30:46 2010 (r206656) +++ stable/8/sys/netgraph/ng_ppp.c Thu Apr 15 12:38:55 2010 (r206657) @@ -907,7 +907,21 @@ ng_ppp_proto_recv(node_p node, item_p it const priv_p priv = NG_NODE_PRIVATE(node); hook_p outHook = NULL; int error; +#ifdef ALIGNED_POINTER + struct mbuf *m, *n; + NGI_GET_M(item, m); + if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) { + n = m_defrag(m, M_NOWAIT); + if (n == NULL) { + m_freem(m); + NG_FREE_ITEM(item); + return (ENOBUFS); + } + m = n; + } + NGI_M(item) = m; +#endif /* ALIGNED_POINTER */ switch (proto) { case PROT_IP: if (priv->conf.enableIP) _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Author: mav Date: Thu Apr 15 12:41:36 2010 New Revision: 206660 URL: http://svn.freebsd.org/changeset/base/206660 Log: MFC r206017: Make ng_ksocket fulfill lower protocol stack layers alignment requirements on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410, sparc/118932, sparc/113556 Modified: stable/8/sys/netgraph/ng_ksocket.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/netgraph/ng_ksocket.c ============================================================================== --- stable/8/sys/netgraph/ng_ksocket.c Thu Apr 15 12:40:33 2010 (r206659) +++ stable/8/sys/netgraph/ng_ksocket.c Thu Apr 15 12:41:36 2010 (r206660) @@ -902,12 +902,24 @@ ng_ksocket_rcvdata(hook_p hook, item_p i struct sockaddr *sa = NULL; int error; struct mbuf *m; +#ifdef ALIGNED_POINTER + struct mbuf *n; +#endif /* ALIGNED_POINTER */ struct sa_tag *stag; /* Extract data */ NGI_GET_M(item, m); NG_FREE_ITEM(item); - +#ifdef ALIGNED_POINTER + if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) { + n = m_defrag(m, M_NOWAIT); + if (n == NULL) { + m_freem(m); + return (ENOBUFS); + } + m = n; + } +#endif /* ALIGNED_POINTER */ /* * Look if socket address is stored in packet tags. * If sockaddr is ours, or provided by a third party (zero id), _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
State Changed From-To: patched->closed Patches merged to 8-STABLE.