From 8efd5b761352ca5ba3b5118895c40eedb1cf692b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 25 Oct 2014 15:54:56 +0200 Subject: [PATCH] vfs: check the X permission on set cwd. * When you change the current working directory, you actually should have the permission to enter that directory. * This gives us a 0.04% better score on the perl test suite :-) --- src/system/kernel/fs/vfs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index b875b90fb6..0a0a7ebe12 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -7883,6 +7883,13 @@ set_cwd(int fd, char* path, bool kernel) goto err; } + // We need to have the permission to enter the directory, too + if (HAS_FS_CALL(vnode, access)) { + status = FS_CALL(vnode, access, X_OK); + if (status != B_OK) + goto err; + } + // Get current io context and lock context = get_current_io_context(kernel); mutex_lock(&context->io_mutex);