Date: Sat, 4 Jan 2014 09:50:26 -0700 From: Warner Losh <imp@bsdimp.com> To: Guy Yur <guyyur@gmail.com> Cc: freebsd-net@freebsd.org, freebsd-arm@freebsd.org Subject: Re: 10.0-RC1, armv6: "pfctl -s state" crashes on BeagleBone Black due to unaligned access Message-ID: <E4255780-6E58-435D-BDE6-491915B642CF@bsdimp.com> In-Reply-To: <CAC67Hz_QXcHHSFOLLgUGqLWRQpzhRRv_b%2BWGMMQsfk-VQp74RA@mail.gmail.com> References: <CAC67Hz_QXcHHSFOLLgUGqLWRQpzhRRv_b%2BWGMMQsfk-VQp74RA@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
I think this was changed in later RC versions. Warner On Jan 4, 2014, at 6:06 AM, Guy Yur wrote: > Hi, > > I am running 10.0-RC1 arm.armv6 on the BeagleBone Black. > The "pfctl -s state" command is crashing when trying to print the > second entry. > > struct pfsync_state has a size that is not divisiable by 4 or 8 leading to the > second entry in the returned state array not being aligned and pfctl > core dumps on Bus error when trying to access a uint32_t field. > > (gdb) bt > #0 print_host (addr=0x2085a11a, port=7660, af=2 '\002', opts=1024) at > /usr/src/sbin/pfctl/pf_print_state.c:178 > #1 0x00021c4c in print_state (s=0x2085a0f2, opts=1024) at > /usr/src/sbin/pfctl/pf_print_state.c:236 > #2 0x0000c664 in pfctl_show_states (dev=<value optimized out>, > iface=0x0, opts=1024) at /usr/src/sbin/pfctl/pfctl.c:1095 > > sizeof(struct pfsync_state_key) is 36 > sizeof(struct pfsync_state_peer) is 32 > sizeof(struct pf_addr) is 16 > sizeof(struct pfsync_state) is 242 > > Removing the __spare[2] field will allow the struct to be aligned on 8 bytes > for the u_int64_t id field and also cover the uint32_t fields alignment > but this will break KBI. > > I am currently using an inefficient workaround in pfctl_show_states > that memcpy each entry to a struct pfsync_state on the stack > ensuring each call to print_state receives an aligned struct. > > > 10.0-RC1 World and kernel were compiled in a VirtualBox VM running > 9.2-RELEASE-p2 i386. > clang and ARM_EABI used as the default make options. > > > Regards, > Guy > _______________________________________________ > freebsd-arm@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E4255780-6E58-435D-BDE6-491915B642CF>
