diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index ebdba27d..8c0d6c63 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -53,6 +53,12 @@ namespace Kernel delete elf; 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(); MUST(process->m_working_directory.push_back('/')); @@ -212,6 +218,12 @@ namespace Kernel delete elf; 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);