mirror of
https://github.com/drasko/codezero.git
synced 2026-02-01 12:43:15 +01:00
Merged MAP and VIRTMEM/PHYSMEM capabilities into one.
VIRTMEM and PHYSMEM are theoretically separate resources to be protected than a MAP resource, which is meant to protect the syscall privileges. In practice MAP is always used together with a VIRTMEM and a PHYSMEM resource, therefore reach VIRTMEM/PHYSMEM resource is now merged with the MAP capability, combining the micro-permission bits.
This commit is contained in:
@@ -746,7 +746,7 @@ int process_cap_info(struct cap_info *cap,
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
switch (cap->type & CAP_RTYPE_MASK) {
|
||||
switch (cap_rtype(cap)) {
|
||||
case CAP_RTYPE_THREADPOOL:
|
||||
bootres->nthreads += cap->size;
|
||||
break;
|
||||
@@ -768,8 +768,10 @@ int process_cap_info(struct cap_info *cap,
|
||||
/* Specifies how many new caps can be created */
|
||||
bootres->ncaps += cap->size;
|
||||
break;
|
||||
}
|
||||
|
||||
case CAP_RTYPE_VIRTMEM:
|
||||
switch (cap_type(cap)) {
|
||||
case CAP_TYPE_MAP_VIRTMEM:
|
||||
if ((ret = memcap_unmap(&kres->virtmem_free,
|
||||
cap->start, cap->end))) {
|
||||
if (ret < 0)
|
||||
@@ -787,7 +789,7 @@ int process_cap_info(struct cap_info *cap,
|
||||
}
|
||||
break;
|
||||
|
||||
case CAP_RTYPE_PHYSMEM:
|
||||
case CAP_TYPE_MAP_PHYSMEM:
|
||||
if ((ret = memcap_unmap(&kres->physmem_free,
|
||||
cap->start, cap->end))) {
|
||||
if (ret < 0)
|
||||
@@ -804,8 +806,8 @@ int process_cap_info(struct cap_info *cap,
|
||||
BUG();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user