From patchwork Wed Jun 23 18:20:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Justin Mattock X-Patchwork-Id: 56699 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D4967B6F06 for ; Thu, 24 Jun 2010 04:21:47 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752866Ab0FWSVO (ORCPT ); Wed, 23 Jun 2010 14:21:14 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:49448 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758Ab0FWSVK (ORCPT ); Wed, 23 Jun 2010 14:21:10 -0400 Received: by pwj8 with SMTP id 8so1524778pwj.19 for ; Wed, 23 Jun 2010 11:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=EmYRRLo/3npucBxgokKob0dJm60qdAKkRPZcsLMjw9g=; b=ZiVVINzpQMGROomw6xgla3HnAz8ORGZDu1x1uwl5mVl3OZidhOtgxw6JYr5EXjvsw2 s7ZHC6e9YZCTi1IPviy/nssf9HSA9OB+jHSQlyXRIE4hVLmxGY5VcxUR4GDk4tc+NRhv 81/Sj+cabLdXY+CbRKoRTztv2nTPgHmqJzhEg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=FvQu83vds4faFBTHFUb1Y3uynnB9QgwEcGyen0Kb1zIqGOBiId5JC2MA0jC8Y0DMRf J6TjK2Ucxb33aGed2lqjR8Ndd2DR5Drx4qVO+dXPpYI80lF9WIPvutObSGbGsxtJfcBH uanLkzqP4fME+gmJsSLwdM00QhpGwX+xzODxw= Received: by 10.115.81.31 with SMTP id i31mr8026051wal.140.1277317268797; Wed, 23 Jun 2010 11:21:08 -0700 (PDT) Received: from [10.0.0.98] ([76.91.45.220]) by mx.google.com with ESMTPS id d20sm40677845waa.15.2010.06.23.11.21.06 (version=SSLv3 cipher=RC4-MD5); Wed, 23 Jun 2010 11:21:07 -0700 (PDT) Message-ID: <4C22508A.8060002@gmail.com> Date: Wed, 23 Jun 2010 11:20:58 -0700 From: "Justin P. Mattock" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100621 Lightning/1.0b2pre Thunderbird/3.0.4 MIME-Version: 1.0 To: =?UTF-8?B?VGltbyBUZXLDpHM=?= CC: Eric Dumazet , "John W.Linville" , netdev@vger.kernel.org, Linux Kernel Mailing List , davem@davemloft.net Subject: Re: BUG: unable to handle kernel NULL pointer dereference at 00000000000000a0 References: <20100623141622.GC15205@tuxdriver.com> <4C223DCA.5090704@gmail.com> <1277314167.2469.1144.camel@edumazet-laptop> <4C224E06.40806@iki.fi> In-Reply-To: <4C224E06.40806@iki.fi> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 06/23/10 11:10, Timo Teräs wrote: > On 06/23/2010 08:29 PM, Eric Dumazet wrote: > >> Le mercredi 23 juin 2010 à 10:00 -0700, Justin P. Mattock a écrit : >> >>> o.k. the bisect is pointing to the below results.. >>> (I tried git revert xxx but this commit is too big >>> so I'll(hopefully)manually revert it on the latest HEAD to >>> see if this is the actual problem im experiencing) >>> >>> 80c802f3073e84c956846e921e8a0b02dfa3755f is the first bad commit >>> commit 80c802f3073e84c956846e921e8a0b02dfa3755f >>> Author: Timo Teräs >>> Date: Wed Apr 7 00:30:05 2010 +0000 >>> >>> xfrm: cache bundles instead of policies for outgoing flows >>> >>> __xfrm_lookup() is called for each packet transmitted out of >>> system. The xfrm_find_bundle() does a linear search which can >>> kill system performance depending on how many bundles are >>> required per policy. >>> >>> This modifies __xfrm_lookup() to store bundles directly in >>> the flow cache. If we did not get a hit, we just create a new >>> bundle instead of doing slow search. This means that we can now >>> get multiple xfrm_dst's for same flow (on per-cpu basis). >>> >>> Signed-off-by: Timo Teras >>> Signed-off-by: David S. Miller >>> >>> :040000 040000 d8e60f5fa4c1329f450d9c7cdf98b34e6a177f22 >>> 9f576e68e5bf4ce357d7f0305aee5f410250dfe2 M include >>> :040000 040000 f2876df688ee36907af7b4123eea96592faaed3e >>> a3f6f6f94f0309106856cd99b38ec90b024eb016 M net >>> >> Thanks a lot for bisecting Jutin, this is really appreciated. >> >> crash is in xfrm_bundle_ok() >> >> if (xdst->policy_genid != atomic_read(&xdst->pols[0]->genid)) >> return 0; >> >> xdst->pols[0] contains a NULL pointer >> > That does not really make sense, if we get this far; there's a valid > xfrm_state with the bundle. This means that there existed a policy with > it too. > > I'll take a deeper look at this tomorrow. Would it be possible to see > your xfrm policies? > > - Timo > > @Eric sure no problem doing the bisect... as for the xfrm policy here is the link that I used to setup ipsec: http://www.linuxfromscratch.org/hints/downloads/files/ipsec.txt (just change the keys if doing real world work..(but for me just testing). below is a temporary fix for me to get this working, tcpdump reports everything is doing what it should be 11:16:32.496166 IP xxxxx > xxxxx: AH(spi=0x00000200,seq=0x1090): ESP(spi=0x00000201,seq=0x1090), length 56 11:16:32.496212 IP xxxxx > xxxxx: AH(spi=0x00000200,seq=0x1091): ESP(spi=0x00000201,seq=0x1091), length 56 11:16:32.496259 IP xxxxx > xxxxx: AH(spi=0x00000200,seq=0x1092): ESP(spi=0x00000201,seq=0x1092), length 56 (tested a few mins ago, but not the right fix..) From a280d9048c8f8f5756f9f0dcc608b4499645593e Mon Sep 17 00:00:00 2001 From: Justin P. Mattock Date: Wed, 23 Jun 2010 11:10:28 -0700 Subject: [PATCH] fix ipsec Signed-off-by: Justin P. Mattock --- net/xfrm/xfrm_policy.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) !(dst->xfrm->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL) && diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 4bf27d9..701d69a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -2300,8 +2300,6 @@ int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first, return 0; if (xdst->xfrm_genid != dst->xfrm->genid) return 0; - if (xdst->policy_genid != atomic_read(&xdst->pols[0]->genid)) - return 0; if (strict && fl &&