bpf: Change bpf_obj_name_cpy() to better ensure map's name is init by 0
authorMartin KaFai Lau <kafai@fb.com>
Fri, 6 Oct 2017 04:52:11 +0000 (21:52 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Oct 2017 22:29:39 +0000 (23:29 +0100)
commit473d97343f94ff20f5196078314e4dd83156d3a2
tree0b740f409d0dd6eea79ff5b16c0711232d4e0e61
parentf192970de860d3ab90aa9e2a22853201a57bde78
bpf: Change bpf_obj_name_cpy() to better ensure map's name is init by 0

During get_info_by_fd, the prog/map name is memcpy-ed.  It depends
on the prog->aux->name and map->name to be zero initialized.

bpf_prog_aux is easy to guarantee that aux->name is zero init.

The name in bpf_map may be harder to be guaranteed in the future when
new map type is added.

Hence, this patch makes bpf_obj_name_cpy() to always zero init
the prog/map name.

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/syscall.c