nova: sanity check parent pd assignments

Issue #1778
This commit is contained in:
Alexander Boettcher 2015-10-16 20:26:13 +02:00 committed by Christian Helmuth
parent 4b6b759739
commit 9ada3d3178
2 changed files with 4 additions and 1 deletions

View File

@ -42,6 +42,8 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
int Platform_pd::assign_parent(Native_capability parent)
{
if (_parent.valid()) return -1;
if (!parent.valid()) return -2;
_parent = parent;
return 0;
}

View File

@ -57,7 +57,8 @@ int Platform_thread::start(void *ip, void *sp)
return -1;
}
if (!_pd) {
if (!_pd || (is_main_thread() && !is_vcpu() &&
_pd->parent_pt_sel() == Native_thread::INVALID_INDEX)) {
PERR("protection domain undefined");
return -2;
}