Date: Sun, 8 Sep 1996 17:40:03 -0700 (PDT) From: GNU GNATS <gnats> To: undisclosed-recipients:; Subject: bin/1585: dumpfs can dump core Message-ID: <199609090040.RAA08143@freefall.freebsd.org> Resent-Message-ID: <199609090040.RAA08143@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 1585 >Category: bin >Synopsis: dumpfs can dump core >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Sep 8 17:40:01 PDT 1996 >Last-Modified: >Originator: Giles Lean >Organization: >Release: FreeBSD 2.2-CURRENT i386 >Environment: 2.2-current >Description: dumpfs blindly trusts that it is working on a filesystem. >How-To-Repeat: (No filesystem creaed on /dev/rsd1e) # dumpfs /dev/rsd1e magic 0 time Thu Jan 1 10:00:00 1970 cylgrp dynamic inodes 4.2/4.3BSD nbfree 0 ndir 0 nifree 0 nffree 0 ncg 0 ncyl 0 size 0 blocks 0 bsize 0 shift 0 mask 0x00000000 fsize 0 shift 0 mask 0x00000000 frag 0 shift 0 fsbtodb 0 Floating point exception (core dumped) # >Fix: Test for FS_MAGIC. This fix is taken from NetBSD PR bin/249, closed in December 1994. (Am I the only person in the world who uses dumpfs on the wrong partition? :) --- dumpfs.c-old Mon Sep 9 10:26:30 1996 +++ dumpfs.c Mon Sep 9 10:30:22 1996 @@ -47,6 +47,7 @@ #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> +#include <err.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -114,6 +115,13 @@ goto err; if (read(fd, &afs, SBSIZE) != SBSIZE) goto err; + + if (afs.fs_magic != FS_MAGIC) { + warnx("%s: superblock has bad magic number, skipping.", + name); + (void) close(fd); + return (1); + } if (afs.fs_postblformat == FS_42POSTBLFMT) afs.fs_nrpos = 8; >Audit-Trail: >Unformatted: >Received: from topaz.nemeton.com.au (topaz.nemeton.com.au [203.8.3.18]) by nemeton.com.au (8.7.5/8.7.3) with ESMTP id KAA18337 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 9 Sep 1996 10:40:40 +1000 (EST) Received: from topaz.nemeton.com.au (topaz.nemeton.com.au [203.8.3.18]) by nemeton.com.au (8.7.5/8.7.3) with ESMTP id KAA18337 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 9 Sep 1996 10:40:40 +1000 (EST) Received: (from giles@localhost) by topaz.nemeton.com.au (8.7.5/8.7.3) id KAA00376; Mon, 9 Sep 1996 10:40:25 +1000 (EST) Date: Mon, 9 Sep 1996 10:40:25 +1000 (EST) From: Giles Lean <giles@nemeton.com.au> Message-Id: <199609090040.KAA00376@topaz.nemeton.com.au> To: FreeBSD-gnats-submit@freebsd.org Subject: dumpfs can dump core Reply-To: giles@nemeton.com.au X-send-pr-version: 3.2 Content-Type: text
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609090040.RAA08143>