Subject: Re: Reading past device size (/dev/vnd v.s. /dev/cd)
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 01/20/2006 17:54:14
--8P1HSweYDcXXzwPJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Dear Takashi,

On Sat, Jan 21, 2006 at 12:24:25AM +0900, YAMAMOTO Takashi wrote:
> bounds_check_with_mediasize is used for raw partition.
> yes, their behaviours are inconsistent.

it doesn't matter if i use the raw partition or not really. :-/ they both 
are acting this way.

> > Any ideas? Should the KASSERT() in nestiobuf_iodone() be modified or should 
> > it detect this truncation of its transfer and flag an error?
> 
> the KASSERT is "correct" as nestiobuf doesn't work if i/o is truncated.
> to handle the condition, something similar to what kern_physio.c does
> is necessary.
> normally it isn't a problem because filesystems never try to read
> beyond the end of media.  does udf really need to do it?

No, it offcource it doesn't need that :) It's just that if someone tried to 
mount a truncated FS (not uncommon in cd/dvd land) or somehow corrupted FS 
that it wouldn't help to get a panic. I think it would thus be better to 
raise an error in nestiobuf_iodone() in that case.

idea?
Reinoud


--8P1HSweYDcXXzwPJ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQ9EVr4KcNwBDyKpoAQJBJggAxKocgtFYULD1ZNB+aGNYzKMrVDbgZXAv
MDdhGBJt+RIKr7lWPHk//jq6eZjI9VNE0FiYN3DpK81CCPZeTK+GDv5zBtQ2AURN
XaF8bQjOtM3lip7tojf8labovp53x6vrorN3vgmgm3JMSYSuZ8GGo3jDYiCTZPZ+
0bMOXHfUp4NxKR6/kXnQn4P3snBiBOxyve2ZMhcPRiuAyDaPSj6/D4bo/eUZpanL
M6uo3ezyEMe7cTOUMsF8QClrBUtiU62K0JeyVBZePy/nf0X2B8x1nxSuW+0Zo0aa
z+wCHSy7HJr9CEHeP/OzgD8jjGV7iMpYAtErlzJucOEYbaCtMDxeMA==
=YI82
-----END PGP SIGNATURE-----

--8P1HSweYDcXXzwPJ--