Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Nov 2010 16:38:24 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Adrian Chadd <adrian.chadd@gmail.com>
Cc:        FreeBSD Net <freebsd-net@freebsd.org>
Subject:   Re: ipfw and bridge: unaligned payload pointers panicing perfectly performing MIPS boxes
Message-ID:  <20101123153824.GB48018@onelab2.iet.unipi.it>
In-Reply-To: <AANLkTi=qr1-m%2Bq=QMFNAMjM_i_wPgNXsPQ%2B6rfN_tc2L@mail.gmail.com>
References:  <AANLkTi=qr1-m%2Bq=QMFNAMjM_i_wPgNXsPQ%2B6rfN_tc2L@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 23, 2010 at 02:30:56PM +0800, Adrian Chadd wrote:
> Hi everyone (and Luigi especially!)
> 
> I've found that enabling ipfw for bridge interfaces panics my MIPS
> boards. A bit of digging shows that the payload mbuf isn't aligned as
> passed into ipfw_chk(), and this is causing aligned access exceptions.
> 
> It likely isn't a problem on i386/ia64 because they are happy with
> unaligned access. :-)
> 
> I'm going to try and patch it locally by copying the mbuf payload into
> a new, temporary mbuf that's aligned; but I have no idea what the
> "right" solution for the stack is.
> 
> Ideas? :)

the copy (especially if you make it conditional on #if NEED_ALIGNED
and possibly on actual alignment)
sounds good enough and it probably limits the number of changes to code.
The drawback is that you might need to copy a lot of stuff unnecessarily.

The other option would be to replace all the initial assignments to the
copies of the header fields with macros, which then translate into
assignments or bcopy depending on the circumstances.

I'd go for the former, unless you are really concerned about performance.

cheers
luigi



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