From 4f3cd2eecdcf423a949baa7b98fbd957e0b0f44f Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sun, 12 Aug 2012 10:21:11 +0200 Subject: [PATCH] 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 --- src/uterm_vt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/uterm_vt.c b/src/uterm_vt.c index 477772c..d920a28 100644 --- a/src/uterm_vt.c +++ b/src/uterm_vt.c @@ -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;