mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
hw: seal capability leak (fix #1568)
Do not initially transfer UTCB dataspace and parent capability to a thread that is no main thread.
This commit is contained in:
parent
fcf35a0397
commit
f78aaf2234
@ -100,7 +100,7 @@ class Genode::Native_utcb
|
||||
|
||||
enum { MAX_CAP_ARGS = Msgbuf_base::MAX_CAP_ARGS};
|
||||
|
||||
enum Offsets { PARENT, UTCB_DATASPACE, THREAD_MYSELF };
|
||||
enum Offsets { THREAD_MYSELF, PARENT, UTCB_DATASPACE };
|
||||
|
||||
private:
|
||||
|
||||
|
@ -762,9 +762,9 @@ Core_thread::Core_thread()
|
||||
Genode::map_local((addr_t)utcb, (addr_t)Genode::utcb_main_thread(),
|
||||
sizeof(Native_utcb) / Genode::get_page_size());
|
||||
|
||||
utcb->cap_add(cap_id_invalid());
|
||||
utcb->cap_add(cap_id_invalid());
|
||||
utcb->cap_add(core_capid());
|
||||
utcb->cap_add(cap_id_invalid());
|
||||
utcb->cap_add(cap_id_invalid());
|
||||
|
||||
/* start thread with stack pointer at the top of stack */
|
||||
sp = (addr_t)&stack + DEFAULT_STACK_SIZE;
|
||||
|
@ -198,9 +198,11 @@ int Platform_thread::start(void * const ip, void * const sp)
|
||||
|
||||
/* reset capability counter */
|
||||
utcb->cap_cnt(0);
|
||||
utcb->cap_add(_pd->parent().dst());
|
||||
utcb->cap_add(_utcb.dst());
|
||||
utcb->cap_add(_cap.dst());
|
||||
if (_main_thread) {
|
||||
utcb->cap_add(_pd->parent().dst());
|
||||
utcb->cap_add(_utcb.dst());
|
||||
}
|
||||
Kernel::start_thread(kernel_object(), cpu, _pd->kernel_pd(),
|
||||
_utcb_core_addr);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user