From e6af3c69e823e925dd5ee02514819504478c5b3d Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Thu, 20 Nov 1997 17:07:21 +0000 Subject: [PATCH] Don't allow setting the dump device to any partition except the one traditionally reserved for swap devices. The restrictions should now be the same as the ones for dumpsys(). The restriction on the partition should be removed someday, and dumpsys() shouldn't repeat all the checks. --- sys/amd64/amd64/autoconf.c | 9 ++++++++- sys/i386/i386/autoconf.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c index 07287695ce6f..c12c723ea2c3 100644 --- a/sys/amd64/amd64/autoconf.c +++ b/sys/amd64/amd64/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.77 1997/09/23 17:14:37 bde Exp $ + * $Id: autoconf.c,v 1.78 1997/10/26 04:36:11 nate Exp $ */ /* @@ -396,6 +396,13 @@ setdumpdev(dev) psize = bdevsw[maj]->d_psize(dev); if (psize == -1) return (ENXIO); /* XXX should be ENODEV ? */ + /* + * XXX should clean up checking in dumpsys() to be more like this, + * and nuke dodump sysctl (too many knobs), and move this to + * kern_shutdown.c... + */ + if (dkpart(dev) != SWAP_PART) + return (ENODEV); newdumplo = psize - Maxmem * PAGE_SIZE / DEV_BSIZE; if (newdumplo < 0) return (ENOSPC); diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index 07287695ce6f..c12c723ea2c3 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.77 1997/09/23 17:14:37 bde Exp $ + * $Id: autoconf.c,v 1.78 1997/10/26 04:36:11 nate Exp $ */ /* @@ -396,6 +396,13 @@ setdumpdev(dev) psize = bdevsw[maj]->d_psize(dev); if (psize == -1) return (ENXIO); /* XXX should be ENODEV ? */ + /* + * XXX should clean up checking in dumpsys() to be more like this, + * and nuke dodump sysctl (too many knobs), and move this to + * kern_shutdown.c... + */ + if (dkpart(dev) != SWAP_PART) + return (ENODEV); newdumplo = psize - Maxmem * PAGE_SIZE / DEV_BSIZE; if (newdumplo < 0) return (ENOSPC);