Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751508AbbECVUj (ORCPT ); Sun, 3 May 2015 17:20:39 -0400 Received: from www62.your-server.de ([213.133.104.62]:38573 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751186AbbECVU3 (ORCPT ); Sun, 3 May 2015 17:20:29 -0400 Message-ID: <5546911A.4000209@iogearbox.net> Date: Sun, 03 May 2015 23:20:26 +0200 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Greg Kroah-Hartman , Thomas Backlund CC: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Alexey Perevalov , Pablo Neira Ayuso Subject: Re: [PATCH 3.19 176/177] netfilter: x_tables: fix cgroup matching on non-full sks References: <20150502190119.666291882@linuxfoundation.org> <20150502190127.967512385@linuxfoundation.org> <554545E5.8020606@mageia.org> <20150503184534.GC19674@kroah.com> In-Reply-To: <20150503184534.GC19674@kroah.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3271 Lines: 86 Hi Greg, hi Pablo, On 05/03/2015 08:45 PM, Greg Kroah-Hartman wrote: > On Sun, May 03, 2015 at 12:47:17AM +0300, Thomas Backlund wrote: >> Den 02.05.2015 22:03, Greg Kroah-Hartman skrev: >>> 3.19-stable review patch. If anyone has any objections, please let me know. >>> >>> ------------------ >>> >>> From: Daniel Borkmann >>> >>> commit afb7718016fcb0370ac29a83b2839c78b76c2960 upstream. >>> >>> While originally only being intended for outgoing traffic, commit >>> a00e76349f35 ("netfilter: x_tables: allow to use cgroup match for >>> LOCAL_IN nf hooks") enabled xt_cgroups for the NF_INET_LOCAL_IN hook >>> as well, in order to allow for nfacct accounting. >>> >>> Besides being currently limited to early demuxes only, commit >>> a00e76349f35 forgot to add a check if we deal with full sockets, >>> i.e. in this case not with time wait sockets. TCP time wait sockets >>> do not have the same memory layout as full sockets, a lower memory >>> footprint and consequently also don't have a sk_classid member; >>> probing for sk_classid member there could potentially lead to a >>> crash. >>> >>> Fixes: a00e76349f35 ("netfilter: x_tables: allow to use cgroup match for LOCAL_IN nf hooks") >>> Cc: Alexey Perevalov >>> Signed-off-by: Daniel Borkmann >>> Signed-off-by: Pablo Neira Ayuso >>> Signed-off-by: Greg Kroah-Hartman >>> >>> --- >>> net/netfilter/xt_cgroup.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> --- a/net/netfilter/xt_cgroup.c >>> +++ b/net/netfilter/xt_cgroup.c >>> @@ -39,7 +39,7 @@ cgroup_mt(const struct sk_buff *skb, str >>> { >>> const struct xt_cgroup_info *info = par->matchinfo; >>> >>> - if (skb->sk == NULL) >>> + if (skb->sk == NULL || !sk_fullsock(skb->sk)) >>> return false; >>> >>> return (info->id == skb->sk->sk_classid) ^ info->invert; >> >> This one breaks the build with: >> >> net/netfilter/xt_cgroup.c: In function 'cgroup_mt': >> net/netfilter/xt_cgroup.c:42:2: error: implicit declaration of function >> 'sk_fullsock' [-Werror=implicit-function-declaration] >> >> >> In order to fix it, you also need to add: >> >> From 1d0ab253872cdd3d8e7913f59c266c7fd01771d0 Mon Sep 17 00:00:00 2001 >> From: Eric Dumazet >> Date: Sun, 15 Mar 2015 21:12:12 -0700 >> Subject: [PATCH] net: add sk_fullsock() helper >> >> which in turn needs this one: >> >> From 10feb428a5045d5eb18a5d755fbb8f0cc9645626 Mon Sep 17 00:00:00 2001 >> From: Eric Dumazet >> Date: Thu, 12 Mar 2015 16:44:04 -0700 >> Subject: [PATCH] inet: add TCP_NEW_SYN_RECV state > > I've just dropped the patch, thanks for letting me know, odd that my > build tests missed it. If you're nevertheless interested in this fix, you could use this version, which should apply/build just fine: http://patchwork.ozlabs.org/patch/455546/ I believe Pablo usually sends netfilter patches in bundles to you. Thanks a lot, Daniel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/