uterm: vt: ignore non-kernel signals in real-mode

If using real linux VTs, we must ignore all signals that are not sent from
the kernel. Otherwise, we might get problems if we reuse SIGUSR for other
functionality.
Note that we already check that we are the active VT before handling
SIGUSR. However, this hardens this check to be more sure that this is
really the signal we want.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-08-12 10:21:11 +02:00
parent 4c1da1069d
commit 4f3cd2eecd

View File

@ -110,6 +110,9 @@ static void real_enter(struct uterm_vt *vt, struct signalfd_siginfo *info)
struct vt_stat vts;
int ret;
if (info->ssi_code != SI_KERNEL)
return;
ret = ioctl(vt->real_fd, VT_GETSTATE, &vts);
if (ret || vts.v_active != vt->real_num)
return;
@ -129,6 +132,9 @@ static void real_leave(struct uterm_vt *vt, struct signalfd_siginfo *info)
struct vt_stat vts;
int ret;
if (info->ssi_code != SI_KERNEL)
return;
ret = ioctl(vt->real_fd, VT_GETSTATE, &vts);
if (ret || vts.v_active != vt->real_num)
return;