diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2018-07-30 00:17:00 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2018-07-30 00:17:00 +0000 |
commit | 2b10feab4dca840f167c3434ae8956850b3366e9 (patch) | |
tree | a29850273fcc5c4ba5a1f15db808c03b3f078630 | |
parent | 69056ccd2aee43fd3f3226dbd8efceb5833bfe81 (diff) |
Allow for us to do a CREATE style lookup on a read only filesystem
if and only if we are unveil doing it. Fixes an issue noticed
by kn@ where unveil would fail with EROFS on a read only filesystem
-rw-r--r-- | sys/kern/vfs_lookup.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 484889c7cd2..efda601ea0d 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_lookup.c,v 1.71 2018/07/13 09:25:23 beck Exp $ */ +/* $OpenBSD: vfs_lookup.c,v 1.72 2018/07/30 00:16:59 beck Exp $ */ /* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */ /* @@ -558,11 +558,13 @@ dirloop: } /* * If creating and at end of pathname, then can consider - * allowing file to be created. + * allowing file to be created. Check for a read only + * filesystem and disallow this unless we are unveil'ing */ - if (rdonly || (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY)) { - error = EROFS; - goto bad; + if (ndp->ni_pledge != PLEDGE_UNVEIL && (rdonly || + (ndp->ni_dvp->v_mount->mnt_flag & MNT_RDONLY))) { + error = EROFS; + goto bad; } /* * We return with ni_vp NULL to indicate that the entry |