forked from Bananymous/banan-os
Kernel: verify that loaded elfs are executable
This commit is contained in:
parent
2f2c298c68
commit
649f08ec78
|
@ -53,6 +53,12 @@ namespace Kernel
|
||||||
delete elf;
|
delete elf;
|
||||||
return BAN::Error::from_errno(EINVAL);
|
return BAN::Error::from_errno(EINVAL);
|
||||||
}
|
}
|
||||||
|
if (elf->file_header_native().e_type != LibELF::ET_EXEC)
|
||||||
|
{
|
||||||
|
derrorln("Not an executable");
|
||||||
|
delete elf;
|
||||||
|
return BAN::Error::from_errno(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
auto* process = create_process();
|
auto* process = create_process();
|
||||||
MUST(process->m_working_directory.push_back('/'));
|
MUST(process->m_working_directory.push_back('/'));
|
||||||
|
@ -212,6 +218,12 @@ namespace Kernel
|
||||||
delete elf;
|
delete elf;
|
||||||
return BAN::Error::from_errno(EINVAL);
|
return BAN::Error::from_errno(EINVAL);
|
||||||
}
|
}
|
||||||
|
if (elf->file_header_native().e_type != LibELF::ET_EXEC)
|
||||||
|
{
|
||||||
|
derrorln("Not an executable");
|
||||||
|
delete elf;
|
||||||
|
return BAN::Error::from_errno(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
LockGuard lock_guard(m_lock);
|
LockGuard lock_guard(m_lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue