From owner-freebsd-net@FreeBSD.ORG Mon Jun 9 08:13:49 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 927EE106567B for ; Mon, 9 Jun 2008 08:13:49 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from mailgate.hob.de (mailgate.hob.de [212.185.199.3]) by mx1.freebsd.org (Postfix) with ESMTP id 50BC88FC24 for ; Mon, 9 Jun 2008 08:13:49 +0000 (UTC) (envelope-from marc.loerner@hob.de) Received: from imap.hob.de (mail2.hob.de [172.25.1.102]) by mailgate.hob.de (Postfix) with ESMTP id 539F6520075; Mon, 9 Jun 2008 10:13:48 +0200 (CEST) Received: from [172.22.0.190] (linux03.hob.de [172.22.0.190]) by imap.hob.de (Postfix on SuSE eMail Server 2.0) with ESMTP id 9032AFD413; Mon, 9 Jun 2008 10:13:47 +0200 (CEST) From: Marc =?iso-8859-1?q?L=F6rner?= Organization: hob To: Bruce Evans Date: Mon, 9 Jun 2008 10:13:27 +0200 User-Agent: KMail/1.6.2 References: <200806051712.47048.marc.loerner@hob.de> <200806061025.37856.marc.loerner@hob.de> <20080606221917.A16250@delplex.bde.org> In-Reply-To: <20080606221917.A16250@delplex.bde.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Message-Id: <200806091013.27813.marc.loerner@hob.de> Cc: Peter Jeremy , freebsd-net@freebsd.org Subject: Re: Probable Bug in tcp.h X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jun 2008 08:13:49 -0000 On Friday 06 June 2008 14:25, Bruce Evans wrote: > On Fri, 6 Jun 2008, Marc [iso-8859-1] Lörner wrote: > > On Friday 06 June 2008 09:52, Peter Jeremy wrote: > >> I gather from this comment that you have some code using struct tcphdr > >> that is getting alignment errors. struct tcphdr is extensively used > >> in the TCP stack within the kernel so it's likely that any layout or > >> alignment problem with it would show up there. I suspect you are > >> dereferencing a mis-aligned struct tcphdr. > > > > The funny thing is that the dereferencing occurs in > > "/usr/src/sys/netinet/tcp_input.c" in function tcp_input in line 550: > > > > /* > > * Check that TCP offset makes sense, > > * pull out TCP options and adjust length. XXX > > */ > > off = th->th_off << 2; <----- here > > if (off < sizeof (struct tcphdr) || off > tlen) { > > tcpstat.tcps_rcvbadoff++; > > goto drop; > > } > > > > So the misalignment may probably lie in TCP stack? > > Quite likely. th is normally at offset off0 in ip, where ip is required > to be 32-bit aligned (see my previous reply). You can see off0 in a > stack trace. > off0 is 0x14 => no problem with that but address of ip is 0xe000000021c8706e => not correct aligned to 32-bits Can anyone tell me, where ip is allocated, so I can do a little bit more research? Marc