]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
signal: Guard against negative signal numbers in copy_siginfo_from_user32
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 11 Oct 2018 01:29:44 +0000 (20:29 -0500)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:57:21 +0000 (19:57 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836802
commit a36700589b85443e28170be59fa11c8a104130a5 upstream.

While fixing an out of bounds array access in known_siginfo_layout
reported by the kernel test robot it became apparent that the same bug
exists in siginfo_layout and affects copy_siginfo_from_user32.

The straight forward fix that makes guards against making this mistake
in the future and should keep the code size small is to just take an
unsigned signal number instead of a signed signal number, as I did to
fix known_siginfo_layout.

Cc: stable@vger.kernel.org
Fixes: cc731525f26a ("signal: Remove kernel interal si_code magic")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/linux/signal.h
kernel/signal.c

index 042968dd98f01083633b9d07d43b7ebf068e24aa..843bd62b1eadf03962ada053a0ab991e6fcc81b1 100644 (file)
@@ -34,7 +34,7 @@ enum siginfo_layout {
 #endif
 };
 
-enum siginfo_layout siginfo_layout(int sig, int si_code);
+enum siginfo_layout siginfo_layout(unsigned sig, int si_code);
 
 /*
  * Define some primitives to manipulate sigset_t.
index 70573fea20d155718b5163352ce25072de89c996..3d876d4d98197ed6c69b0df4ef3f3ef69880f591 100644 (file)
@@ -2684,7 +2684,7 @@ COMPAT_SYSCALL_DEFINE2(rt_sigpending, compat_sigset_t __user *, uset,
 }
 #endif
 
-enum siginfo_layout siginfo_layout(int sig, int si_code)
+enum siginfo_layout siginfo_layout(unsigned sig, int si_code)
 {
        enum siginfo_layout layout = SIL_KILL;
        if ((si_code > SI_USER) && (si_code < SI_KERNEL)) {