Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6-0]: src/sys/arch Pull up following revision(s) (requested by ts...



details:   https://anonhg.NetBSD.org/src/rev/cf6dffe10ea9
branches:  netbsd-6-0
changeset: 775005:cf6dffe10ea9
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Nov 03 16:47:29 2014 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1139):
        sys/arch/sun3/dev/fd.c: revision 1.78
        sys/arch/sparc/dev/fd.c: revision 1.155
        sys/arch/sparc64/dev/fdc.c: revision 1.42
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c:1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).
Should be pulled up to netbsd-7.
Sync with sparc/dev/fd.c rev 1.155.
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().
Note sun3 still uses gcc 4.5.4 but also panicked by this old bug,
so probably this problem was triggered by not gcc 4.8 but struct disk
changes (struct disk_geom was added in <sys/disk.h> rev 1.58),
which increased sizeof(struct fd_softc) from 248 bytes to 296 bytes.
(i.e. now struct fd_softc could be allocated in a different pool block,
 probably near the wrong pointer of the struct disklabel)
Anyway, this fix should be pullued up to netbsd-7.
(probably I'm the only user of floppy on sun3 though)

diffstat:

 sys/arch/sparc/dev/fd.c    |  6 +++---
 sys/arch/sparc64/dev/fdc.c |  6 +++---
 sys/arch/sun3/dev/fd.c     |  6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diffs (81 lines):

diff -r 1c6e8c56eba2 -r cf6dffe10ea9 sys/arch/sparc/dev/fd.c
--- a/sys/arch/sparc/dev/fd.c   Mon Nov 03 16:34:08 2014 +0000
+++ b/sys/arch/sparc/dev/fd.c   Mon Nov 03 16:47:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $     */
+/*     $NetBSD: fd.c,v 1.150.14.1 2014/11/03 16:47:29 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.150 2011/07/17 23:18:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.150.14.1 2014/11/03 16:47:29 msaitoh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -2227,7 +2227,7 @@
        struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel;
 
        memset(lp, 0, sizeof(struct disklabel));
-       memset(lp, 0, sizeof(struct cpu_disklabel));
+       memset(clp, 0, sizeof(struct cpu_disklabel));
 
        lp->d_type = DTYPE_FLOPPY;
        lp->d_secsize = FD_BSIZE(fd);
diff -r 1c6e8c56eba2 -r cf6dffe10ea9 sys/arch/sparc64/dev/fdc.c
--- a/sys/arch/sparc64/dev/fdc.c        Mon Nov 03 16:34:08 2014 +0000
+++ b/sys/arch/sparc64/dev/fdc.c        Mon Nov 03 16:47:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdc.c,v 1.36 2011/08/08 14:49:06 jakllsch Exp $        */
+/*     $NetBSD: fdc.c,v 1.36.14.1 2014/11/03 16:47:29 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.36 2011/08/08 14:49:06 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.36.14.1 2014/11/03 16:47:29 msaitoh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -2413,7 +2413,7 @@
        struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel;
 
        memset(lp, 0, sizeof(struct disklabel));
-       memset(lp, 0, sizeof(struct cpu_disklabel));
+       memset(clp, 0, sizeof(struct cpu_disklabel));
 
        lp->d_type = DTYPE_FLOPPY;
        lp->d_secsize = FD_BSIZE(fd);
diff -r 1c6e8c56eba2 -r cf6dffe10ea9 sys/arch/sun3/dev/fd.c
--- a/sys/arch/sun3/dev/fd.c    Mon Nov 03 16:34:08 2014 +0000
+++ b/sys/arch/sun3/dev/fd.c    Mon Nov 03 16:47:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.72 2011/07/16 20:25:28 mrg Exp $      */
+/*     $NetBSD: fd.c,v 1.72.14.1 2014/11/03 16:47:29 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.72 2011/07/16 20:25:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.72.14.1 2014/11/03 16:47:29 msaitoh Exp $");
 
 #include "opt_ddb.h"
 
@@ -1855,7 +1855,7 @@
        struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel;
 
        memset(lp, 0, sizeof(struct disklabel));
-       memset(lp, 0, sizeof(struct cpu_disklabel));
+       memset(clp, 0, sizeof(struct cpu_disklabel));
 
        lp->d_type = DTYPE_FLOPPY;
        lp->d_secsize = FDC_BSIZE;



Home | Main Index | Thread Index | Old Index