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 <firstname.lastname@example.org>
Reported-by: John Stultz <email@example.com>
Reported-by: Alexander Potapenko <firstname.lastname@example.org>
Reported-by: Alistair Delva <email@example.com>
Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
Signed-off-by: Daniel Borkmann <email@example.com>
Acked-by: Yonghong Song <firstname.lastname@example.org>
1 file changed