summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/linux_machdep.c44
1 files changed, 35 insertions, 9 deletions
diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c
index fd946fcd964..2a04de13f07 100644
--- a/sys/arch/i386/i386/linux_machdep.c
+++ b/sys/arch/i386/i386/linux_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_machdep.c,v 1.16 2001/05/01 19:15:16 aaron Exp $ */
+/* $OpenBSD: linux_machdep.c,v 1.17 2001/07/27 06:10:38 csapuntz Exp $ */
/* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */
/*
@@ -499,32 +499,58 @@ linux_machdepioctl(p, v, retval)
case LINUX_VT_OPENQRY:
com = VT_OPENQRY;
break;
- case LINUX_VT_GETMODE:
+ case LINUX_VT_GETMODE: {
+ int sig;
+
SCARG(&bia, com) = VT_GETMODE;
if ((error = sys_ioctl(p, &bia, retval)))
return error;
if ((error = copyin(SCARG(uap, data), (caddr_t)&lvt,
sizeof (struct vt_mode))))
return error;
- lvt.relsig = bsd_to_linux_sig[lvt.relsig];
- lvt.acqsig = bsd_to_linux_sig[lvt.acqsig];
- lvt.frsig = bsd_to_linux_sig[lvt.frsig];
+ /* We need to bounds check here in case there
+ is a race with another thread */
+ if ((error = bsd_to_linux_signal(lvt.relsig, &sig)))
+ return error;
+ lvt.relsig = sig;
+
+ if ((error = bsd_to_linux_signal(lvt.acqsig, &sig)))
+ return error;
+ lvt.acqsig = sig;
+
+ if ((error = bsd_to_linux_signal(lvt.frsig, &sig)))
+ return error;
+ lvt.frsig = sig;
+
return copyout((caddr_t)&lvt, SCARG(uap, data),
sizeof (struct vt_mode));
- case LINUX_VT_SETMODE:
+ }
+ case LINUX_VT_SETMODE: {
+ int sig;
+
com = VT_SETMODE;
if ((error = copyin(SCARG(uap, data), (caddr_t)&lvt,
sizeof (struct vt_mode))))
return error;
- lvt.relsig = linux_to_bsd_sig[lvt.relsig];
- lvt.acqsig = linux_to_bsd_sig[lvt.acqsig];
- lvt.frsig = linux_to_bsd_sig[lvt.frsig];
+ if ((error = linux_to_bsd_signal(lvt.relsig, &sig)))
+ return error;
+ lvt.relsig = sig;
+
+ if ((error = linux_to_bsd_signal(lvt.acqsig, &sig)))
+ return error;
+ lvt.acqsig = sig;
+
+ if ((error = linux_to_bsd_signal(lvt.frsig, &sig)))
+ return error;
+ lvt.frsig = sig;
+
sg = stackgap_init(p->p_emul);
bvtp = stackgap_alloc(&sg, sizeof (struct vt_mode));
if ((error = copyout(&lvt, bvtp, sizeof (struct vt_mode))))
return error;
SCARG(&bia, data) = bvtp;
break;
+ }
case LINUX_VT_DISALLOCATE:
/* XXX should use WSDISPLAYIO_DELSCREEN */
return 0;