|
@@ -162,7 +162,11 @@ struct RequiredLoadRange {
|
|
static KResultOr<RequiredLoadRange> get_required_load_range(FileDescription& program_description)
|
|
static KResultOr<RequiredLoadRange> get_required_load_range(FileDescription& program_description)
|
|
{
|
|
{
|
|
auto& inode = *(program_description.inode());
|
|
auto& inode = *(program_description.inode());
|
|
- auto vmobject = SharedInodeVMObject::create_with_inode(inode);
|
|
|
|
|
|
+ auto vmobject = SharedInodeVMObject::try_create_with_inode(inode);
|
|
|
|
+ if (!vmobject) {
|
|
|
|
+ dbgln("get_required_load_range: Unable to allocate SharedInodeVMObject");
|
|
|
|
+ return ENOMEM;
|
|
|
|
+ }
|
|
|
|
|
|
size_t executable_size = inode.size();
|
|
size_t executable_size = inode.size();
|
|
|
|
|
|
@@ -263,7 +267,12 @@ static KResultOr<LoadResult> load_elf_object(NonnullOwnPtr<Space> new_space, Fil
|
|
FlatPtr load_offset, ShouldAllocateTls should_allocate_tls, ShouldAllowSyscalls should_allow_syscalls)
|
|
FlatPtr load_offset, ShouldAllocateTls should_allocate_tls, ShouldAllowSyscalls should_allow_syscalls)
|
|
{
|
|
{
|
|
auto& inode = *(object_description.inode());
|
|
auto& inode = *(object_description.inode());
|
|
- auto vmobject = SharedInodeVMObject::create_with_inode(inode);
|
|
|
|
|
|
+ auto vmobject = SharedInodeVMObject::try_create_with_inode(inode);
|
|
|
|
+ if (!vmobject) {
|
|
|
|
+ dbgln("load_elf_object: Unable to allocate SharedInodeVMObject");
|
|
|
|
+ return ENOMEM;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (vmobject->writable_mappings()) {
|
|
if (vmobject->writable_mappings()) {
|
|
dbgln("Refusing to execute a write-mapped program");
|
|
dbgln("Refusing to execute a write-mapped program");
|
|
return ETXTBSY;
|
|
return ETXTBSY;
|