Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp555244imm; Wed, 8 Aug 2018 01:26:17 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxx1ZrA6eoXcMczdAhB2u7sclBgpREjdTXNFJ3DNicQCmpTT9p4nrUXsvqMTuJUxe9aMu7K X-Received: by 2002:a63:91c8:: with SMTP id l191-v6mr1570545pge.180.1533716777795; Wed, 08 Aug 2018 01:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533716777; cv=none; d=google.com; s=arc-20160816; b=DvrBCKyAOoALHBqegJ/0mUNxqazeR9AzAwdpvmrOw7EwPJzCbzGtlAJm3FUdU7Jv3J dm/SbWCuR/+FVgAa1ydi1SkX5tqyJSOJEZnMmY0Zs7Ivp2QcDOxEYCtlCPwMhRTvo/6+ IHZ/Z76ZASBGHYWhLSfvCWZKhkCJpkwnt9cp35+Y+nhf4vqhd4TfACi8tQU/EHMEzdrf TprW9Kz8t9oFuhzE60GS7KjjgqBqQm5gg99LxhpxejnoOMcaSwCfXyXS0VtaMz0KITh4 7dy07ddQENZuQydEpXPd5f3iZiuIi9UaD++Ol/R3g1eq5TMXqxa73CqVvoQuhNo1tOx4 Dyrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=V50Bx3nMmsTruSDqVHCgI8KlUsJODl7HPM/7zIwNzWc=; b=EyPuWQz6EbVoLUxu660VOAQAMGQoJJxO0M5OLzEKE8K+ptGyK9rrowIaMBs8cW1z4/ abCyKtx4HmpvND+LOzuqGkR2Gi3ugCH/U9uM8kTDsixv/vddOr8TR2D0rAbjDMjvW07P 736KXopzJFTE4XKMMQm/jxE7hJpS4YSkG+OwC+1AqsQxcETBbD9kVbIaSgpXpEY2HK0/ JHK1YAgTkniX6jbljDWxx5L/VRjVWLpy6cicVk65n0PH6VPXTw9SJhB3frXgeCaYlRpH hJR+XKEIgcr9tf14RFZupOn6EJOQ5brHGhCOTlUJS7q5Xmm2rYd+4n17fEUcgS163WeN hsJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si3122947pla.167.2018.08.08.01.26.03; Wed, 08 Aug 2018 01:26:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727251AbeHHKnv (ORCPT + 99 others); Wed, 8 Aug 2018 06:43:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:32806 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726979AbeHHKnu (ORCPT ); Wed, 8 Aug 2018 06:43:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5E8FDAD49; Wed, 8 Aug 2018 08:25:12 +0000 (UTC) Date: Wed, 8 Aug 2018 10:25:11 +0200 From: Michal Hocko To: Vlastimil Babka Cc: Florian Westphal , Georgi Nikolov , Andrew Morton , "David S. Miller" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] netfilter/x_tables: do not fail xt_alloc_table_info too easilly Message-ID: <20180808082511.GF27972@dhcp22.suse.cz> References: <20180807195400.23687-1-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 08-08-18 10:16:01, Vlastimil Babka wrote: > On 08/07/2018 09:54 PM, Michal Hocko wrote: > > From: Michal Hocko > > > > eacd86ca3b03 ("net/netfilter/x_tables.c: use kvmalloc() > > in xt_alloc_table_info()") has unintentionally fortified > > xt_alloc_table_info allocation when __GFP_RETRY has been dropped from > > the vmalloc fallback. Later on there was a syzbot report that this > > can lead to OOM killer invocations when tables are too large and > > 0537250fdc6c ("netfilter: x_tables: make allocation less aggressive") > > has been merged to restore the original behavior. Georgi Nikolov however > > noticed that he is not able to install his iptables anymore so this can > > be seen as a regression. > > > > The primary argument for 0537250fdc6c was that this allocation path > > shouldn't really trigger the OOM killer and kill innocent tasks. On the > > other hand the interface requires root and as such should allow what the > > admin asks for. Root inside a namespaces makes this more complicated > > because those might be not trusted in general. If they are not then such > > namespaces should be restricted anyway. Therefore drop the __GFP_NORETRY > > and replace it by __GFP_ACCOUNT to enfore memcg constrains on it. > > > > Fixes: 0537250fdc6c ("netfilter: x_tables: make allocation less aggressive") > > Reported-by: Georgi Nikolov > > Suggested-by: Vlastimil Babka > > Acked-by: Florian Westphal > > Signed-off-by: Michal Hocko > > Acked-by: Vlastimil Babka Thanks! > IIRC According to Florian there are more places like this in the > netfilter code? Well, this is more for netfilter guys. I can only give a general guidance that generally untrusted allocations triggered from userspace should be a subject of kmem accounting. -- Michal Hocko SUSE Labs