Subject: Solved: swap_pager_clean problem (sun3 patch included)
To: None <netbsd-help@NetBSD.ORG>
From: Jari Kokko <jkokko@cc.hut.fi>
List: netbsd-help
Date: 12/07/1996 16:41:21
>This was a problem on a number of ports caused by a bogus check to see if
>a disk write operation would overwrite the disklabel. The bug would be
>triggered if you have zero-sized `a' partition and some other partition
>(say, used for swap) located at the start of the disk.
>
>Fixed in -current (for the sun3 in any case).

I got the current /sys/arch/sun3/sun3/disksubr.c and replaced the 1.2
release version with it. Thankfully  nothing else had been done to it
to make it incompatible with 1.2...

Jari Kokko

PS.

Here's the diff, if anyone else not wanting to start using current
wants to get rid of this problem:

--- disksubr.c.orig     Sun May  5 09:00:31 1996
+++ disksubr.c  Sat Dec  7 15:45:03 1996
@@ -1,4 +1,4 @@
-/*     $NetBSD: disksubr.c,v 1.13 1996/05/05 06:00:31 gwr Exp $        */
+/*     $NetBSD: disksubr.c,v 1.14 1996/09/26 18:10:21 gwr Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Gordon W. Ross
@@ -235,14 +235,14 @@
 bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
 {
        struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
-       int labelsect = lp->d_partitions[0].p_offset;
        int maxsz = p->p_size;
        int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
 
        /* overwriting disk label ? */
        /* XXX should also protect bootstrap in first 8K */
-       if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
-           (bp->b_flags & B_READ) == 0 && wlabel == 0)
+       /* XXX PR#2598: labelsect is always sector zero. */
+       if (((bp->b_blkno + p->p_offset) <= LABELSECTOR) &&
+           ((bp->b_flags & B_READ) == 0) && (wlabel == 0))
        {
                bp->b_error = EROFS;
                goto bad;