nova: revoke set portal id right

Revoke the right to set the portal id (aka label) when it is not needed
anymore. Otherwise everybody in the system having a mapping of the portal can
reset the label to something we don't expect.

Issue #667
This commit is contained in:
Alexander Boettcher
2013-02-22 15:26:43 +01:00
committed by Norman Feske
parent 46447d531e
commit 801d09f166
5 changed files with 39 additions and 14 deletions

View File

@ -1,6 +1,7 @@
/*
* \brief Client-side CAP session interface
* \author Norman Feske
* \author Alexander Boettcher
* \date 2006-07-10
*/
@ -28,7 +29,17 @@ namespace Genode {
Native_capability alloc(Native_capability ep, addr_t entry = 0,
addr_t flags = 0)
{
return call<Rpc_alloc>(ep, entry, flags);
Native_capability cap = call<Rpc_alloc>(ep, entry, flags);
using namespace Nova;
/* set our local name */
if (NOVA_OK != pt_ctrl(cap.local_name(), cap.local_name()))
nova_die();
/* disable the feature for security reasons now */
revoke(Obj_crd(cap.local_name(), 0, Obj_crd::RIGHT_PT_CTRL));
return cap;
}
void free(Native_capability cap) { call<Rpc_free>(cap); }