Lilith >_> and Claudio Bozzato of Cisco Talos security team reported
that collect_syscall() improperly casts the syscall registers to 64-bit
values leaking the uninitialized last 24 bytes on 32-bit platforms, that
are visible in /proc/self/syscall.
The cause is that info->data.args are u64 while syscall_get_arguments()
uses longs, as hinted by the bogus pointer cast in the function.
Let's just proceed like the other call places, by retrieving the
registers into an array of longs before assigning them to the caller's
array. This was successfully tested on x86_64, i386 and ppc32.
Reference: CVE-2020-28588, TALOS-2020-1211
631b7abacd ("ptrace: Remove maxargs from task_current_syscall()")
Cc: Greg KH <email@example.com>
Reviewed-by: Kees Cook <firstname.lastname@example.org>
Tested-by: Michael Ellerman <email@example.com> (ppc32)
Signed-off-by: Willy Tarreau <firstname.lastname@example.org>
Reviewed-by: Thomas Gleixner <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>