Implemented a protocol between client and pager for requesting caps.

In posix, test0 makes inter-space ipc for testing extended ipc. This
correctly fails when only the cap to ipc to pager is given to all tasks
in the container.

In order to overcome this problem, the tasks who fork for doing ipc to
each other make a request to the pager to get capabilities to do so.

Pager finds its own widened ipc capability over the container, replicates
it, validates and reduces it to desired boundaries (i.e. just ipc betw.
two spaces) and grants it as IMMUTABLE to requesting tasks.

This protocol may be useful in implementing a client/server capability
request relationship. Code builds but untested.
This commit is contained in:
Bahadir Balban
2009-11-08 14:15:33 +02:00
parent b136b79a2d
commit dc03c7b130
12 changed files with 616 additions and 451 deletions
+7 -70
View File
@@ -6,76 +6,8 @@
#ifndef __MM0_CAPABILITY_H__
#define __MM0_CAPABILITY_H__
#include <l4lib/types.h>
#include <l4/lib/list.h>
struct cap_list {
int ncaps;
struct link caps;
};
struct capability {
struct link list;
/* Capability identifiers */
l4id_t capid; /* Unique capability ID */
l4id_t resid; /* Targeted resource ID */
l4id_t owner; /* Capability owner ID */
unsigned int type; /* Capability and target resource type */
/* Capability limits/permissions */
u32 access; /* Permitted operations */
/* Limits on the resource */
unsigned long start; /* Resource start value */
unsigned long end; /* Resource end value */
unsigned long size; /* Resource size */
unsigned long used; /* Resource used size */
};
static inline void cap_list_init(struct cap_list *clist)
{
clist->ncaps = 0;
link_init(&clist->caps);
}
static inline void cap_list_insert(struct capability *cap,
struct cap_list *clist)
{
list_insert(&cap->list, &clist->caps);
clist->ncaps++;
}
/* Detach a whole list of capabilities from list head */
static inline struct capability *
cap_list_detach(struct cap_list *clist)
{
struct link *list = list_detach(&clist->caps);
clist->ncaps = 0;
return link_to_struct(list, struct capability, list);
}
/* Attach a whole list of capabilities to list head */
static inline void cap_list_attach(struct capability *cap,
struct cap_list *clist)
{
/* Attach as if cap is the list and clist is the element */
list_insert(&clist->caps, &cap->list);
/* Count the number of caps attached */
list_foreach_struct(cap, &clist->caps, list)
clist->ncaps++;
}
static inline void cap_list_move(struct cap_list *to,
struct cap_list *from)
{
struct capability *cap_head = cap_list_detach(from);
cap_list_attach(cap_head, to);
}
#include <l4lib/capability.h>
#include <task.h>
extern struct cap_list capability_list;
@@ -83,4 +15,9 @@ struct initdata;
int read_pager_capabilities();
void copy_boot_capabilities();
int sys_request_cap(struct tcb *sender, struct capability *c);
void cap_print(struct capability *cap);
void cap_list_print(struct cap_list *cap_list);
void setup_caps();
#endif /* __MM0_CAPABILITY_H__ */
+1
View File
@@ -29,6 +29,7 @@ extern struct initdata initdata;
void init(void);
void copy_boot_capabilities(int ncaps);
/* TODO: Remove this stuff from here. */
int init_devzero(void);
struct vm_file *get_devzero(void);