Date: Thu, 28 Jan 2016 23:26:32 +0200 From: Guy Yur <guyyur@gmail.com> To: Jov <amutu@amutu.com> Cc: Ian Lepore <ian@freebsd.org>, freebsd-arm <freebsd-arm@freebsd.org> Subject: Re: [Bug 206658] Bus error for pfctl -sa on rpi2 r294499 snap Message-ID: <CAC67Hz8Oxzi_NqKP2ORx2u9GxgXio8ckbrmqh82DCDR38AQ_fw@mail.gmail.com> In-Reply-To: <CADyrUxPhubhCi6MPBO4eX4WEXCxbMvcz9ZJEzt36azw6dcH8eA@mail.gmail.com> References: <bug-206658-7@https.bugs.freebsd.org/bugzilla/> <1453862939.42081.25.camel@freebsd.org> <CADyrUxPcndOaeUn_UcDN4F=N5XHsby-wQmLvRfUcYNTjNJPUiQ@mail.gmail.com> <1453867724.42081.28.camel@freebsd.org> <CADyrUxO-X3f6gXDHSKZ1Xy5PFxtZrsM0kiJrnN5MPhaAC5MZkA@mail.gmail.com> <1453903433.42081.30.camel@freebsd.org> <CADyrUxPhubhCi6MPBO4eX4WEXCxbMvcz9ZJEzt36azw6dcH8eA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, On Thu, Jan 28, 2016 at 2:06 PM, Jov <amutu@amutu.com> wrote: > bus error at the similar position: > > Program received signal SIGBUS, Bus error. > 0x00021614 in print_host (addr=0x2065111a, port=15268, af=2 '\002', > opts=1024) at /usr/src/sbin/pfctl/pf_print_state.c:178 > warning: Source file is more recent than executable. > > 178 memcpy(&aw.v.a.addr, addr, sizeof(aw.v.a.addr)); > Current language: auto; currently minimal > (gdb) p addr > $1 = (struct pf_addr *) 0x2065111a > ... > > Jov The compiler optimizes the memcpy to a series of ldr and str instructions and since addr is unaligned you still get SIGBUS. I encountered the same problem on a BeagleBone Black. https://lists.freebsd.org/pipermail/freebsd-arm/2014-January/007237.html non-intrustive patch with changes only in print_state() pfsync_state is __packed so the keys can be copied safely to stack variables which will be aligned (and addr inside it). https://github.com/guyyur/freebsd-src_patches/blob/master/pfctl_arm_segbus__ver1_part1.patch Bug report with patch to separate pfsync and pfioc state structures but breaks backward compatibility: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=185617 -- Guy
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAC67Hz8Oxzi_NqKP2ORx2u9GxgXio8ckbrmqh82DCDR38AQ_fw>