From patchwork Thu Mar 10 01:43:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102602 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp200567lbc; Wed, 9 Mar 2016 19:27:31 -0800 (PST) X-Received: by 10.67.5.133 with SMTP id cm5mr1679786pad.133.1457580450906; Wed, 09 Mar 2016 19:27:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e69si2723012pfd.66.2016.03.09.19.27.30; Wed, 09 Mar 2016 19:27:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934990AbcCJD10 (ORCPT + 4 others); Wed, 9 Mar 2016 22:27:26 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:61398 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934872AbcCJD1X (ORCPT ); Wed, 9 Mar 2016 22:27:23 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0MK26P-1afEhC1t93-001Onm; Thu, 10 Mar 2016 04:26:59 +0100 From: Arnd Bergmann To: Alexei Starovoitov Cc: Arnd Bergmann , "David S. Miller" , Daniel Borkmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] bpf: make bpf_stackmap_copy conditionally called Date: Thu, 10 Mar 2016 02:43:42 +0100 Message-Id: <1457574245-2998842-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:pb6TPeKWtw+lyIKqt5BAucYYTJPFl2hO3/PGNruDOi4GkO+7Try /67LsWXCew7e9RCpsOE5NIpLLMgCt0fXlf34YtrGoMHj8siCcdmPtDAcYi4v28Xe18jlxhI 8nfxUYRlaN3lXl4OFoqf+GTzUZB5/eWDl/xcqtZlFj5WI7UnKLt17iEE8swAt8TDZSqHust w+VHOhOQ1rQEg3EIvG7Og== X-UI-Out-Filterresults: notjunk:1; V01:K0:C6UaUS956fg=:VfKbX86c6K033bOmyWedyI dVrYjVWNCzI8XaxiR7RTGfZXcnlVb1WmTSz+PcEGAv/cLFjj50FDvc0CeoGDo6tnG2hflgtdv JmUHWyFXZsqry4HhRGdWOQlXAo3Pg46dxl0yqoN1K10yhGni+t/JaV8mfQqAFmULZULi+h89I KUVt3L0YCuP9TftlLyS/XT/1LEvOhf9HIrKX8FLmFb2KGve+QqwfBZx/961FJGXtfDqsQIhNP 9fIrZHrApQdJreSIZ2tGpAdhm4ea2/lFS9+tK+F+faujhdbfi2L2HcHUG9L2xBL0/wvb9jeEC HBrbYSlFPsORYvlQp1V6MLioq1l3K2Y4ra6q2lgX0/GZ96WaMnLMRfBPZbbIlrVI7GE5IpBFP 7fc9zu2piFSrpgx0nmOr98Kp/bikE2VNDRvciHvHPjebJL00PeKKLPp7mr+CddCKRpSMlt8nx NLHxcYpcoTmUfCkLKp18Kcr8bmZa2pvyEk8Tjk2zbo1GO+oHR/lP16xtdO+0Nfg94CB+IJs+O h1kAGVztgIJHVI0H6wS/FoKRPfQpky3rP+v0h3Ljdce4nvVE+V7/Gud8lr9QsqlDYwrizi1hQ XK4HgAqfIK8TtMA5hRdD1Hpn2nYw6muyO8Lz2l40HJNu1UD2b69We/G/SucMMIzNKwRV+wBOo gt2o+XE7qfYs46Zc6gwFDwRZKl6WkjpIVaXiSdHmH+7V7WAtlJOW8pDSvJz8MwBmcHzE= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Changing the bpf syscall to use the new bpf_stackmap_copy() helper for BPF_MAP_TYPE_STACK_TRACE causes a link error when CONFIG_PERF_EVENTS is disabled: kernel/built-in.o: In function `map_lookup_elem': :(.text+0x7fca4): undefined reference to `bpf_stackmap_copy' This patch simply avoids handling that case, which may or may not be the correct answer here. Signed-off-by: Arnd Bergmann Fixes: 557c0c6e7df8 ("bpf: convert stackmap to pre-allocation") --- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.0 diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 2978d0d08869..b014b64b6116 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -290,7 +290,8 @@ static int map_lookup_elem(union bpf_attr *attr) err = bpf_percpu_hash_copy(map, key, value); } else if (map->map_type == BPF_MAP_TYPE_PERCPU_ARRAY) { err = bpf_percpu_array_copy(map, key, value); - } else if (map->map_type == BPF_MAP_TYPE_STACK_TRACE) { + } else if (map->map_type == BPF_MAP_TYPE_STACK_TRACE && + IS_ENABLED(CONFIG_PERF_EVENTS)) { err = bpf_stackmap_copy(map, key, value); } else { rcu_read_lock();