diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2020-05-18 15:05:27 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-05-19 17:56:34 +0200 |
commit | d800bad67d4c21aaf11722f04e0f7547fb915ab5 (patch) | |
tree | e7dbca49e7a5c1b6a8c5bd42acec8624903914df /kernel/bpf | |
parent | samples, bpf: Refactor kprobe, tail call kern progs map definition (diff) | |
download | linux-d800bad67d4c21aaf11722f04e0f7547fb915ab5.tar.xz linux-d800bad67d4c21aaf11722f04e0f7547fb915ab5.zip |
bpf: Fix too large copy from user in bpf_test_init
Commit bc56c919fce7 ("bpf: Add xdp.frame_sz in bpf_prog_test_run_xdp().")
recently changed bpf_prog_test_run_xdp() to use larger frames for XDP in
order to test tail growing frames (via bpf_xdp_adjust_tail) and to have
memory backing frame better resemble drivers.
The commit contains a bug, as it tries to copy the max data size from
userspace, instead of the size provided by userspace. This cause XDP
unit tests to fail sporadically with EFAULT, an unfortunate behavior.
The fix is to only copy the size specified by userspace.
Fixes: bc56c919fce7 ("bpf: Add xdp.frame_sz in bpf_prog_test_run_xdp().")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/158980712729.256597.6115007718472928659.stgit@firesoul
Diffstat (limited to 'kernel/bpf')
0 files changed, 0 insertions, 0 deletions