Summary: | Bus error for pfctl -sa on rpi2 r294499 snap | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Jov <amutu> | ||||||
Component: | arm | Assignee: | Ian Lepore <ian> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | ian | ||||||
Priority: | --- | Keywords: | patch | ||||||
Version: | CURRENT | ||||||||
Hardware: | arm | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
Jov
2016-01-27 02:24:28 UTC
Created attachment 166167 [details]
patch for unaligned struct copy
Can you please try this patch? I have no way of testing it myself.
Created attachment 166309 [details] Patch submitted by guyyur@gmail.com via https://github.com/guyyur/freebsd-src_patches/blob/master/pfctl_arm_segbus__ver1_part1.patch The original patch I submitted failed to fix the problem due to clang's inlining of memcpy leading to essentially identical code as the struct-assignment code that failed originally. The changes that should have allowed that to work (such as casting away the alignment by casting the pointer to void* or char* in the memcpy() call, or tagging the pointer argument with __attribute__((aligned_value(1))) failed, apparently due to clang bugs. Guy Yur <guyyur@gmail.com> pointed out related PR 185617 and submitted a patch he uses to work around the problem, which I've now attached to this PR for completeness. I intend to commit something very close to this patch, with some changes to make it similar to the way the same problem was solved in the kernel pf code (conditional on __NO_STRICT_ALIGNMENT). A commit references this bug: Author: ian Date: Sat Jan 30 22:03:15 UTC 2016 New revision: 295086 URL: https://svnweb.freebsd.org/changeset/base/295086 Log: Make pfctl(8) work on strict-alignment platforms, by copying a pair of embedded structures out of a packed, unaligned struct into local copies on the stack which are aligned. The original patch to do this was submitted by Guy Yur <guyyur@gmail.com>, and this is conceptually the same change, but restructured with the #ifndef __NO_STRICT_ALIGNMENT wrapper, similar to how the same issue is handled in the kernel pf code. PR: 185617 PR: 206658 Changes: head/sbin/pfctl/pf_print_state.c |