Lots of fixes, notion of pager hierarchy, fixed tgroup capability checking

Notion of pager hierarchy introduced using the existing but unused
pagerid field.

Thread creation now has two more flags TC_AS_PAGER and TC_SHARE_PAGER.
The former sets creator as pager, the latter sets creator's pager as pager.

Thread group capability sharing now correctly carries shared capabilities
to the thread group leader's tgr_cap_list list, and this list is checked
during capability checking.
This commit is contained in:
Bahadir Balban
2009-10-23 02:36:12 +03:00
parent df776b568f
commit 89d49ef495
8 changed files with 44 additions and 15 deletions

View File

@@ -81,6 +81,7 @@ struct capability *capability_find_by_rtype(struct ktcb *task,
unsigned int rtype)
{
struct capability *cap;
struct ktcb *tgleader;
/* Search task's own list */
list_foreach_struct(cap, &task->cap_list.caps, list)
@@ -92,8 +93,11 @@ struct capability *capability_find_by_rtype(struct ktcb *task,
if (cap_rtype(cap) == rtype)
return cap;
/* Find group leader */
BUG_ON(!(tgleader = tcb_find(task->tgid)));
/* Search thread group list */
list_foreach_struct(cap, &task->tgr_cap_list.caps, list)
list_foreach_struct(cap, &tgleader->tgr_cap_list.caps, list)
if (cap_rtype(cap) == rtype)
return cap;

View File

@@ -112,6 +112,7 @@ int init_pager(struct pager *pager,
pager->tcb = task;
task->pager = pager;
task->pagerid = task->tid;
task->tgid = task->tid;
task->container = cont;
/* Initialize uninitialized capability fields while on dummy */

View File

@@ -32,6 +32,7 @@ void tcb_init(struct ktcb *new)
cap_list_init(&new->cap_list);
cap_list_init(&new->tgr_cap_list);
cap_list_init(&new->pager_cap_list);
/* Initialise task's scheduling state and parameters. */
sched_init_task(new, TASK_PRIO_NORMAL);
@@ -117,6 +118,9 @@ struct ktcb *tcb_find(l4id_t tid)
{
struct ktcb *task;
if (current->tid == tid)
return current;
spin_lock(&curcont->ktcb_list.list_lock);
list_foreach_struct(task, &curcont->ktcb_list.list, task_list) {
if (task->tid == tid) {