signalfd: fix information leak in signalfd_copyinfo
authorAmanieu d'Antras <amanieu@gmail.com>
Thu, 6 Aug 2015 22:46:33 +0000 (15:46 -0700)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:09:47 +0000 (13:09 +0000)
commit909e685c7d6408672131af7585dd3902edcaba1b
tree100cc2bc62e53acee1ed3021616f4eee040b94da
parente8f9af5b48e4f2a8e8f1d75dc24fbede63f1e0a0
signalfd: fix information leak in signalfd_copyinfo

commit 3ead7c52bdb0ab44f4bb1feed505a8323cc12ba7 upstream.

This function may copy the si_addr_lsb field to user mode when it hasn't
been initialized, which can leak kernel stack data to user mode.

Just checking the value of si_code is insufficient because the same
si_code value is shared between multiple signals.  This is solved by
checking the value of si_signo in addition to si_code.

Signed-off-by: Amanieu d'Antras <amanieu@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/signalfd.c