Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1826300imm; Mon, 3 Sep 2018 10:26:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY63Yt19wnLwO3bGX18ea1KhUQ1VSO4lJQVEB/y6Qjt1BZ25DBWmNpZGmvAJoZfPqu8vNfg X-Received: by 2002:a63:f244:: with SMTP id d4-v6mr2592025pgk.2.1535995563016; Mon, 03 Sep 2018 10:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995562; cv=none; d=google.com; s=arc-20160816; b=eqWqTRBjmEgiF6q+LH8h3jGrNbfGJe0x+jNdOna1XBsdBKsJKyxrwks1hho4BhvZhP rmkbwZ8O1AQurH1fcl4weX9uOPsJ/FNdHQZqdLSPo0jp2LZsY6Yd50VlNhYsaxbhc2Jv xU3gslLAx+UHWSZnRaz1ODkLPpjRn5KQb0AqEvuwphSdUuaW3Xo6E7pvgMFJQDinV78m wID8jExK3ZkyPoTJhgFWVpsYb7Nf9AWgqkHs3ssP40kHid2zt9rZJp7RYxZGXlJgyXLJ sU8afq8f6sqONqMSauA4Ax66wrRwlKv6tiUCKCRJjYNLOYwWasqmDVQH7MoB34Jr5Jrx oERg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UxscdzqLvs+5z3CwJ8/g+GL8YZEJW6tB5GgU4dF/wd0=; b=Y9VF2C2ITaJxrypkkuhBHf2abfVX1wGPM/8ujYvqLDorctpsHPb9vMFq9RkQpmpe9g 6eOtC/7yX1yGD3mPlf5PghDg0yGwsQH5DtaRsAF3MzPdv5VXctbI4S/3o/fP3HMD11gJ Zwl2lqD78+zt1KsavsjgG42CWi8NCIQ5ASv3e3zyE4Vr2TSIKO5BbcBMVD4x6kBfy3Wb VTXnq90IlmaOeSEfblV8tW5hEBy1qWNCvu+uHB2+IrIilzwyGN5wkWy+PVhFq3icw3RY NP5DRUo0XWP/JIrgByxCTbnf6bAE6nYUuwvRl3kCVpD8Q3LpIpKb2xBFIlLSWgnLpbIl nrhQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si18225816pld.429.2018.09.03.10.25.47; Mon, 03 Sep 2018 10:26:02 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729592AbeICVo5 (ORCPT + 99 others); Mon, 3 Sep 2018 17:44:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45428 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728036AbeICVo5 (ORCPT ); Mon, 3 Sep 2018 17:44:57 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2E838D0A; Mon, 3 Sep 2018 17:23:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Daniel Borkmann , Sasha Levin Subject: [PATCH 4.14 061/165] bpf: use GFP_ATOMIC instead of GFP_KERNEL in bpf_parse_prog() Date: Mon, 3 Sep 2018 18:55:47 +0200 Message-Id: <20180903165658.188870574@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Taehee Yoo [ Upstream commit 71eb5255f55bdb484d35ff7c9a1803f453dfbf82 ] bpf_parse_prog() is protected by rcu_read_lock(). so that GFP_KERNEL is not allowed in the bpf_parse_prog(). [51015.579396] ============================= [51015.579418] WARNING: suspicious RCU usage [51015.579444] 4.18.0-rc6+ #208 Not tainted [51015.579464] ----------------------------- [51015.579488] ./include/linux/rcupdate.h:303 Illegal context switch in RCU read-side critical section! [51015.579510] other info that might help us debug this: [51015.579532] rcu_scheduler_active = 2, debug_locks = 1 [51015.579556] 2 locks held by ip/1861: [51015.579577] #0: 00000000a8c12fd1 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x2e0/0x910 [51015.579711] #1: 00000000bf815f8e (rcu_read_lock){....}, at: lwtunnel_build_state+0x96/0x390 [51015.579842] stack backtrace: [51015.579869] CPU: 0 PID: 1861 Comm: ip Not tainted 4.18.0-rc6+ #208 [51015.579891] Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 07/08/2015 [51015.579911] Call Trace: [51015.579950] dump_stack+0x74/0xbb [51015.580000] ___might_sleep+0x16b/0x3a0 [51015.580047] __kmalloc_track_caller+0x220/0x380 [51015.580077] kmemdup+0x1c/0x40 [51015.580077] bpf_parse_prog+0x10e/0x230 [51015.580164] ? kasan_kmalloc+0xa0/0xd0 [51015.580164] ? bpf_destroy_state+0x30/0x30 [51015.580164] ? bpf_build_state+0xe2/0x3e0 [51015.580164] bpf_build_state+0x1bb/0x3e0 [51015.580164] ? bpf_parse_prog+0x230/0x230 [51015.580164] ? lock_is_held_type+0x123/0x1a0 [51015.580164] lwtunnel_build_state+0x1aa/0x390 [51015.580164] fib_create_info+0x1579/0x33d0 [51015.580164] ? sched_clock_local+0xe2/0x150 [51015.580164] ? fib_info_update_nh_saddr+0x1f0/0x1f0 [51015.580164] ? sched_clock_local+0xe2/0x150 [51015.580164] fib_table_insert+0x201/0x1990 [51015.580164] ? lock_downgrade+0x610/0x610 [51015.580164] ? fib_table_lookup+0x1920/0x1920 [51015.580164] ? lwtunnel_valid_encap_type.part.6+0xcb/0x3a0 [51015.580164] ? rtm_to_fib_config+0x637/0xbd0 [51015.580164] inet_rtm_newroute+0xed/0x1b0 [51015.580164] ? rtm_to_fib_config+0xbd0/0xbd0 [51015.580164] rtnetlink_rcv_msg+0x331/0x910 [ ... ] Fixes: 3a0af8fd61f9 ("bpf: BPF for lightweight tunnel infrastructure") Signed-off-by: Taehee Yoo Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/core/lwt_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/lwt_bpf.c +++ b/net/core/lwt_bpf.c @@ -217,7 +217,7 @@ static int bpf_parse_prog(struct nlattr if (!tb[LWT_BPF_PROG_FD] || !tb[LWT_BPF_PROG_NAME]) return -EINVAL; - prog->name = nla_memdup(tb[LWT_BPF_PROG_NAME], GFP_KERNEL); + prog->name = nla_memdup(tb[LWT_BPF_PROG_NAME], GFP_ATOMIC); if (!prog->name) return -ENOMEM;