10.0-RC1, armv6: "pfctl -s state" crashes on BeagleBone Black due to unaligned access

Guy Yur guyyur at gmail.com
Thu Jan 9 23:04:58 UTC 2014


On Fri, Jan 10, 2014 at 12:26 AM, John-Mark Gurney <jmg at funkthat.com> wrote:
> Guy Yur wrote this message on Fri, Jan 10, 2014 at 00:17 +0200:
>> On Thu, Jan 9, 2014 at 12:42 PM, Gleb Smirnoff <glebius at freebsd.org> wrote:
>> >   Guy,
>> >
>> > On Sat, Jan 04, 2014 at 03:06:02PM +0200, Guy Yur wrote:
>> > G> I am running 10.0-RC1 arm.armv6 on the BeagleBone Black.
>> > G> The "pfctl -s state" command is crashing when trying to print the
>> > G> second entry.
>>

> Ok, that makes sense...  so, either we mark struct pf_addr as __packed,
> or we do some nasty stuff, like the following in print_host:
> struct {
>         struct pf_addr a
> } *uaddr __packed;
>
> uaddr = addr;
> aw.v.a.addr = uaddr->a;
>
> it's not pretty, but I believe it would work...
>
> --
>   John-Mark Gurney                              Voice: +1 415 225 5579
>
>      "All that I will do, has been done, All that I have, has not."

For performance reasons, I don't think pf_addr should be marked as __packed.

I attached the changes I am now using in print_state() since there is
no need to copy
the full pfsync_state, only pf_addr.
I converted sk and nk from pointers to structs on the stack and using
struct copy.
pf_addr is 16 bytes.


Regards,
Guy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pf_print_state.patch
Type: application/octet-stream
Size: 2248 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20140110/8f109b14/attachment.obj>


More information about the freebsd-net mailing list