mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-27 09:12:32 +00:00
init: clamp priority values to valid range
This patch ensures that priority values passed as session arguments are within the valid range of priorities. Without the clamping, a child could specify a priority of a lower priority band than the one assigned to the subsystem. Thanks to Johannes Schlatow for reporting this issue. Fixes #1279
This commit is contained in:
parent
8b0f9fd82a
commit
e4c636b0a0
@ -105,7 +105,10 @@ namespace Init {
|
||||
if (Genode::strcmp(service, "CPU") || _prio_levels_log2 == 0)
|
||||
return;
|
||||
|
||||
long priority = Arg_string::find_arg(args, "priority").long_value(0);
|
||||
unsigned long priority = Arg_string::find_arg(args, "priority").long_value(0);
|
||||
|
||||
/* clamp priority value to valid range */
|
||||
priority = min((unsigned)Cpu_session::PRIORITY_LIMIT - 1, priority);
|
||||
|
||||
long discarded_prio_lsb_bits_mask = (1 << _prio_levels_log2) - 1;
|
||||
if (priority & discarded_prio_lsb_bits_mask) {
|
||||
|
Loading…
Reference in New Issue
Block a user