bpf: Explicitly memset the bpf_attr structure
For the bpf syscall, we are relying on the compiler to properly zero out
the bpf_attr union that we copy userspace data into. Unfortunately that
doesn't always work properly, padding and other oddities might not be
correctly zeroed, and in some tests odd things have been found when the
stack is pre-initialized to other values.
Fix this by explicitly memsetting the structure to 0 before using it.
Reported-by: Maciej Żenczykowski <email@example.com>
Reported-by: John Stultz <firstname.lastname@example.org>
Reported-by: Alexander Potapenko <email@example.com>
Reported-by: Alistair Delva <firstname.lastname@example.org>
Signed-off-by: Greg Kroah-Hartman <email@example.com>
Signed-off-by: Daniel Borkmann <firstname.lastname@example.org>
Acked-by: Yonghong Song <email@example.com>
1 file changed