From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B11EC43381 for ; Sat, 23 Feb 2019 01:07:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4571820700 for ; Sat, 23 Feb 2019 01:07:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=fb.com header.i=@fb.com header.b="IIctoIcU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727605AbfBWBHX (ORCPT ); Fri, 22 Feb 2019 20:07:23 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:44612 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725814AbfBWBHW (ORCPT ); Fri, 22 Feb 2019 20:07:22 -0500 Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1N0xF0N020719 for ; Fri, 22 Feb 2019 17:07:21 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=4YIFlynjP/joAMu+4MCbb+bbIaTyAut4fGyS1r3AQSY=; b=IIctoIcUO1FQsQI006P5AT+Mmx1QKeOdH+OWxvcNxawrjk9KVmrTB2wFwN4PAvrSU6dH //hLvAmPUzFJcoIsgttbKtJ/ShgYN4kuKo4eqfAWpvLTKn4ooxnwHosmNdXwznjXQPRp B5AzLoTLdIjEi7oNL3g6xJ4nODerwocJc3Q= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2qtubkr4ej-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 22 Feb 2019 17:07:21 -0800 Received: from mx-out.facebook.com (2620:10d:c081:10::13) by mail.thefacebook.com (2620:10d:c081:35::126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1531.3; Fri, 22 Feb 2019 17:07:20 -0800 Received: by devbig009.ftw2.facebook.com (Postfix, from userid 10340) id 36B605AE1524; Fri, 22 Feb 2019 17:07:19 -0800 (PST) Smtp-Origin-Hostprefix: devbig From: brakmo Smtp-Origin-Hostname: devbig009.ftw2.facebook.com To: netdev CC: Martin Lau , Alexei Starovoitov , Daniel Borkmann , Eric Dumazet , Kernel Team Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH v2 bpf-next 1/9] bpf: Remove const from get_func_proto Date: Fri, 22 Feb 2019 17:06:55 -0800 Message-ID: <20190223010703.678070-2-brakmo@fb.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190223010703.678070-1-brakmo@fb.com> References: <20190223010703.678070-1-brakmo@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-23_01:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Martin KaFai Lau The next patch needs to set a bit in "prog" in cg_skb_func_proto(). Hence, the "const struct bpf_prog *" as a second argument will not work. This patch removes the "const" from get_func_proto and makes the needed changes to all get_func_proto implementations to avoid compiler error. Signed-off-by: Martin KaFai Lau Signed-off-by: Lawrence Brakmo --- drivers/media/rc/bpf-lirc.c | 2 +- include/linux/bpf.h | 2 +- kernel/bpf/cgroup.c | 2 +- kernel/trace/bpf_trace.c | 10 +++++----- net/core/filter.c | 30 +++++++++++++++--------------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/media/rc/bpf-lirc.c b/drivers/media/rc/bpf-lirc.c index 390a722e6211..6adb7f734cb9 100644 --- a/drivers/media/rc/bpf-lirc.c +++ b/drivers/media/rc/bpf-lirc.c @@ -82,7 +82,7 @@ static const struct bpf_func_proto rc_pointer_rel_proto = { }; static const struct bpf_func_proto * -lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +lirc_mode2_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_rc_repeat: diff --git a/include/linux/bpf.h b/include/linux/bpf.h index de18227b3d95..d5ba2fc01af3 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -287,7 +287,7 @@ struct bpf_verifier_ops { /* return eBPF function prototype for verification */ const struct bpf_func_proto * (*get_func_proto)(enum bpf_func_id func_id, - const struct bpf_prog *prog); + struct bpf_prog *prog); /* return true if 'size' wide access at offset 'off' within bpf_context * with 'type' (read or write) is allowed diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 4e807973aa80..0de0f5d98b46 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -701,7 +701,7 @@ int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, EXPORT_SYMBOL(__cgroup_bpf_check_dev_permission); static const struct bpf_func_proto * -cgroup_dev_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +cgroup_dev_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_map_lookup_elem: diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index f1a86a0d881d..0d2f60828d7d 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -561,7 +561,7 @@ static const struct bpf_func_proto bpf_probe_read_str_proto = { }; static const struct bpf_func_proto * -tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +tracing_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_map_lookup_elem: @@ -610,7 +610,7 @@ tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -kprobe_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +kprobe_prog_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_perf_event_output: @@ -726,7 +726,7 @@ static const struct bpf_func_proto bpf_get_stack_proto_tp = { }; static const struct bpf_func_proto * -tp_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +tp_prog_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_perf_event_output: @@ -790,7 +790,7 @@ static const struct bpf_func_proto bpf_perf_prog_read_value_proto = { }; static const struct bpf_func_proto * -pe_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +pe_prog_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_perf_event_output: @@ -873,7 +873,7 @@ static const struct bpf_func_proto bpf_get_stack_proto_raw_tp = { }; static const struct bpf_func_proto * -raw_tp_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +raw_tp_prog_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_perf_event_output: diff --git a/net/core/filter.c b/net/core/filter.c index 85749f6ec789..97916eedfe69 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -5508,7 +5508,7 @@ bpf_base_func_proto(enum bpf_func_id func_id) } static const struct bpf_func_proto * -sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +sock_filter_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { /* inet and inet6 sockets are created in a process @@ -5524,7 +5524,7 @@ sock_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -sock_addr_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +sock_addr_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { /* inet and inet6 sockets are created in a process @@ -5558,7 +5558,7 @@ sock_addr_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -sk_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +sk_filter_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_skb_load_bytes: @@ -5575,7 +5575,7 @@ sk_filter_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +cg_skb_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_get_local_storage: @@ -5592,7 +5592,7 @@ cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +tc_cls_act_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_skb_store_bytes: @@ -5685,7 +5685,7 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +xdp_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_perf_event_output: @@ -5723,7 +5723,7 @@ const struct bpf_func_proto bpf_sock_map_update_proto __weak; const struct bpf_func_proto bpf_sock_hash_update_proto __weak; static const struct bpf_func_proto * -sock_ops_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +sock_ops_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_setsockopt: @@ -5751,7 +5751,7 @@ const struct bpf_func_proto bpf_msg_redirect_map_proto __weak; const struct bpf_func_proto bpf_msg_redirect_hash_proto __weak; static const struct bpf_func_proto * -sk_msg_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +sk_msg_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_msg_redirect_map: @@ -5777,7 +5777,7 @@ const struct bpf_func_proto bpf_sk_redirect_map_proto __weak; const struct bpf_func_proto bpf_sk_redirect_hash_proto __weak; static const struct bpf_func_proto * -sk_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +sk_skb_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_skb_store_bytes: @@ -5812,7 +5812,7 @@ sk_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -flow_dissector_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +flow_dissector_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_skb_load_bytes: @@ -5823,7 +5823,7 @@ flow_dissector_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -lwt_out_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +lwt_out_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_skb_load_bytes: @@ -5850,7 +5850,7 @@ lwt_out_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -lwt_in_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +lwt_in_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_lwt_push_encap: @@ -5861,7 +5861,7 @@ lwt_in_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -lwt_xmit_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +lwt_xmit_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_skb_get_tunnel_key: @@ -5898,7 +5898,7 @@ lwt_xmit_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) } static const struct bpf_func_proto * -lwt_seg6local_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) +lwt_seg6local_func_proto(enum bpf_func_id func_id, struct bpf_prog *prog) { switch (func_id) { #if IS_ENABLED(CONFIG_IPV6_SEG6_BPF) @@ -8124,7 +8124,7 @@ static const struct bpf_func_proto sk_reuseport_load_bytes_relative_proto = { static const struct bpf_func_proto * sk_reuseport_func_proto(enum bpf_func_id func_id, - const struct bpf_prog *prog) + struct bpf_prog *prog) { switch (func_id) { case BPF_FUNC_sk_select_reuseport: -- 2.17.1