diff options
author | julian <julian@FreeBSD.org> | 1995-11-29 12:38:49 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1995-11-29 12:38:49 +0000 |
commit | 1758bf79ff52b23e5828e97e6ed62be161d761bf (patch) | |
tree | df6dd6d66e59ff032233912a9ab538539945f4f6 | |
parent | e9b6a008cf513b0c36b6787afae1bf903ef945fb (diff) | |
download | FreeBSD-src-1758bf79ff52b23e5828e97e6ed62be161d761bf.zip FreeBSD-src-1758bf79ff52b23e5828e97e6ed62be161d761bf.tar.gz |
#ifdef out nearly the entire file of conf.c when JREMOD is defined
add a few safety checks in specfs because
now it's possible to get entries in [cd]devsw[] which are ALL NULL
so it's better to discover this BEFORE jumping into the d_open() entry..
more check to come later.. this getsthe code to the stage where I
can start testing it, even if I haven't caught every little error case...
I guess I'll find them quick enough..
-rw-r--r-- | sys/fs/specfs/spec_vnops.c | 10 | ||||
-rw-r--r-- | sys/i386/i386/conf.c | 22 | ||||
-rw-r--r-- | sys/kern/kern_conf.c | 7 | ||||
-rw-r--r-- | sys/miscfs/specfs/spec_vnops.c | 10 |
4 files changed, 42 insertions, 7 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index db91648..43ca2b6 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)spec_vnops.c 8.6 (Berkeley) 4/9/94 - * $Id: spec_vnops.c,v 1.17 1995/11/09 08:16:15 bde Exp $ + * $Id: spec_vnops.c,v 1.18 1995/11/18 12:49:14 bde Exp $ */ #include <sys/param.h> @@ -154,6 +154,10 @@ spec_open(ap) case VCHR: if ((u_int)maj >= nchrdev) return (ENXIO); +#ifdef JREMOD + if ( cdevsw[maj].d_open == NULL) + return ENXIO; +#endif /*JREMOD*/ if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) { /* * When running in very secure mode, do not allow @@ -185,6 +189,10 @@ spec_open(ap) case VBLK: if ((u_int)maj >= nblkdev) return (ENXIO); +#ifdef JREMOD + if ( bdevsw[maj].d_open == NULL) + return ENXIO; +#endif /*JREMOD*/ /* * When running in very secure mode, do not allow * opens for writing of any disk block devices. diff --git a/sys/i386/i386/conf.c b/sys/i386/i386/conf.c index 3f60d83..997101d 100644 --- a/sys/i386/i386/conf.c +++ b/sys/i386/i386/conf.c @@ -42,7 +42,7 @@ * SUCH DAMAGE. * * from: @(#)conf.c 5.8 (Berkeley) 5/12/91 - * $Id: conf.c,v 1.105 1995/11/06 00:35:44 bde Exp $ + * $Id: conf.c,v 1.106 1995/11/11 05:10:48 bde Exp $ */ #include <sys/param.h> @@ -54,6 +54,17 @@ #include <sys/tty.h> #include <sys/conf.h> +#ifdef JREMOD + +#define NUMCDEV 96 +#define NUMBDEV 32 + +struct bdevsw bdevsw[NUMBDEV]; +int nblkdev = NUMBDEV +struct cdevsw cdevsw[NUMCDEV]; +int nchrdev = NUMCDEV + +#else /*JREMOD*/ /* Bogus defines for compatibility. */ #define noioc noioctl #define nostrat nostrategy @@ -874,6 +885,11 @@ struct cdevsw cdevsw[] = }; int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]); +#endif /*JREMOD*/ +/* + * The routines below are total "BULLSHIT" and will be trashed + * When I have 'proved' the JREMOD changes above.. + */ /* * Swapdev is a fake device implemented @@ -1021,7 +1037,11 @@ register_cdev(name, cdp) dst_cdp = getcdevbyname(name); if (dst_cdp == NULL) return (ENXIO); +#ifdef JREMOD + if ((dst_cdp->d_open != nxopen) && (dst_cdp->d_open != NULL)) +#else /*JREMOD*/ if (dst_cdp->d_open != nxopen) +#endif /*JREMOD*/ return (EBUSY); *dst_cdp = *cdp; return (0); diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 4c5f57c..fabff12 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -30,14 +30,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_conf.c,v 1.2 1995/10/02 10:15:40 julian Exp $ + * $Id: kern_conf.c,v 1.3 1995/10/04 08:58:00 julian Exp $ */ #include <sys/param.h> #include <sys/types.h> #include <sys/systm.h> #include <sys/conf.h> -extern d_open_t lkmenodev; /* * (re)place an entry in the bdevsw or cdevsw table @@ -54,8 +53,8 @@ int TTYPE##_add(dev_t *descrip, \ * Search the table looking for a slot... \ */ \ for (i = 0; i < NXXXDEV; i++) \ - if (TTYPE[i].d_open == lkmenodev) \ - break; /* found it! */ \ + if (TTYPE[i].d_open == NULL) \ + break; /* found one! */ \ /* out of allocable slots? */ \ if (i == NXXXDEV) { \ return ENFILE; \ diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index db91648..43ca2b6 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)spec_vnops.c 8.6 (Berkeley) 4/9/94 - * $Id: spec_vnops.c,v 1.17 1995/11/09 08:16:15 bde Exp $ + * $Id: spec_vnops.c,v 1.18 1995/11/18 12:49:14 bde Exp $ */ #include <sys/param.h> @@ -154,6 +154,10 @@ spec_open(ap) case VCHR: if ((u_int)maj >= nchrdev) return (ENXIO); +#ifdef JREMOD + if ( cdevsw[maj].d_open == NULL) + return ENXIO; +#endif /*JREMOD*/ if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) { /* * When running in very secure mode, do not allow @@ -185,6 +189,10 @@ spec_open(ap) case VBLK: if ((u_int)maj >= nblkdev) return (ENXIO); +#ifdef JREMOD + if ( bdevsw[maj].d_open == NULL) + return ENXIO; +#endif /*JREMOD*/ /* * When running in very secure mode, do not allow * opens for writing of any disk block devices. |