NetBSD Problem Report #41873

From bad@bsd.de  Tue Aug 11 20:56:04 2009
Return-Path: <bad@bsd.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id EFCB863C270
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 11 Aug 2009 20:56:03 +0000 (UTC)
Message-Id: <20090811205141.8177E122A7@sanctioned-parts-list.k.bsd.de>
Date: Tue, 11 Aug 2009 20:51:41 +0000 (UTC)
From: bad@bsd.de
Reply-To: bad@bsd.de
To: gnats-bugs@gnats.NetBSD.org
Subject: vnd >2GB reported as negative size
X-Send-Pr-Version: 3.95

>Number:         41873
>Category:       kern
>Synopsis:       vnconfig -vc prints negative size for vnds > 2GB
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 11 21:00:00 +0000 2009
>Closed-Date:    Sun Dec 06 16:35:55 +0000 2009
>Last-Modified:  Sun Dec 06 16:40:01 +0000 2009
>Originator:     Christoph Badura
>Release:        NetBSD 5.0_STABLE
>Organization:
netbsd bozotic software testing labs

>Environment:


System: NetBSD sanctioned-parts-list 5.0_STABLE NetBSD 5.0_STABLE (pe1400-dom0) #1: Wed Jul 22 19:43:01 UTC 2009 bad@arbitrary:/m/src/sys/arch/i386/compile/pe1400-dom0 i386
Architecture: i386
Machine: i386
>Description:

vnconfig -vc gives the size of the vnd as negative number when the size is
larger than 2GB.  E.g.:
# vnconfig -vc vnd0 zorch
/dev/rvnd0d: -1610612736 bytes on zorch

This is because vnd_size in struct vnd_ioctl is an int:
struct vnd_ioctl {
        char            *vnd_file;      /* pathname of file to mount */
        int             vnd_flags;      /* flags; see below */
        struct vndgeom  vnd_geom;       /* geometry to emulate */
        int             vnd_size;       /* (returned) size of disk */
};


>How-To-Repeat:

dd if=/dev/zero of=zorch bs=1m count=2049
vnconfig -vc vnd0 zorch
>Fix:

make vnd_size an off_t.

>Release-Note:

>Audit-Trail:
From: David Laight <dsl@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41873 CVS commit: src/sys/dev
Date: Sun, 6 Dec 2009 16:33:19 +0000

 Module Name:	src
 Committed By:	dsl
 Date:		Sun Dec  6 16:33:19 UTC 2009

 Modified Files:
 	src/sys/dev: vnd.c vndvar.h

 Log Message:
 Make vnd_size (the returned size) 64 bit, keeping old field for ioctl
 compatibility. Both fields are now unsigned.
 Add compatibility for the old ioctl size.
 Detect and error files which are definitely sparse (va_bytes < va_size).
 Part of fix for PR/41873.


 To generate a diff of this commit:
 cvs rdiff -u -r1.204 -r1.205 src/sys/dev/vnd.c
 cvs rdiff -u -r1.24 -r1.25 src/sys/dev/vndvar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dsl@NetBSD.org
State-Changed-When: Sun, 06 Dec 2009 16:35:55 +0000
State-Changed-Why:
Code fixed to use a 64bit unsigned size


From: David Laight <dsl@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/41873 CVS commit: src/usr.sbin/vnconfig
Date: Sun, 6 Dec 2009 16:35:16 +0000

 Module Name:	src
 Committed By:	dsl
 Date:		Sun Dec  6 16:35:16 UTC 2009

 Modified Files:
 	src/usr.sbin/vnconfig: vnconfig.c

 Log Message:
 VNDIOCSET now returns a 64bit unsigned size.
 Use compat ioctls if the kernel rejects the request.
 Fixes PR/41873.


 To generate a diff of this commit:
 cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/vnconfig/vnconfig.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.