summaryrefslogtreecommitdiff
path: root/Kernel/Process.h
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-11-07 00:09:48 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-10 16:13:10 +0100
commit631447da574ec6421c77d37da54ad04b50102688 (patch)
treef46987da5bb8ac3fbc574f15acf298a4353d2225 /Kernel/Process.h
parent26a48f3516f4d26c81d3cf10c5c3dfe5a39528b1 (diff)
downloadserenity-631447da574ec6421c77d37da54ad04b50102688.zip
Kernel: Fix TOCTOU in fstatvfs
In particular, fstatvfs used to assume that a file that was earlier opened using some path will forever be at that path. This is wrong, and in the meantime new mounts and new filesystems could take up the filename or directories, leading to a completely inaccurate result. This commit improves the situation: - All filesystem information is now always accurate. - The mount flags *might* be erroneously zero, if the custody for the open file is not available. I don't know when that might happen, but it is definitely not the typical case.
Diffstat (limited to 'Kernel/Process.h')
-rw-r--r--Kernel/Process.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h
index bb26b29d3c..c6e3ae6453 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -535,7 +535,7 @@ private:
ErrorOr<void> do_exec(NonnullRefPtr<OpenFileDescription> main_program_description, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment, RefPtr<OpenFileDescription> interpreter_description, Thread*& new_main_thread, u32& prev_flags, const ElfW(Ehdr) & main_program_header);
ErrorOr<FlatPtr> do_write(OpenFileDescription&, const UserOrKernelBuffer&, size_t);
- ErrorOr<FlatPtr> do_statvfs(StringView path, statvfs* buf);
+ ErrorOr<FlatPtr> do_statvfs(FileSystem const& path, Custody const*, statvfs* buf);
ErrorOr<RefPtr<OpenFileDescription>> find_elf_interpreter_for_executable(StringView path, ElfW(Ehdr) const& main_executable_header, size_t main_executable_header_size, size_t file_size);