From: Peter Hurley Date: Mon, 19 Jan 2015 18:05:03 +0000 (-0500) Subject: tty: Prevent untrappable signals from malicious program X-Git-Tag: v3.2.69~194 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a712f0118bd7356412e86940b30aaf7de0fe3f89;p=pandora-kernel.git tty: Prevent untrappable signals from malicious program commit 37480a05685ed5b8e1b9bf5e5c53b5810258b149 upstream. Commit 26df6d13406d1a5 ("tty: Add EXTPROC support for LINEMODE") allows a process which has opened a pty master to send _any_ signal to the process group of the pty slave. Although potentially exploitable by a malicious program running a setuid program on a pty slave, it's unknown if this exploit currently exists. Limit to signals actually used. Cc: Theodore Ts'o Cc: Howard Chu Cc: One Thousand Gnomes Cc: Jiri Slaby Signed-off-by: Peter Hurley Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 473592859226..e753be209d7c 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -175,6 +175,9 @@ static int pty_signal(struct tty_struct *tty, int sig) unsigned long flags; struct pid *pgrp; + if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP) + return -EINVAL; + if (tty->link) { spin_lock_irqsave(&tty->link->ctrl_lock, flags); pgrp = get_pid(tty->link->pgrp);