From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763370AbdJQQ2z (ORCPT ); Tue, 17 Oct 2017 12:28:55 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:43727 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756270AbdJQQ2x (ORCPT ); Tue, 17 Oct 2017 12:28:53 -0400 X-Google-Smtp-Source: ABhQp+TPYXvnE76cMfn8dWBQVulAXMYml6uD4vCUUXkEndX6cui90H//8OpgPwcsOyxgwCpx7M6rrQ== Subject: Re: [PATCH net 2/3] bpf: fix splat for illegal devmap percpu allocation To: Daniel Borkmann , davem@davemloft.net Cc: tj@kernel.org, ast@kernel.org, mark.rutland@arm.com, richard@nod.at, sp3485@columbia.edu, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: From: John Fastabend Message-ID: <6171eefe-6cbe-c67d-b023-fa531ce170d1@gmail.com> Date: Tue, 17 Oct 2017 09:28:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/17/2017 07:55 AM, Daniel Borkmann wrote: > It was reported that syzkaller was able to trigger a splat on > devmap percpu allocation due to illegal/unsupported allocation > request size passed to __alloc_percpu(): > > [ 70.094249] illegal size (32776) or align (8) for percpu allocation > [ 70.094256] ------------[ cut here ]------------ > [ 70.094259] WARNING: CPU: 3 PID: 3451 at mm/percpu.c:1365 pcpu_alloc+0x96/0x630 > [...] > [ 70.094325] Call Trace: > [ 70.094328] __alloc_percpu_gfp+0x12/0x20 > [ 70.094330] dev_map_alloc+0x134/0x1e0 > [ 70.094331] SyS_bpf+0x9bc/0x1610 > [ 70.094333] ? selinux_task_setrlimit+0x5a/0x60 > [ 70.094334] ? security_task_setrlimit+0x43/0x60 > [ 70.094336] entry_SYSCALL_64_fastpath+0x1a/0xa5 > > This was due to too large max_entries for the map such that we > surpassed the upper limit of PCPU_MIN_UNIT_SIZE. It's fine to > fail naturally here, so switch to __alloc_percpu_gfp() and pass > __GFP_NOWARN instead. > > Fixes: 11393cc9b9be ("xdp: Add batching support to redirect map") > Reported-by: Mark Rutland > Reported-by: Shankara Pailoor > Reported-by: Richard Weinberger > Signed-off-by: Daniel Borkmann > Cc: John Fastabend > --- Thanks! Acked-by: John Fastabend