mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-19 08:41:53 +00:00
Kernel: Handle mmap requests on zero-length data file inodes safely
This commit is contained in:
parent
c88cc8557f
commit
3ad0e1a1d5
Notes:
sideshowbarker
2024-07-17 07:07:05 +09:00
Author: https://github.com/supercomputer7
Commit: 3ad0e1a1d5
Pull-request: https://github.com/SerenityOS/serenity/pull/14785
Reviewed-by: https://github.com/IdanHo ✅
5 changed files with 28 additions and 5 deletions
|
@ -80,11 +80,11 @@ ErrorOr<void> InodeFile::ioctl(OpenFileDescription& description, unsigned reques
|
|||
}
|
||||
}
|
||||
|
||||
ErrorOr<NonnullLockRefPtr<Memory::VMObject>> InodeFile::vmobject_for_mmap(Process&, Memory::VirtualRange const&, u64&, bool shared)
|
||||
ErrorOr<NonnullLockRefPtr<Memory::VMObject>> InodeFile::vmobject_for_mmap(Process&, Memory::VirtualRange const& range, u64& offset, bool shared)
|
||||
{
|
||||
if (shared)
|
||||
return TRY(Memory::SharedInodeVMObject::try_create_with_inode(inode()));
|
||||
return TRY(Memory::PrivateInodeVMObject::try_create_with_inode(inode()));
|
||||
return TRY(Memory::SharedInodeVMObject::try_create_with_inode_and_range(inode(), offset, range.size()));
|
||||
return TRY(Memory::PrivateInodeVMObject::try_create_with_inode_and_range(inode(), offset, range.size()));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<KString>> InodeFile::pseudo_path(OpenFileDescription const&) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue