-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Daniel Borkmann says: ==================== pull-request: bpf 2020-04-10 The following pull-request contains BPF updates for your *net* tree. We've added 13 non-merge commits during the last 7 day(s) which contain a total of 13 files changed, 137 insertions(+), 43 deletions(-). The main changes are: 1) JIT code emission fixes for riscv and arm32, from Luke Nelson and Xi Wang. 2) Disable vmlinux BTF info if GCC_PLUGIN_RANDSTRUCT is used, from Slava Bacherikov. 3) Fix oob write in AF_XDP when meta data is used, from Li RongQing. 4) Fix bpf_get_link_xdp_id() handling on single prog when flags are specified, from Andrey Ignatov. 5) Fix sk_assign() BPF helper for request sockets that can have sk_reuseport field uninitialized, from Joe Stringer. 6) Fix mprotect() test case for the BPF LSM, from KP Singh. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
13 changed files
with
137 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
#include <linux/if_link.h> | ||
#include <test_progs.h> | ||
|
||
#define IFINDEX_LO 1 | ||
|
||
void test_xdp_info(void) | ||
{ | ||
__u32 len = sizeof(struct bpf_prog_info), duration = 0, prog_id; | ||
const char *file = "./xdp_dummy.o"; | ||
struct bpf_prog_info info = {}; | ||
struct bpf_object *obj; | ||
int err, prog_fd; | ||
|
||
/* Get prog_id for XDP_ATTACHED_NONE mode */ | ||
|
||
err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, 0); | ||
if (CHECK(err, "get_xdp_none", "errno=%d\n", errno)) | ||
return; | ||
if (CHECK(prog_id, "prog_id_none", "unexpected prog_id=%u\n", prog_id)) | ||
return; | ||
|
||
err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, XDP_FLAGS_SKB_MODE); | ||
if (CHECK(err, "get_xdp_none_skb", "errno=%d\n", errno)) | ||
return; | ||
if (CHECK(prog_id, "prog_id_none_skb", "unexpected prog_id=%u\n", | ||
prog_id)) | ||
return; | ||
|
||
/* Setup prog */ | ||
|
||
err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); | ||
if (CHECK_FAIL(err)) | ||
return; | ||
|
||
err = bpf_obj_get_info_by_fd(prog_fd, &info, &len); | ||
if (CHECK(err, "get_prog_info", "errno=%d\n", errno)) | ||
goto out_close; | ||
|
||
err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); | ||
if (CHECK(err, "set_xdp_skb", "errno=%d\n", errno)) | ||
goto out_close; | ||
|
||
/* Get prog_id for single prog mode */ | ||
|
||
err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, 0); | ||
if (CHECK(err, "get_xdp", "errno=%d\n", errno)) | ||
goto out; | ||
if (CHECK(prog_id != info.id, "prog_id", "prog_id not available\n")) | ||
goto out; | ||
|
||
err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, XDP_FLAGS_SKB_MODE); | ||
if (CHECK(err, "get_xdp_skb", "errno=%d\n", errno)) | ||
goto out; | ||
if (CHECK(prog_id != info.id, "prog_id_skb", "prog_id not available\n")) | ||
goto out; | ||
|
||
err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, XDP_FLAGS_DRV_MODE); | ||
if (CHECK(err, "get_xdp_drv", "errno=%d\n", errno)) | ||
goto out; | ||
if (CHECK(prog_id, "prog_id_drv", "unexpected prog_id=%u\n", prog_id)) | ||
goto out; | ||
|
||
out: | ||
bpf_set_link_xdp_fd(IFINDEX_LO, -1, 0); | ||
out_close: | ||
bpf_object__close(obj); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters