]> granicus.if.org Git - strace/commit
bpf: change handling of big and unaccessible data to match the kernel
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 26 Jul 2017 10:28:25 +0000 (10:28 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 26 Jul 2017 10:28:25 +0000 (10:28 +0000)
commit26b3867cef82d9d73850e8c70b354de60f4fb883
treedc097b7624fbf91adb9475c9b58bc4540087bce1
parent055e9527bfabda222a231f7bd132e4ba745278a6
bpf: change handling of big and unaccessible data to match the kernel

When the size argument exceeds PAGE_SIZE, the kernel fails with E2BIG
without parsing union bpf_attr.
When the whole chunk of memory specified by addr and size arguments is
not readable, the kernel fails with EFAULT.

* bpf.c (DECL_BPF_CMD_DECODER) <bpf_cmd_decoder>: Add const qualifier
to size argument, add data argument.
(decode_BPF_MAP_CREATE, decode_BPF_MAP_UPDATE_ELEM,
decode_BPF_MAP_DELETE_ELEM, bpf_map_io, decode_BPF_PROG_LOAD,
bpf_obj_manage, bpf_prog_attach_detach): Move size argument check and
memory fetching ...
(SYS_FUNC(bpf)) ... here, add PAGE_SIZE check, pass fetched memory
to command-specific parsers.
bpf.c