nova: sanitize priority parameters

threads with prio 0 will not be started and would fail silently.
Happened on Turmvilla for the USBProxy thread in virtualbox.

Discovered during Turmvilla scenario #1552 and issue #1733.
This commit is contained in:
Alexander Boettcher 2015-09-08 13:22:41 +02:00 committed by Christian Helmuth
parent 70a3bb7465
commit d7da035115
1 changed files with 10 additions and 0 deletions

View File

@ -346,6 +346,16 @@ Platform_thread::Platform_thread(const char *name, unsigned prio, int thread_id)
_priority(Cpu_session::scale_priority(Nova::Qpd::DEFAULT_PRIORITY, prio))
{
strncpy(_name, name, sizeof(_name));
if (_priority == 0) {
PWRN("priority of thread '%s' below minimum - boost to 1", _name);
_priority = 1;
}
if (_priority > Nova::Qpd::DEFAULT_PRIORITY) {
PWRN("priority of thread '%s' above maximum - limit to %u",
_name, Nova::Qpd::DEFAULT_PRIORITY);
_priority = Nova::Qpd::DEFAULT_PRIORITY;
}
}