Commit 4a1e4467 authored by Jan Kiszka's avatar Jan Kiszka Committed by Philippe Gerum
Browse files

lib/cobalt: Avoid requesting shadowing for remote threads



Fix pthread_setschedparam_ex that it does not suggests the core to map
the current thread if the target thread of the request is actually not
pthread_self(). The core will reject such requests now, but we should
avoid them in the first place so that we get a clear error code.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent f845f423
......@@ -607,7 +607,7 @@ int pthread_setschedparam_ex(pthread_t thread,
{
int ret, promoted, std_policy;
struct sched_param std_param;
__u32 u_winoff;
__u32 u_winoff, *u_winoff_ptr;
/*
* If we enter this call over a relaxed context, take the
......@@ -637,9 +637,12 @@ int pthread_setschedparam_ex(pthread_t thread,
return ret;
}
/* only request promotion when this targets the current thread */
u_winoff_ptr = thread == pthread_self() ? &u_winoff : NULL;
ret = -XENOMAI_SYSCALL5(sc_cobalt_thread_setschedparam_ex,
thread, policy, param_ex,
&u_winoff, &promoted);
u_winoff_ptr, &promoted);
if (ret == 0 && promoted) {
cobalt_sigshadow_install_once();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment