From: Alexei Starovoitov Subject: Re: [PATCH bpf] bpf: fix mlock precharge on arraymaps Date: Thu, 15 Feb 2018 21:37:39 -0800 Message-ID: References: <20180216001029.9427-1-daniel@iogearbox.net> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: , Dennis Zhou To: Daniel Borkmann Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:40942 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752724AbeBPFiI (ORCPT ); Fri, 16 Feb 2018 00:38:08 -0500 In-Reply-To: <20180216001029.9427-1-daniel@iogearbox.net> Sender: netdev-owner@vger.kernel.org List-ID: On 2/15/18 4:10 PM, Daniel Borkmann wrote: > syzkaller recently triggered OOM during percpu map allocation; > while there is work in progress by Dennis Zhou to add __GFP_NORETRY > semantics for percpu allocator under pressure, there seems also a > missing bpf_map_precharge_memlock() check in array map allocation. > > Given today the actual bpf_map_charge_memlock() happens after the > find_and_alloc_map() in syscall path, the bpf_map_precharge_memlock() > is there to bail out early before we go and do the map setup work > when we find that we hit the limits anyway. Therefore add this for > array map as well. > > Fixes: 6c9059817432 ("bpf: pre-allocate hash map elements") > Fixes: a10423b87a7e ("bpf: introduce BPF_MAP_TYPE_PERCPU_ARRAY map") > Reported-by: syzbot+adb03f3f0bb57ce3acda@syzkaller.appspotmail.com > Signed-off-by: Daniel Borkmann > Cc: Dennis Zhou Applied to bpf tree, Thanks Daniel.