Subject: kern/36303: ubc write yields zero bytes
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 05/10/2007 15:15:00
>Number:         36303
>Category:       kern
>Synopsis:       ubc write yields zero bytes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 10 15:15:00 +0000 2007
>Originator:     YAMAMOTO Takashi <>
>Release:        NetBSD 4.99.19
Architecture: i386
Machine: i386
	typical implementations of VOP_WRITE() do the following.
		1. ubc_alloc()
		2. uiomove()
		3. ubc_release()
		4. bump v_size.

	in the case of !PGO_FAULTBUSY, the above uiomove() can involve
	multiple page faults, because:
		- ubc_fault() can fail to map some pages.
		  eg. when pmap_enter() failed.
		- pages can be freed by other threads.  eg. pagedaemon.
		  (cf. PR/33152)

	on 2nd (or later) faults, because we have not bumped v_size yet,
	genfs_getpages can consider valid data copied by uiomove() as
	"tailbytes" and overwrite them with zero.
	code inspection.
	check PG_FAKE?