From owner-freebsd-pf@freebsd.org Sun Jan 31 01:10:47 2016 Return-Path: Delivered-To: freebsd-pf@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 6EA5BA73687 for ; Sun, 31 Jan 2016 01:10:47 +0000 (UTC) (envelope-from amutu@amutu.com) Received: from mail-yk0-x230.google.com (mail-yk0-x230.google.com [IPv6:2607:f8b0:4002:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3573912D1 for ; Sun, 31 Jan 2016 01:10:47 +0000 (UTC) (envelope-from amutu@amutu.com) Received: by mail-yk0-x230.google.com with SMTP id r207so66672305ykd.2 for ; Sat, 30 Jan 2016 17:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amutu-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=65ELIXpSJadz2NkXOz/JtajFJSntq6340Z2xkFfN+eg=; b=gVHTYaGzsiV6DS0RFMcho5NkeobxfXsGrQnajxC3m8yZcRlLeDfJUytqhx4U4Gumve 4x09TGvdjBT4sVPr7HNGR2NaHB7cKCxEgZ/ESPjglGbHvJ7ttlvmgMJux0+z3tihea2/ x9ABusY0GqdWKHILkrmItO2/FE1TzRZzZJfmm9MJO8JiClxnEqYVfjqVSHWc64aykZJ/ ylp7xk1MuKxB/+RveLwVIxwv/4iT38HTmFwszCy+Mx8tXd/gy8L37PQ68HtPDOzkJq78 z2b/+xL1aQL/2UjViKwqvqLBIE9LZnNS57FafiN04+9wc10+A+JZ6CQgdfM9mDuwgEis EffQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=65ELIXpSJadz2NkXOz/JtajFJSntq6340Z2xkFfN+eg=; b=RcQFwjzLxcbSwrDZPunFAtoA8H36RFRA4vV1U80TBEcyDga+6mdGtPFXHzcKHiUi8x P9lNVNbNoJ83S5u22u/l2Gq0ASGmFL+qJREag5ybUFpOJD3bvm5gcDovnwvB+j7LKc1P WhCV03aYulLl/r5DyDk/Q790zbnSrrj+XsQzgKC9qQ90LRw8E7e9hfcBXnbwZwqNiAcI CX79LuaQM47RWZu20GJatE+BHHtaVuWQ+DcqKhVnTOMrGvNU2soO5xtp5gqSy09pDXRy r6nbnhPHbZEkUOmcvPNm6DaZVr/rMIayFD6PYZ7CTGcKr6o1QyAtOrLw1AAKkN1YNgR8 Y4vg== X-Gm-Message-State: AG10YOTwvTT/8h1EZBahWhr5r5WWHaAffG34QkZ+hcZpnc6/IX4KT/bV7uR7LmHaI6+UQQ== X-Received: by 10.37.35.136 with SMTP id j130mr2045567ybj.40.1454202646414; Sat, 30 Jan 2016 17:10:46 -0800 (PST) Received: from mail-yk0-f174.google.com (mail-yk0-f174.google.com. [209.85.160.174]) by smtp.gmail.com with ESMTPSA id v130sm17784748ywe.24.2016.01.30.17.10.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Jan 2016 17:10:45 -0800 (PST) Received: by mail-yk0-f174.google.com with SMTP id a85so110003189ykb.1; Sat, 30 Jan 2016 17:10:45 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.129.72.70 with SMTP id v67mr6399689ywa.156.1454202644876; Sat, 30 Jan 2016 17:10:44 -0800 (PST) Received: by 10.37.79.6 with HTTP; Sat, 30 Jan 2016 17:10:44 -0800 (PST) Received: by 10.37.79.6 with HTTP; Sat, 30 Jan 2016 17:10:44 -0800 (PST) In-Reply-To: <1454192055.32550.8.camel@freebsd.org> References: <1453862939.42081.25.camel@freebsd.org> <1453867724.42081.28.camel@freebsd.org> <1453903433.42081.30.camel@freebsd.org> <1454192055.32550.8.camel@freebsd.org> Date: Sun, 31 Jan 2016 09:10:44 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Bug 206658] Bus error for pfctl -sa on rpi2 r294499 snap From: Jov To: Ian Lepore Cc: freebsd-pf@freebsd.org, peter garshtja , freebsd-arm Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Jan 2016 01:10:47 -0000 Nice,will test it. 2016=E5=B9=B41=E6=9C=8831=E6=97=A5 6:14 AM=EF=BC=8C"Ian Lepore" =E5=86=99=E9=81=93=EF=BC=9A > FYI, I've committed r295086, which is conceptually the patch submitted > by Guy Yur, but restructured with an #ifndef __NO_STRICT_ALIGNMENT > wrapper, and in general more like the corresponding code on the kernel > side for handling this. > > Could somebody who uses pf please give this a test and let me know if > it works right? (It *looks* right, but... you know.) If it works I > should get it MFC'd before the 10.3 release. > > -- Ian > > On Fri, 2016-01-29 at 00:11 -0500, peter garshtja wrote: > > Much appreciated for your effort. > > > > I have been waiting for this fix over 3months. > > > > Regards > > > > On Thursday, January 28, 2016, Jov wrote: > > > > > This patch works=EF=BC=8Cthanks very much ! > > > > > > will these patches to be commited to the offical svn? I add freebsd > > > -pf ML. > > > > > > > > > Jov > > > blog: http:amutu.com/blog > > > > > > 2016-01-29 5:26 GMT+08:00 Guy Yur > > > > : > > > > > > > Hi, > > > > > > > > On Thu, Jan 28, 2016 at 2:06 PM, Jov > > > :;>> > > > wrote: > > > > > bus error at the similar position: > > > > > > > > > > Program received signal SIGBUS, Bus error. > > > > > 0x00021614 in print_host (addr=3D0x2065111a, port=3D15268, af=3D2 > > > > > '\002', > > > > > opts=3D1024) 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 =3D (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/0072 > > > > 37.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=3D185617 > > > > > > > > -- Guy > > > > > > > _______________________________________________ > > > freebsd-arm@freebsd.org mailing list > > > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > > > To unsubscribe, send any mail to " > > > freebsd-arm-unsubscribe@freebsd.org > > > " > > _______________________________________________ > > freebsd-arm@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-arm > > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org > > " > > > From owner-freebsd-pf@freebsd.org Mon Feb 1 02:36:09 2016 Return-Path: Delivered-To: freebsd-pf@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 33104A758B3 for ; Mon, 1 Feb 2016 02:36:09 +0000 (UTC) (envelope-from amutu@amutu.com) Received: from mail-yk0-x22d.google.com (mail-yk0-x22d.google.com [IPv6:2607:f8b0:4002:c07::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E554437C for ; Mon, 1 Feb 2016 02:36:08 +0000 (UTC) (envelope-from amutu@amutu.com) Received: by mail-yk0-x22d.google.com with SMTP id r207so87661090ykd.2 for ; Sun, 31 Jan 2016 18:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amutu-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=SbtgFS0miCegQcGLuaz5iU5hSbPDEPNQKgVZ0NNtkAM=; b=C+gx8Rh1Hz8kRO0xuxUhi/czaXJ1+hQqozJFVRLQnTS0fOi1fTJd/kIu4TvP7g67h0 D46FQzwItjeix9nNDBOvKWnl46L7GqAGvOHLFoefpMRbAN2vCPPmXd2HhKHrPfK8UkCh URE2Qw7R8fOl9zUt+i0X0S8Y+okwVB9qTI736MrpjVJINjwgE3RY/1tBisyI7a1HdTd8 f8sClzv8KIlKswLteYymiIr+VdAlaoc9DYQPK/kzHqhgjif4r+8is2sO2+VJhjonPHGS rsdMkpJhD21szkj9KpHBXfsPmLvVeXnbprBJIt7q8H+7ptfiryp+482IkSnhdFYlkvnA JzFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=SbtgFS0miCegQcGLuaz5iU5hSbPDEPNQKgVZ0NNtkAM=; b=U4orTwNM8kyYvqF4h59LFxSt6DwHH2Ln6ECI3hRdS2d0WspPBiymO59BZbS2VgR1oQ gigH8D9Nne0vOUIE86BT0NYDVFt3UPPc1WQ9KME7YBGxO4/g3FNtgxbD9lIHSoNKC160 ybYOXPQLO61leV36vtFj3bjZAzZa7xpzBWaUscjmPxfMIDGOXALI+llZFXv1fpIg65yk Naw6CZMUBDh3TerGiSKzDw8tm/+3lOcN6e4UGKO/qDqpCQ3BCimkpR8+CqO1I75QwOWv rbkyc4tF3TNYAO4phX2ZsJGTuYOCdsfjem7pYjV/vPm1IPry6CDSjOGT1LP7Dx0hKx61 LYFw== X-Gm-Message-State: AG10YORCdVM1QzEx8PJRAMjk5OIxEC0xoVkCIwU7z4aCfwqzAU3SIidiFI8b1XSDl0wfKQ== X-Received: by 10.129.138.1 with SMTP id a1mr10131789ywg.259.1454294168007; Sun, 31 Jan 2016 18:36:08 -0800 (PST) Received: from mail-yk0-f181.google.com (mail-yk0-f181.google.com. [209.85.160.181]) by smtp.gmail.com with ESMTPSA id c126sm5799531ywa.52.2016.01.31.18.36.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Jan 2016 18:36:07 -0800 (PST) Received: by mail-yk0-f181.google.com with SMTP id z13so32463277ykd.0; Sun, 31 Jan 2016 18:36:06 -0800 (PST) X-Received: by 10.129.106.11 with SMTP id f11mr10096865ywc.168.1454294166590; Sun, 31 Jan 2016 18:36:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.79.6 with HTTP; Sun, 31 Jan 2016 18:35:47 -0800 (PST) In-Reply-To: References: <1453862939.42081.25.camel@freebsd.org> <1453867724.42081.28.camel@freebsd.org> <1453903433.42081.30.camel@freebsd.org> <1454192055.32550.8.camel@freebsd.org> From: Jov Date: Mon, 1 Feb 2016 10:35:47 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Bug 206658] Bus error for pfctl -sa on rpi2 r294499 snap To: Ian Lepore Cc: freebsd-pf@freebsd.org, peter garshtja , freebsd-arm Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2016 02:36:09 -0000 Hi,Ian, r295086 works for me,thanks for your work! Jov blog: http:amutu.com/blog 2016-01-31 9:10 GMT+08:00 Jov : > Nice,will test it. > 2016=E5=B9=B41=E6=9C=8831=E6=97=A5 6:14 AM=EF=BC=8C"Ian Lepore" =E5=86=99=E9=81=93=EF=BC=9A > >> FYI, I've committed r295086, which is conceptually the patch submitted >> by Guy Yur, but restructured with an #ifndef __NO_STRICT_ALIGNMENT >> wrapper, and in general more like the corresponding code on the kernel >> side for handling this. >> >> Could somebody who uses pf please give this a test and let me know if >> it works right? (It *looks* right, but... you know.) If it works I >> should get it MFC'd before the 10.3 release. >> >> -- Ian >> >> On Fri, 2016-01-29 at 00:11 -0500, peter garshtja wrote: >> > Much appreciated for your effort. >> > >> > I have been waiting for this fix over 3months. >> > >> > Regards >> > >> > On Thursday, January 28, 2016, Jov wrote: >> > >> > > This patch works=EF=BC=8Cthanks very much ! >> > > >> > > will these patches to be commited to the offical svn? I add freebsd >> > > -pf ML. >> > > >> > > >> > > Jov >> > > blog: http:amutu.com/blog >> > > >> > > 2016-01-29 5:26 GMT+08:00 Guy Yur > >> > > : >> > > >> > > > Hi, >> > > > >> > > > On Thu, Jan 28, 2016 at 2:06 PM, Jov > > > > :;>> >> > > wrote: >> > > > > bus error at the similar position: >> > > > > >> > > > > Program received signal SIGBUS, Bus error. >> > > > > 0x00021614 in print_host (addr=3D0x2065111a, port=3D15268, af=3D= 2 >> > > > > '\002', >> > > > > opts=3D1024) 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 =3D (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/0072 >> > > > 37.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=3D185617 >> > > > >> > > > -- Guy >> > > > >> > > _______________________________________________ >> > > freebsd-arm@freebsd.org mailing list >> > > https://lists.freebsd.org/mailman/listinfo/freebsd-arm >> > > To unsubscribe, send any mail to " >> > > freebsd-arm-unsubscribe@freebsd.org >> > > " >> > _______________________________________________ >> > freebsd-arm@freebsd.org mailing list >> > https://lists.freebsd.org/mailman/listinfo/freebsd-arm >> > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org >> > " >> > >> >