diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2019-09-11 15:01:41 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2019-09-11 15:01:41 +0000 |
commit | f75a014c0238c72040557df6e22be5a01eb8712a (patch) | |
tree | 5c069402a10b214dd6ae93491bb14961bca1baaa /regress | |
parent | 8e93f11dfb8d73f15e084a3da8ef2b7bec018ea3 (diff) |
Fix unveil for relative lookups in the non AT_FDCWD case
Issue spotted by Benjamin Baier <programmer@netzbasis.de> with relative
path lookups from openat(2). Lacking a current working directory unveil,
operations using the *at functions could fail when not crossing an unveil,
since an initial covering unveil was not found.
This corrects this so we walk up from the directory vnode to find a
covering unveil at the start of non AT_FDCWD lookups, and adds regress
for this case.
ok bluhm@
Diffstat (limited to 'regress')
-rw-r--r-- | regress/sys/kern/unveil/syscalls.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/regress/sys/kern/unveil/syscalls.c b/regress/sys/kern/unveil/syscalls.c index 813fd7e5c04..7c8d96ce967 100644 --- a/regress/sys/kern/unveil/syscalls.c +++ b/regress/sys/kern/unveil/syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscalls.c,v 1.24 2019/09/08 22:43:14 beck Exp $ */ +/* $OpenBSD: syscalls.c,v 1.25 2019/09/11 15:01:40 beck Exp $ */ /* * Copyright (c) 2017-2019 Bob Beck <beck@openbsd.org> @@ -172,8 +172,7 @@ test_openat(int do_uv) UV_SHOULD_SUCCEED((openat(dirfd2after, "../derp", O_RDWR|O_CREAT) == -1), "openat"); UV_SHOULD_ENOENT((openat(dirfd2after, "../../derpyluvs", O_RDWR|O_CREAT) == -1), "openat"); UV_SHOULD_ENOENT((openat(dirfd2after, "/etc/hosts", O_RDONLY) == -1), "openat"); - /* XXX won't work until fix in */ - /* UV_SHOULD_SUCCEED((openat(dirfd2after, "hooray", O_RDWR|O_CREAT) == -1), "openat"); */ + UV_SHOULD_SUCCEED((openat(dirfd2after, "hooray", O_RDWR|O_CREAT) == -1), "openat"); UV_SHOULD_SUCCEED((openat(dirfd2after, uv_file1, O_RDWR|O_CREAT) == -1), "openat"); UV_SHOULD_ENOENT((openat(dirfd2after, uv_file2, O_RDWR|O_CREAT) == -1), "openat"); return 0; |