Fix race condition in exec().

...also hook up sys$fstat in the syscall dispatcher.
This commit is contained in:
Andreas Kling 2018-11-17 00:52:29 +01:00
parent bb9766ee17
commit 95e0f6ad82
Notes: sideshowbarker 2024-07-19 16:09:58 +09:00
2 changed files with 8 additions and 2 deletions

View file

@ -363,7 +363,11 @@ int Process::do_exec(const String& path, Vector<String>&& arguments, Vector<Stri
}
}
InterruptDisabler disabler;
// We cli() manually here because we don't want to get interrupted between do_exec() and Schedule::yield().
// The reason is that the task redirection we've set up above will be clobbered by the timer IRQ.
// If we used an InterruptDisabler that sti()'d on exit, we might timer tick'd too soon in exec().
cli();
Scheduler::prepare_to_modify_tss(*this);
m_name = parts.takeLast();

View file

@ -173,8 +173,10 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
return current->sys$fcntl((int)arg1, (int)arg2, (dword)arg3);
case Syscall::SC_ioctl:
return current->sys$ioctl((int)arg1, (unsigned)arg2, (unsigned)arg3);
case Syscall::SC_fstat:
return current->sys$fstat((int)arg1, (Unix::stat*)arg2);
default:
kprintf("<%u> int0x80: Unknown function %x requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
kprintf("<%u> int0x80: Unknown function %u requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
break;
}
return 0;