Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2016 19:48:59 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        freebsd-arm@FreeBSD.org
Subject:   Re: [Bug 206658] Bus error for pfctl -sa on rpi2 r294499 snap
Message-ID:  <1453862939.42081.25.camel@freebsd.org>
In-Reply-To: <bug-206658-7@https.bugs.freebsd.org/bugzilla/>
References:  <bug-206658-7@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-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 <bruteforce> 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 <bruteforce> 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=<value optimized out>,
> iface=0x0,
> opts=<value optimized out>)
>     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--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1453862939.42081.25.camel>