From owner-freebsd-arm@freebsd.org Wed Jan 27 02:49:08 2016 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71693A6F1E6 for ; Wed, 27 Jan 2016 02:49:08 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DC211D67 for ; Wed, 27 Jan 2016 02:49:07 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA for ; Wed, 27 Jan 2016 02:49:50 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u0R2mxWV029712 for ; Tue, 26 Jan 2016 19:48:59 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1453862939.42081.25.camel@freebsd.org> Subject: Re: [Bug 206658] Bus error for pfctl -sa on rpi2 r294499 snap From: Ian Lepore To: freebsd-arm@FreeBSD.org Date: Tue, 26 Jan 2016 19:48:59 -0700 In-Reply-To: References: Content-Type: multipart/mixed; boundary="=-Ei9OoJNugQzvnRVpRbht" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jan 2016 02:49:08 -0000 --=-Ei9OoJNugQzvnRVpRbht Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Wed, 2016-01-27 at 02:24 +0000, bugzilla-noreply@freebsd.org wrote: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206658 > > Bug ID: 206658 > Summary: Bus error for pfctl -sa on rpi2 r294499 snap > Product: Base System > Version: 11.0-CURRENT > Hardware: arm > OS: Any > Status: New > Severity: Affects Only Me > Priority: --- > Component: arm > Assignee: freebsd-arm@FreeBSD.org > Reporter: amutu@amutu.com > > uname -a: > FreeBSD p2 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r294499: Fri Jan 22 > 01:49:44 > UTC 2016 root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/ > sys/RPI2 > arm > > gdb: > .... > pass in log quick on wlan0 inet proto tcp from any to (wlan0) port = > 3333 flags > S/SA keep state (source-track rule, max-src-conn 5, max-src-conn-rate > 3/30, > overload flush global, src.track 30) > pass in log quick on wlan0 inet proto tcp from any to (wlan0) port = > 3333 flags > S/SA keep state (source-track rule, max-src-conn 5, max-src-conn-rate > 3/30, > overload flush global, src.track 30) > > STATES: > all tcp 192.168.1.114:48865 -> 103.138.240.229:37005 > TIME_WAIT:TIME_WAIT > > Program received signal SIGBUS, Bus error. > 0x00021614 in print_host (addr=0x2065113e, port=45235, af=2 '\002', > opts=1024) > at /usr/src/sbin/pfctl/pf_print_state.c:178 > 178 /usr/src/sbin/pfctl/pf_print_state.c: No such file or > directory. > in /usr/src/sbin/pfctl/pf_print_state.c > Current language: auto; currently minimal > (gdb) bt > #0 0x00021614 in print_host (addr=0x2065113e, port=45235, af=2 > '\002', > opts=1024) at /usr/src/sbin/pfctl/pf_print_state.c:178 > #1 0x0002189c in print_state (s=0x206510f2, opts=1024) at > /usr/src/sbin/pfctl/pf_print_state.c:236 > #2 0x0000c35c in pfctl_show_states (dev=, > iface=0x0, > opts=) > at /usr/src/sbin/pfctl/pfctl.c:1091 > #3 0x0000f018 in $a.107 () at /usr/src/sbin/pfctl/pfctl.c:2241 > #4 0x0000f018 in $a.107 () at /usr/src/sbin/pfctl/pfctl.c:2241 > I attached a patch to the PR and requested the reporter test it, but I've just realized that the problem was found with a snapshot image and the reporter may not be able to patch and build. I don't use the pf stuff myself, so I have no way of testing it. Can someone who does use it give this patch a test? Thanks. -- Ian --=-Ei9OoJNugQzvnRVpRbht Content-Disposition: inline; filename="pfctl_align.diff" Content-Type: text/x-patch; name="pfctl_align.diff"; charset="us-ascii" Content-Transfer-Encoding: 7bit Index: sbin/pfctl/pf_print_state.c =================================================================== --- sbin/pfctl/pf_print_state.c (revision 294860) +++ sbin/pfctl/pf_print_state.c (working copy) @@ -146,7 +146,7 @@ print_name(struct pf_addr *addr, sa_family_t af) memset(&sin, 0, sizeof(sin)); sin.sin_len = sizeof(sin); sin.sin_family = AF_INET; - sin.sin_addr = addr->v4; + memcpy(&sin.sin_addr, addr->v4, sizeof(sin.sin_addr)); getnameinfo((struct sockaddr *)&sin, sin.sin_len, host, sizeof(host), NULL, 0, NI_NOFQDN); break; @@ -157,7 +157,7 @@ print_name(struct pf_addr *addr, sa_family_t af) memset(&sin6, 0, sizeof(sin6)); sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; - sin6.sin6_addr = addr->v6; + memcpy(&sin6.sin6_addr, addr->v6, sizeof(sin6.sin6_addr)); getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len, host, sizeof(host), NULL, 0, NI_NOFQDN); break; @@ -175,7 +175,7 @@ print_host(struct pf_addr *addr, u_int16_t port, s struct pf_addr_wrap aw; memset(&aw, 0, sizeof(aw)); - aw.v.a.addr = *addr; + memcpy(&aw.v.a.addr, addr, sizeof(aw.v.a.addr)); if (af == AF_INET) aw.v.a.mask.addr32[0] = 0xffffffff; else { --=-Ei9OoJNugQzvnRVpRbht--