summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorkleink <kleink@NetBSD.org>2005-09-06 21:40:37 +0000
committerkleink <kleink@NetBSD.org>2005-09-06 21:40:37 +0000
commitaece7a90fd0f2feeb714e83a20e24f2206a1a45b (patch)
tree041b2a528dba9b81ece12e303295c1d444de74eb /sys/dev
parent6fa3ab87b7547e893d57f42c9ca81ba61bdb00fe (diff)
Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of privileges. Noted by David Holland in PR kern/31126.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/arcbios/arcbios_tty.c7
-rw-r--r--sys/dev/dec/dz.c7
-rw-r--r--sys/dev/hpc/biconsdev.c7
-rw-r--r--sys/dev/ic/cd18xx.c8
-rw-r--r--sys/dev/ic/com.c6
-rw-r--r--sys/dev/ic/cy.c7
-rw-r--r--sys/dev/ic/z8530tty.c6
-rw-r--r--sys/dev/marvell/gtmpsc.c6
-rw-r--r--sys/dev/pci/cz.c6
-rw-r--r--sys/dev/qbus/dl.c7
-rw-r--r--sys/dev/sbus/magma.c6
-rw-r--r--sys/dev/sbus/spif.c7
-rw-r--r--sys/dev/usb/ucom.c6
-rw-r--r--sys/dev/usb/ucycom.c6
-rw-r--r--sys/dev/wscons/wsdisplay.c6
15 files changed, 52 insertions, 46 deletions
diff --git a/sys/dev/arcbios/arcbios_tty.c b/sys/dev/arcbios/arcbios_tty.c
index e0fbe4552ab..482ca05bce9 100644
--- a/sys/dev/arcbios/arcbios_tty.c
+++ b/sys/dev/arcbios/arcbios_tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: arcbios_tty.c,v 1.9 2005/04/18 15:38:01 tsutsui Exp $ */
+/* $NetBSD: arcbios_tty.c,v 1.10 2005/09/06 21:40:39 kleink Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcbios_tty.c,v 1.9 2005/04/18 15:38:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcbios_tty.c,v 1.10 2005/09/06 21:40:39 kleink Exp $");
#include <sys/param.h>
#include <sys/user.h>
@@ -101,7 +101,8 @@ arcbios_ttyopen(dev_t dev, int flag, int mode, struct proc *p)
ttsetwater(tp);
setuptimeout = 1;
- } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) {
+ } else if (tp->t_state & TS_XCLUDE &&
+ suser(p->p_ucred, &p->p_acflag) != 0) {
splx(s);
return (EBUSY);
}
diff --git a/sys/dev/dec/dz.c b/sys/dev/dec/dz.c
index 8f43115edf1..5604eddfd9f 100644
--- a/sys/dev/dec/dz.c
+++ b/sys/dev/dec/dz.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dz.c,v 1.16 2005/02/27 00:26:59 perry Exp $ */
+/* $NetBSD: dz.c,v 1.17 2005/09/06 21:40:39 kleink Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dz.c,v 1.16 2005/02/27 00:26:59 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dz.c,v 1.17 2005/09/06 21:40:39 kleink Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -357,7 +357,8 @@ dzopen(dev_t dev, int flag, int mode, struct proc *p)
}
(void) dzparam(tp, &tp->t_termios);
ttsetwater(tp);
- } else if ((tp->t_state & TS_XCLUDE) && p->p_ucred->cr_uid != 0)
+ } else if ((tp->t_state & TS_XCLUDE) &&
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
/* Use DMBIS and *not* DMSET or else we clobber incoming bits */
if (dzmctl(sc, line, DML_DTR, DMBIS) & DML_DCD)
diff --git a/sys/dev/hpc/biconsdev.c b/sys/dev/hpc/biconsdev.c
index e70662da1af..afaec29834a 100644
--- a/sys/dev/hpc/biconsdev.c
+++ b/sys/dev/hpc/biconsdev.c
@@ -1,4 +1,4 @@
-/* $NetBSD: biconsdev.c,v 1.10 2003/08/07 16:30:57 agc Exp $ */
+/* $NetBSD: biconsdev.c,v 1.11 2005/09/06 21:40:39 kleink Exp $ */
/*-
* Copyright (c) 1999-2001
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: biconsdev.c,v 1.10 2003/08/07 16:30:57 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: biconsdev.c,v 1.11 2005/09/06 21:40:39 kleink Exp $");
#include "biconsdev.h"
#include <sys/param.h>
@@ -181,7 +181,8 @@ biconsdevopen(dev_t dev, int flag, int mode, struct proc *p)
tp->t_state = TS_ISOPEN | TS_CARR_ON;
(void)(*tp->t_param)(tp, &tp->t_termios);
ttsetwater(tp);
- } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0)
+ } else if (tp->t_state & TS_XCLUDE &&
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
status = (*tp->t_linesw->l_open)(dev, tp);
diff --git a/sys/dev/ic/cd18xx.c b/sys/dev/ic/cd18xx.c
index 242e341f782..386c37b3f05 100644
--- a/sys/dev/ic/cd18xx.c
+++ b/sys/dev/ic/cd18xx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cd18xx.c,v 1.10 2005/02/27 00:27:01 perry Exp $ */
+/* $NetBSD: cd18xx.c,v 1.11 2005/09/06 21:40:39 kleink Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd18xx.c,v 1.10 2005/02/27 00:27:01 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd18xx.c,v 1.11 2005/09/06 21:40:39 kleink Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -431,8 +431,8 @@ cdttyopen(dev, flag, mode, p)
/* enforce exclude */
if (tp == NULL ||
(ISSET(tp->t_state, TS_ISOPEN) &&
- ISSET(tp->t_state, TS_XCLUDE) &&
- (p->p_ucred->cr_uid != 0)))
+ ISSET(tp->t_state, TS_XCLUDE) &&
+ suser(p->p_ucred, &p->p_acflag) != 0))
return (EBUSY);
s = spltty();
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 44d09703305..9ec5caa3037 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.235 2005/09/04 09:48:53 kleink Exp $ */
+/* $NetBSD: com.c,v 1.236 2005/09/06 21:40:39 kleink Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.235 2005/09/04 09:48:53 kleink Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.236 2005/09/06 21:40:39 kleink Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -838,7 +838,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
s = spltty();
diff --git a/sys/dev/ic/cy.c b/sys/dev/ic/cy.c
index b858cc9ad96..18651e6f9dd 100644
--- a/sys/dev/ic/cy.c
+++ b/sys/dev/ic/cy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cy.c,v 1.37 2005/02/27 00:27:01 perry Exp $ */
+/* $NetBSD: cy.c,v 1.38 2005/09/06 21:40:39 kleink Exp $ */
/*
* cy.c
@@ -16,7 +16,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.37 2005/02/27 00:27:01 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cy.c,v 1.38 2005/09/06 21:40:39 kleink Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -369,7 +369,8 @@ cyopen(dev_t dev, int flag, int mode, struct proc *p)
SET(tp->t_state, TS_CARR_ON);
else
CLR(tp->t_state, TS_CARR_ON);
- } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) {
+ } else if (ISSET(tp->t_state, TS_XCLUDE) &&
+ suser(p->p_ucred, &p->p_acflag) != 0) {
return EBUSY;
} else {
s = spltty();
diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c
index 2f50dd11e26..c59e568ca7a 100644
--- a/sys/dev/ic/z8530tty.c
+++ b/sys/dev/ic/z8530tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: z8530tty.c,v 1.99 2005/06/30 12:07:51 macallan Exp $ */
+/* $NetBSD: z8530tty.c,v 1.100 2005/09/06 21:40:39 kleink Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -137,7 +137,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.99 2005/06/30 12:07:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.100 2005/09/06 21:40:39 kleink Exp $");
#include "opt_kgdb.h"
#include "opt_ntp.h"
@@ -580,7 +580,7 @@ zsopen(dev, flags, mode, p)
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
s = spltty();
diff --git a/sys/dev/marvell/gtmpsc.c b/sys/dev/marvell/gtmpsc.c
index 859f5e4b198..cd243400ffb 100644
--- a/sys/dev/marvell/gtmpsc.c
+++ b/sys/dev/marvell/gtmpsc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmpsc.c,v 1.11 2005/06/03 11:22:08 scw Exp $ */
+/* $NetBSD: gtmpsc.c,v 1.12 2005/09/06 21:40:39 kleink Exp $ */
/*
* Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.11 2005/06/03 11:22:08 scw Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.12 2005/09/06 21:40:39 kleink Exp $");
#include "opt_kgdb.h"
@@ -611,7 +611,7 @@ gtmpscopen(dev_t dev, int flag, int mode, struct proc *p)
tp = sc->gtmpsc_tty;
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
s = spltty();
diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c
index 6388ff5292e..93a380996f6 100644
--- a/sys/dev/pci/cz.c
+++ b/sys/dev/pci/cz.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cz.c,v 1.32 2005/06/28 00:28:41 thorpej Exp $ */
+/* $NetBSD: cz.c,v 1.33 2005/09/06 21:40:39 kleink Exp $ */
/*-
* Copyright (c) 2000 Zembu Labs, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.32 2005/06/28 00:28:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.33 2005/09/06 21:40:39 kleink Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -966,7 +966,7 @@ czttyopen(dev_t dev, int flags, int mode, struct proc *p)
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
s = spltty();
diff --git a/sys/dev/qbus/dl.c b/sys/dev/qbus/dl.c
index 4e7c0410fc1..2a1a08b9944 100644
--- a/sys/dev/qbus/dl.c
+++ b/sys/dev/qbus/dl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dl.c,v 1.29 2005/02/26 12:45:06 simonb Exp $ */
+/* $NetBSD: dl.c,v 1.30 2005/09/06 21:40:39 kleink Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dl.c,v 1.29 2005/02/26 12:45:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dl.c,v 1.30 2005/09/06 21:40:39 kleink Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -354,7 +354,8 @@ dlopen(dev_t dev, int flag, int mode, struct proc *p)
dlparam(tp, &tp->t_termios);
ttsetwater(tp);
- } else if ((tp->t_state & TS_XCLUDE) && p->p_ucred->cr_uid != 0)
+ } else if ((tp->t_state & TS_XCLUDE) &&
+ suser(p->p_ucred, &p->p_acflag) != 0)
return EBUSY;
return ((*tp->t_linesw->l_open)(dev, tp));
diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c
index c6cbd9854c9..3ee74d03ec0 100644
--- a/sys/dev/sbus/magma.c
+++ b/sys/dev/sbus/magma.c
@@ -1,4 +1,4 @@
-/* $NetBSD: magma.c,v 1.29 2005/02/27 00:27:48 perry Exp $ */
+/* $NetBSD: magma.c,v 1.30 2005/09/06 21:40:39 kleink Exp $ */
/*
* magma.c
*
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.29 2005/02/27 00:27:48 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.30 2005/09/06 21:40:39 kleink Exp $");
#if 0
#define MAGMA_DEBUG
@@ -926,7 +926,7 @@ mttyopen(dev, flags, mode, p)
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
s = spltty();
diff --git a/sys/dev/sbus/spif.c b/sys/dev/sbus/spif.c
index 1cf7846f8ed..3c7b5c73558 100644
--- a/sys/dev/sbus/spif.c
+++ b/sys/dev/sbus/spif.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spif.c,v 1.2 2005/02/27 00:27:48 perry Exp $ */
+/* $NetBSD: spif.c,v 1.3 2005/09/06 21:40:39 kleink Exp $ */
/* $OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $ */
/*
@@ -41,7 +41,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.2 2005/02/27 00:27:48 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.3 2005/09/06 21:40:39 kleink Exp $");
#include "spif.h"
#if NSPIF > 0
@@ -384,7 +384,8 @@ stty_open(dev, flags, mode, p)
else
CLR(tp->t_state, TS_CARR_ON);
}
- else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0) {
+ else if (ISSET(tp->t_state, TS_XCLUDE) &&
+ suser(p->p_ucred, &p->p_acflag) != 0) {
return (EBUSY);
} else {
s = spltty();
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c
index b83f634f641..db98f0b779a 100644
--- a/sys/dev/usb/ucom.c
+++ b/sys/dev/usb/ucom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ucom.c,v 1.57 2005/08/26 12:42:11 drochner Exp $ */
+/* $NetBSD: ucom.c,v 1.58 2005/09/06 21:40:45 kleink Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.57 2005/08/26 12:42:11 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.58 2005/09/06 21:40:45 kleink Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -329,7 +329,7 @@ ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p)
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
s = spltty();
diff --git a/sys/dev/usb/ucycom.c b/sys/dev/usb/ucycom.c
index a863b298534..15ea9bc93aa 100644
--- a/sys/dev/usb/ucycom.c
+++ b/sys/dev/usb/ucycom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ucycom.c,v 1.4 2005/09/01 18:10:20 skrll Exp $ */
+/* $NetBSD: ucycom.c,v 1.5 2005/09/06 21:40:45 kleink Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: ucycom.c,v 1.4 2005/09/01 18:10:20 skrll Exp $");
+__RCSID("$NetBSD: ucycom.c,v 1.5 2005/09/06 21:40:45 kleink Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -338,7 +338,7 @@ ucycomopen(dev_t dev, int flag, int mode, struct proc *p)
if (ISSET(tp->t_state, TS_ISOPEN) &&
ISSET(tp->t_state, TS_XCLUDE) &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return (EBUSY);
s = spltty();
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 892e852e42d..40e8dee8755 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.84 2005/06/21 14:01:13 ws Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.85 2005/09/06 21:40:45 kleink Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.84 2005/06/21 14:01:13 ws Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.85 2005/09/06 21:40:45 kleink Exp $");
#include "opt_wsdisplay_border.h"
#include "opt_wsdisplay_compat.h"
@@ -755,7 +755,7 @@ wsdisplayopen(dev_t dev, int flag, int mode, struct proc *p)
wsdisplayparam(tp, &tp->t_termios);
ttsetwater(tp);
} else if ((tp->t_state & TS_XCLUDE) != 0 &&
- p->p_ucred->cr_uid != 0)
+ suser(p->p_ucred, &p->p_acflag) != 0)
return EBUSY;
tp->t_state |= TS_CARR_ON;