minix/include
Ben Gras 565f13088f make vfs & filesystems use failable copying
Change the kernel to add features to vircopy and safecopies so that
transparent copy fixing won't happen to avoid deadlocks, and such copies
fail with EFAULT.

Transparently making copying work from filesystems (as normally done by
the kernel & VM when copying fails because of missing/readonly memory)
is problematic as it can happen that, for file-mapped ranges, that that
same filesystem that is blocked on the copy request is needed to satisfy
the memory range, leading to deadlock. Dito for VFS itself, if done with
a blocking call.

This change makes the copying done from a filesystem fail in such cases
with EFAULT by VFS adding the CPF_TRY flag to the grants. If a FS call
fails with EFAULT, VFS will then request the range to be made available
to VM after the FS is unblocked, allowing it to be used to satisfy the
range if need be in another VFS thread.

Similarly, for datacopies that VFS itself does, it uses the failable
vircopy variant and callers use a wrapper that talk to VM if necessary
to get the copy to work.

	. kernel: add CPF_TRY flag to safecopies
	. kernel: only request writable ranges to VM for the
	  target buffer when copying fails
	. do copying in VFS TRY-first
	. some fixes in VM to build SANITYCHECK mode
	. add regression test for the cases where
	  - a FS system call needs memory mapped in a process that the
	    FS itself must map.
	  - such a range covers more than one file-mapped region.
	. add 'try' mode to vircopy, physcopy
	. add flags field to copy kernel call messages
	. if CP_FLAG_TRY is set, do not transparently try
	  to fix memory ranges
	. for use by VFS when accessing user buffers to avoid
	  deadlock
	. remove some obsolete backwards compatability assignments
        . VFS: let thread scheduling work for VM requests too
          Allows VFS to make calls to VM while suspending and resuming
          the currently running thread. Does currently not work for the
          main thread.
        . VM: add fix memory range call for use by VFS

Change-Id: I295794269cea51a3163519a9cfe5901301d90b32
2014-07-28 17:05:14 +02:00
..
arch Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
arpa include/arpa/nameser_compat.h: merged 2014-03-03 20:47:00 +01:00
ddekit Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
minix make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
net <net/if_ether.h> 2014-03-03 20:47:04 +01:00
protocols Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
rpc Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
rpcsvc Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
ssp Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
sys <sys/ioccom.h>, <sys/ioctl.h> 2014-03-03 20:47:06 +01:00
a.out.h include/a.out.h: merged 2014-03-03 20:47:02 +01:00
aio.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ar.h Import NetBSD's make 2010-02-04 16:52:54 +00:00
assert.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
atomic.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
bitstring.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
bm.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
cdbr.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
cdbw.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
complex.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
cpio.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ctype.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
db.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
dirent.h netbsd dirent.h, import sys/sys *.h, mfs cleanup 2014-03-01 09:04:59 +01:00
disktab.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
dlfcn.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
env.h vm: make WARNS=5 proof 2013-09-06 11:51:20 +02:00
err.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
errno.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
fenv.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
fetch.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
fmtmsg.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
fnmatch.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
fstab.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
fts.h netbsd dirent.h, import sys/sys *.h, mfs cleanup 2014-03-01 09:04:59 +01:00
ftw.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getopt.h We have sys/cdefs.h now, so remove hacks. 2010-06-17 15:14:57 +00:00
glob.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
grp.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
hesiod.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
iconv.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ieeefp.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
ifaddrs.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
inttypes.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
iso646.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
kvm.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
langinfo.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
lib.h Rearrange endpoint number layout 2014-07-28 17:05:12 +02:00
libgen.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
libutil.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
limits.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
link.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
link_aout.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
link_elf.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
locale.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
login_cap.h include/login_cap.h: merged 2014-03-03 20:47:01 +01:00
lwp.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
Makefile Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
malloc.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
math.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
md2.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
memory.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
mntopts.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
monetary.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
mpool.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
mqueue.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ndbm.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
netconfig.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
netdb.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
netgroup.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
nl_types.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
nlist.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
nsswitch.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
paths.h include/paths.h: merged 2014-03-03 20:47:01 +01:00
pwd.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
quota.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
randomid.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ranlib.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
re_comp.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
regex.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
regexp.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
res_update.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
resolv.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
rmt.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
sched.h include/sched.h: merged 2014-03-03 20:47:03 +01:00
search.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
semaphore.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
setjmp.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
sgtty.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
signal.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
spawn.h adding include/spawn.h, removing include/sa.h 2014-03-03 20:47:02 +01:00
stab.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
stdbool.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
stddef.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
stdio.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
stdlib.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
string.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
stringlist.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strings.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
struct.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
sysexits.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
tar.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
tgmath.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
time.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
ttyent.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
tzfile.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ucontext.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
ulimit.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
unistd.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
util.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
utime.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
utmp.h big <utmp.h>-inspired netbsd switch 2014-03-01 09:05:02 +01:00
utmpx.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
uuid.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
varargs.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
vis.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
wchar.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
wctype.h Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
wordexp.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00