Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5439539ybi; Wed, 12 Jun 2019 02:30:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWYkhL/0RzBs5A6yoprDoex9VRvj+FFgdhHOtSJbup5XJ0PA4JZqMTCGuROkbbMn3bALPe X-Received: by 2002:a65:6543:: with SMTP id a3mr22808526pgw.300.1560331856668; Wed, 12 Jun 2019 02:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560331856; cv=none; d=google.com; s=arc-20160816; b=YQR0wTuJSZ9Ob7z3uVK29x4vIOVZhiplqepy5Vd1w/V6fEjKeQvqinSNCWTkVlqOxq 5aH7Yb/JwUIhyeCH2Vga0A7LlOiJdCBNMSxJEZsxUVTBWCoMMHLDiqfYCZkVfN/hBKJE r8fHCOcyVgmJc8los3FlQzsCoEN9Kh/EMYbXu6VBka0nUQ1WSMeImd/Kwn7VTUrPQpjj /YyKjHDu8cWFYZbLpR6S1TBwrxGN2fIqON5yiGUr8jtXaqmE+FHC/YCVGvOG9d0QAT8R sdkRTZfPZw4qRIgNQE5HgYbT9SGlWu4u9D2G2O/H5bApSwGQtQMxOiS7mTYSLJhWQgWC mtxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=KY3Pj9JcbcEVKzFW2VHrxeHH68gKh9ItFMdcB3SmccA=; b=axjKAMd1JpT0g1K4f92L32iaZJsJ+6rKAnl8Gh4K/+MqZtx7JUkj8UssdLewITOiUM vQpaE1wTFHlg/BrqzBq88jy4itPz8+iLiraIfIRIdOGv9JKDt6ti1JYuFN6VUMWPfYJ4 vkDMZlZKFt8+WP75SIScIo10UvfTIJpcec/RAKTRyKT1Zx1Wncea7b5gUOFHINeYAw4D Al/XIvgX2/3y+SL25Dglol+0e/l9A/f8Ghz8RjwkiXwbgWaakxAdHKdVPjHVsTS/Esvj 1HPKzWHcnXhaawp0Ej3Qqif4BRucN8E2uJ/0taeXiWdaNlo5umpLlXCm5MtfT03c7mhU Jzkg== 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 h1si14669046pgv.67.2019.06.12.02.30.40; Wed, 12 Jun 2019 02:30:56 -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 S2437326AbfFLJVL (ORCPT + 99 others); Wed, 12 Jun 2019 05:21:11 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43986 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2436698AbfFLJVL (ORCPT ); Wed, 12 Jun 2019 05:21:11 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C1E5B7232FB05951CF92; Wed, 12 Jun 2019 17:21:07 +0800 (CST) Received: from localhost (10.133.213.239) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Wed, 12 Jun 2019 17:21:00 +0800 From: YueHaibing To: , , , , , , , CC: , , , , YueHaibing Subject: [PATCH bpf-next] bpf: Fix build error without CONFIG_INET Date: Wed, 12 Jun 2019 17:18:47 +0800 Message-ID: <20190612091847.23708-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.133.213.239] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_INET is not set, building fails: kernel/bpf/verifier.o: In function `check_mem_access': verifier.c: undefined reference to `bpf_xdp_sock_is_valid_access' kernel/bpf/verifier.o: In function `convert_ctx_accesses': verifier.c: undefined reference to `bpf_xdp_sock_convert_ctx_access' Reported-by: Hulk Robot Fixes: fada7fdc83c0 ("bpf: Allow bpf_map_lookup_elem() on an xskmap") Signed-off-by: YueHaibing --- include/linux/bpf.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 4118f3d..72ca1e7 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -725,13 +725,6 @@ void __cpu_map_insert_ctx(struct bpf_map *map, u32 index); void __cpu_map_flush(struct bpf_map *map); int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp, struct net_device *dev_rx); -bool bpf_xdp_sock_is_valid_access(int off, int size, enum bpf_access_type type, - struct bpf_insn_access_aux *info); -u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type, - const struct bpf_insn *si, - struct bpf_insn *insn_buf, - struct bpf_prog *prog, - u32 *target_size); /* Return map's numa specified by userspace */ static inline int bpf_map_attr_numa_node(const union bpf_attr *attr) @@ -1107,6 +1100,15 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, struct bpf_insn *insn_buf, struct bpf_prog *prog, u32 *target_size); + +bool bpf_xdp_sock_is_valid_access(int off, int size, enum bpf_access_type type, + struct bpf_insn_access_aux *info); + +u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type, + const struct bpf_insn *si, + struct bpf_insn *insn_buf, + struct bpf_prog *prog, + u32 *target_size); #else static inline bool bpf_tcp_sock_is_valid_access(int off, int size, enum bpf_access_type type, @@ -1123,6 +1125,21 @@ static inline u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type, { return 0; } +static inline bool bpf_xdp_sock_is_valid_access(int off, int size, + enum bpf_access_type type, + struct bpf_insn_access_aux *info) +{ + return false; +} + +static inline u32 bpf_xdp_sock_convert_ctx_access(enum bpf_access_type type, + const struct bpf_insn *si, + struct bpf_insn *insn_buf, + struct bpf_prog *prog, + u32 *target_size) +{ + return 0; +} #endif /* CONFIG_INET */ #endif /* _LINUX_BPF_H */ -- 2.7.4