[RFC][PATCH 08/20] vt: Update the virtual console to handlepspaces.

From: Eric W. Biederman
Date: Mon Feb 06 2006 - 14:45:44 EST




Currently I am lazy and disable all advanced signal sending
features of virtual consoles if you are not a member of the initial
process id space. Not quite right but it certainly saves the
reference counting hassle, and it is unlikely that anyone cares at
this point.


Fix this when I get pspace disappearence notifiers.

Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>


---

drivers/char/keyboard.c | 3 ++-
drivers/char/vt.c | 2 +-
drivers/char/vt_ioctl.c | 9 +++++++--
3 files changed, 10 insertions(+), 4 deletions(-)

74c362e5aab6c780cf6a27d861874e71cebc8b2e
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 8b603b2..511dad7 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -33,6 +33,7 @@
#include <linux/string.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/pspace.h>

#include <linux/kbd_kern.h>
#include <linux/kbd_diacr.h>
@@ -568,7 +569,7 @@ static void fn_compose(struct vc_data *v
static void fn_spawn_con(struct vc_data *vc, struct pt_regs *regs)
{
if (spawnpid)
- if (kill_proc(spawnpid, spawnsig, 1))
+ if (kill_proc(&init_pspace, spawnpid, spawnsig, 1))
spawnpid = 0;
}

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0900d1d..e354c56 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -856,7 +856,7 @@ int vc_resize(struct vc_data *vc, unsign
ws.ws_ypixel = vc->vc_scan_lines;
if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) &&
vc->vc_tty->pgrp > 0)
- kill_pg(vc->vc_tty->pgrp, SIGWINCH, 1);
+ kill_pg(vc->vc_tty->pspace, vc->vc_tty->pgrp, SIGWINCH, 1);
*cws = ws;
}

diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 24011e7..431c3ed 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -26,6 +26,7 @@
#include <linux/console.h>
#include <linux/signal.h>
#include <linux/timex.h>
+#include <linux/pspace.h>

#include <asm/io.h>
#include <asm/uaccess.h>
@@ -649,6 +650,8 @@ int vt_ioctl(struct tty_struct *tty, str
extern int spawnpid, spawnsig;
if (!perm || !capable(CAP_KILL))
return -EPERM;
+ if (current->pspace != &init_pspace)
+ return -EPERM;
if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
return -EINVAL;
spawnpid = current->pid;
@@ -666,6 +669,8 @@ int vt_ioctl(struct tty_struct *tty, str
return -EFAULT;
if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS)
return -EINVAL;
+ if ((tmp.mode == VT_PROCESS) && (current->pspace != &init_pspace))
+ return -EINVAL;
acquire_console_sem();
vc->vt_mode = tmp;
/* the frsig is ignored, so we set it to 0 */
@@ -1113,7 +1118,7 @@ static void complete_change_console(stru
* tell us if the process has gone or something else
* is awry
*/
- if (kill_proc(vc->vt_pid, vc->vt_mode.acqsig, 1) != 0) {
+ if (kill_proc(&init_pspace, vc->vt_pid, vc->vt_mode.acqsig, 1) != 0) {
/*
* The controlling process has died, so we revert back to
* normal operation. In this case, we'll also change back
@@ -1173,7 +1178,7 @@ void change_console(struct vc_data *new_
* tell us if the process has gone or something else
* is awry
*/
- if (kill_proc(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) {
+ if (kill_proc(&init_pspace, vc->vt_pid, vc->vt_mode.relsig, 1) == 0) {
/*
* It worked. Mark the vt to switch to and
* return. The process needs to send us a
--
1.1.5.g3480

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/