mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-23 11:04:40 +00:00
If spawning a task fails after we did a partial ELF load, remap current.
This is an annoying issue. It'd be nice if this code didn't have to worry about preserving the calling task's mappings.
This commit is contained in:
parent
546ddd7de0
commit
0af9254812
|
@ -243,6 +243,9 @@ Task* Task::createUserTask(const String& path, uid_t uid, gid_t gid, pid_t paren
|
|||
};
|
||||
bool success = space.loadELF(move(elfData));
|
||||
if (!success) {
|
||||
// FIXME: This is ugly. If we need to do this, it should be at a different level.
|
||||
MemoryManager::the().unmapRegionsForTask(*t);
|
||||
MemoryManager::the().mapRegionsForTask(*current);
|
||||
delete t;
|
||||
kprintf("Failure loading ELF %s\n", path.characters());
|
||||
error = -ENOEXEC;
|
||||
|
@ -251,11 +254,15 @@ Task* Task::createUserTask(const String& path, uid_t uid, gid_t gid, pid_t paren
|
|||
|
||||
t->m_tss.eip = (dword)space.symbolPtr("_start");
|
||||
if (!t->m_tss.eip) {
|
||||
// FIXME: This is ugly. If we need to do this, it should be at a different level.
|
||||
MemoryManager::the().unmapRegionsForTask(*t);
|
||||
MemoryManager::the().mapRegionsForTask(*current);
|
||||
delete t;
|
||||
error = -ENOEXEC;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// FIXME: This is ugly. If we need to do this, it should be at a different level.
|
||||
MemoryManager::the().unmapRegionsForTask(*t);
|
||||
MemoryManager::the().mapRegionsForTask(*current);
|
||||
|
||||
|
|
Loading…
Reference in a new issue