mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-15 04:07:36 +00:00
Kernel: Ignore dirfd if absolute path is given in VFS-related syscalls
To be able to do this, we add a new class called CustodyBase, which can be resolved on-demand internally in the VirtualFileSystem resolving path code. When being resolved, CustodyBase will return a known custody if it was constructed with such, if that's not the case it will provide the root custody if the original path is absolute. Lastly, if that's not the case as well, it will resolve the given dirfd to provide a Custody object.
This commit is contained in:
@@ -55,8 +55,8 @@ ErrorOr<FlatPtr> Process::open_impl(Userspace<Syscall::SC_open_params const*> us
|
||||
dbgln_if(IO_DEBUG, "sys$open(dirfd={}, path='{}', options={}, mode={})", dirfd, path->view(), options, mode);
|
||||
|
||||
auto fd_allocation = TRY(allocate_fd());
|
||||
auto base = TRY(custody_for_dirfd(dirfd));
|
||||
auto description = TRY(VirtualFileSystem::the().open(credentials(), path->view(), options, mode & ~umask(), *base));
|
||||
CustodyBase base(dirfd, path->view());
|
||||
auto description = TRY(VirtualFileSystem::the().open(credentials(), path->view(), options, mode & ~umask(), base));
|
||||
|
||||
if (description->inode() && description->inode()->bound_socket())
|
||||
return ENXIO;
|
||||
|
||||
Reference in New Issue
Block a user