diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-01-30 14:05:36 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-01-30 12:23:22 +0100 |
commit | 3ffdff5c02c89ac38d299bc25e8e446dbe5034fa (patch) | |
tree | 2d421f6971ff711ba49db476222c7e9cb39bdbb9 /Kernel | |
parent | a27c5d2fb7e7f040f59ab668b6478dd6100f1d6d (diff) | |
download | serenity-3ffdff5c02c89ac38d299bc25e8e446dbe5034fa.zip |
Kernel: Dump backtrace when denying a path because of a veil
This will make it much easier to see why a process wants to open the file.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/FileSystem/VirtualFileSystem.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index c1579e89c3..db2f55dbcd 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -729,18 +729,21 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options) auto* unveiled_path = find_matching_unveiled_path(path); if (!unveiled_path) { dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled."; + dump_backtrace(); return KResult(-ENOENT); } if (options & O_CREAT) { if (!(unveiled_path->permissions & UnveiledPath::Access::CreateOrRemove)) { dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'c' permission."; + dump_backtrace(); return KResult(-EACCES); } } if (options & O_UNLINK_INTERNAL) { if (!(unveiled_path->permissions & UnveiledPath::Access::CreateOrRemove)) { dbg() << "Rejecting path '" << path << "' for unlink since it hasn't been unveiled with 'c' permission."; + dump_backtrace(); return KResult(-EACCES); } return KSuccess; @@ -748,18 +751,21 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options) if (options & O_RDONLY) { if (!(unveiled_path->permissions & UnveiledPath::Access::Read)) { dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'r' permission."; + dump_backtrace(); return KResult(-EACCES); } } if (options & O_WRONLY) { if (!(unveiled_path->permissions & UnveiledPath::Access::Write)) { dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'w' permission."; + dump_backtrace(); return KResult(-EACCES); } } if (options & O_EXEC) { if (!(unveiled_path->permissions & UnveiledPath::Access::Execute)) { dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'x' permission."; + dump_backtrace(); return KResult(-EACCES); } } |