Date: Sun, 1 Jun 2003 15:00:09 +0200 From: Bernd Walter <ticso@cicely12.cicely.de> To: Luigi Rizzo <rizzo@icir.org> Cc: current@freebsd.org Subject: Re: 5.1-RELEASE TODO Message-ID: <20030601130008.GA527@cicely12.cicely.de> In-Reply-To: <20030601022633.A4287@xorpc.icir.org> References: <3ED94166.7070300@btc.adaptec.com> <Pine.NEB.3.96L.1030531201712.3370J-100000@fledge.watson.org> <20030531173958.C91048@xorpc.icir.org> <20030601013256.GH503@cicely12.cicely.de> <20030601022633.A4287@xorpc.icir.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 01, 2003 at 02:26:34AM -0700, Luigi Rizzo wrote: > On Sun, Jun 01, 2003 at 03:32:56AM +0200, Bernd Walter wrote: > ... > > :) > > And I hoped a programmer who knows the source could find out and fix > > very quickly. > > sorry, i missed the offending line number in your previous email. > > I think i missed a & in all the first arguments to bcopy in > the src/sbin/ipfw2.c changes :( > > this happens at lines 818, 1224, 1461 and 1701. Fortunately > the kernel part seems correct. > > In detail, the fix should be the following: > > 818: > - bcopy(rule->next_rule, &set_disable, sizeof(set_disable)); > + bcopy(&rule->next_rule, &set_disable, sizeof(set_disable)); > > 1224: > - bcopy(d->rule, &rulenum, sizeof(rulenum)); > + bcopy(&d->rule, &rulenum, sizeof(rulenum)); > > 1461: > - bcopy(((struct ip_fw *)data)->next_rule, > + bcopy(&((struct ip_fw *)data)->next_rule, > > 1701: > - bcopy(d->rule, &rulenum, sizeof(rulenum)); > + bcopy(&d->rule, &rulenum, sizeof(rulenum)); Look way bettter now :) I wasn't able to crash the kernel with missaligned access any more, but the userland tool still does in some situations: [59]cicely12# ipfw show pid 2121 (ipfw): unaligned access: va=0x1200ac09c pc=0x120003bb4 ra=0x120003bfc op=ldq pid 2121 (ipfw): unaligned access: va=0x1200ac0a4 pc=0x120003bdc ra=0x120003bc8 op=ldq 00100 5237 824333 allow tcp from any to any dst-port 1-65535,1-65535 00200 0 0 allow tcp from any to any dst-port 1-65535,1-65535,1-65535 pid 2121 (ipfw): unaligned access: va=0x1200ac09c pc=0x120002260 ra=0x1200015ec op=ldq pid 2121 (ipfw): unaligned access: va=0x1200ac0a4 pc=0x120002264 ra=0x1200015ec op=ldq 65535 5836817 1002036976 allow ip from any to any [64]cicely12# sysctl machdep.unaligned_sigbus=1 machdep.unaligned_sigbus: 0 -> 1 [65]cicely12# ipfw show pid 2146 (ipfw): unaligned access: va=0x1200ac09c pc=0x120003bb4 ra=0x120003bfc op=ldq Bus error (core dumped) Exit 138 [66]cicely12# gdb ./ipfw ipfw.core GNU gdb 5.2.1 (FreeBSD) Copyright 2002 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 "alpha-undermydesk-freebsd"... Core was generated by `ipfw'. Program terminated with signal 10, Bus error. #0 0x120003bb4 in list (ac=0, av=0x11fff720) at ipfw2.c:1629 1629 width = snprintf(NULL, 0, "%llu", r->pcnt); (gdb) bt #0 0x120003bb4 in list (ac=0, av=0x11fff720) at ipfw2.c:1629 #1 0x120007d10 in ipfw_main (ac=1, av=0x11fff718) at ipfw2.c:3486 #2 0x1200084bc in main (ac=2, av=0x11fff710) at ipfw2.c:3637 -- B.Walter BWCT http://www.bwct.de ticso@bwct.de info@bwct.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030601130008.GA527>