linux/kernel
Quentin Perret 2bb3e44126 FROMLIST: sched: Fix out-of-bound access in uclamp
Util-clamp places tasks in different buckets based on their clamp values
for performance reasons. However, the size of buckets is currently
computed using a rounding division, which can lead to an off-by-one
error in some configurations.

For instance, with 20 buckets, the bucket size will be 1024/20=51. A
task with a clamp of 1024 will be mapped to bucket id 1024/51=20. Sadly,
correct indexes are in range [0,19], hence leading to an out of bound
memory access.

Clamp the bucket id to fix the issue.

Bug: 186415778
Fixes: 69842cba9a ("sched/uclamp: Add CPU's clamp buckets refcounting")
Suggested-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lore.kernel.org/r/20210430151412.160913-1-qperret@google.com
Change-Id: Ibc28662de5554f80f97533b60e747f8a6e871c56
2021-05-04 09:07:38 +00:00
..
bpf Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
cgroup ANDROID: cgroup: Add vendor hook for cpuset. 2021-04-21 13:31:39 -07:00
configs
debug kgdb: fix to kill breakpoints on initmem after boot 2021-03-04 11:38:46 +01:00
dma FROMLIST: mm: cma: introduce gfp flag in cma_alloc instead of no_warn 2021-01-25 12:21:02 -08:00
entry x86/entry: Move nmi entry/exit into common code 2021-03-17 17:06:36 +01:00
events This is the 5.10.24 stable release 2021-03-19 09:42:56 +01:00
gcov gcov: re-fix clang-11+ support 2021-04-14 08:41:58 +02:00
irq Merge 5.10.26 into android12-5.10-lts 2021-03-25 17:15:27 +01:00
kcsan kcsan: Rewrite kcsan_prandom_u32_max() without prandom_u32_state() 2021-03-04 11:37:37 +01:00
livepatch
locking Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
power Merge 5.10.27 into android12-5.10 2021-04-02 15:25:50 +02:00
printk ANDROID: logbuf: vendor hook for logbuf dump on oops 2021-04-15 20:02:45 +00:00
rcu FROMGIT: rcu/tree: Add a trace event for RCU CPU stall warnings 2021-03-11 21:06:44 +09:00
sched FROMLIST: sched: Fix out-of-bound access in uclamp 2021-05-04 09:07:38 +00:00
time FROMGIT: tick/broadcast: Allow late registered device to enter oneshot mode 2021-04-23 16:25:34 +00:00
trace Merge 5.10.31 into android12-5.10 2021-04-16 16:01:44 +02:00
.gitignore FROMGIT: kbuild: update config_data.gz only when the content of .config is changed 2021-04-29 08:45:48 +00:00
acct.c
async.c
audit_fsnotify.c fsnotify: generalize handle_inode_event() 2020-12-30 11:54:18 +01:00
audit_tree.c fsnotify: generalize handle_inode_event() 2020-12-30 11:54:18 +01:00
audit_watch.c fsnotify: generalize handle_inode_event() 2020-12-30 11:54:18 +01:00
audit.c
audit.h
auditfilter.c
auditsc.c
backtracetest.c
bounds.c
capability.c
cfi.c ANDROID: cfi: switch to synchronize_rcu_expedited() 2021-02-16 18:09:38 +00:00
compat.c
configs.c
context_tracking.c
cpu_pm.c
cpu.c ANDROID: cpu/hotplug: failure to offline 2nd to last cpu 2021-03-11 21:32:28 +00:00
crash_core.c
crash_dump.c
cred.c ANDROID: kernel: Add vendor hook in creds 2021-03-15 15:37:57 +00:00
delayacct.c
dma.c
exec_domain.c
exit.c ANDROID: vendor_hooks: Add hooks for memory when debug 2021-03-19 04:54:07 +00:00
extable.c
fail_function.c
fork.c ANDROID: sched: Add vendor hooks for sched. 2021-04-23 18:42:38 -07:00
freezer.c Revert "kernel: freezer should treat PF_IO_WORKER like PF_KTHREAD for freezing" 2021-04-07 15:00:14 +02:00
futex.c ANDROID: mm: page_pinner: use put_user_page at get_futex_key 2021-04-30 09:13:34 -07:00
gen_kheaders.sh
groups.c
hung_task.c
iomem.c
irq_work.c
jump_label.c static_call: Fix static_call_update() sanity check 2021-03-25 09:04:18 +01:00
kallsyms.c ANDROID: kallsyms: cfi: strip hashes from static functions 2021-01-14 16:31:46 +00:00
kcmp.c exec: Transform exec_update_mutex into a rw_semaphore 2021-01-09 13:46:24 +01:00
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kcov.c
kexec_core.c kernel: kexec: remove the lock operation of system_transition_mutex 2021-02-03 23:28:37 +01:00
kexec_elf.c
kexec_file.c ima: Free IMA measurement buffer after kexec syscall 2021-03-04 11:37:50 +01:00
kexec_internal.h
kexec.c
kheaders.c
kmod.c
kprobes.c kprobes: Fix to delay the kprobes jump optimization 2021-03-04 11:38:35 +01:00
ksysfs.c
kthread.c Merge 5.10.14 into android12-5.10 2021-02-08 20:05:12 -08:00
latencytop.c
Makefile FROMGIT: kbuild: update config_data.gz only when the content of .config is changed 2021-04-29 08:45:48 +00:00
module_signature.c module: harden ELF info handling 2021-03-25 09:04:11 +01:00
module_signing.c module: harden ELF info handling 2021-03-25 09:04:11 +01:00
module-internal.h
module.c Merge 5.10.26 into android12-5.10-lts 2021-03-25 17:15:27 +01:00
notifier.c
nsproxy.c
padata.c
panic.c
params.c
pid_namespace.c
pid.c Merge 5.10.6 into android12-5.10 2021-01-13 10:28:55 +01:00
profile.c
ptrace.c
range.c
reboot.c
regset.c
relay.c
resource.c
rseq.c
scftorture.c
scs.c UPSTREAM: scs: switch to vmapped shadow stacks 2021-01-07 17:56:54 -08:00
seccomp.c Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
signal.c ANDROID: Add vendor hooks to signal. 2021-04-09 02:30:55 +00:00
smp.c ANDROID: smp: fix preprocessor conditional warning 2021-04-14 18:33:17 +00:00
smpboot.c kthread: Extract KTHREAD_IS_PER_CPU 2021-02-07 15:37:17 +01:00
smpboot.h
softirq.c
stackleak.c
stacktrace.c ANDROID: stacktrace: export stack_trace_save_tsk/regs 2021-04-13 13:18:04 +00:00
static_call.c static_call: Align static_call_is_init() patching condition 2021-04-07 15:00:06 +02:00
stop_machine.c
sys_ni.c
sys.c ANDROID: Add vendor hooks when syscall prctl finished 2021-03-08 16:18:51 +00:00
sysctl-test.c
sysctl.c This is the 5.10.24 stable release 2021-03-19 09:42:56 +01:00
task_work.c FROMGIT: kasan: record task_work_add() call stack 2021-03-24 15:09:18 -07:00
taskstats.c
test_kprobes.c
torture.c
tracepoint.c ANDROID: vendor_hooks: Allow multiple attachments to restricted hooks 2021-03-31 09:08:06 +00:00
tsacct.c
ucount.c
uid16.c
uid16.h
umh.c
up.c
user_namespace.c
user-return-notifier.c
user.c ANDROID: export find_user() & free_uid()for GKI purpose. 2021-04-23 03:37:41 +00:00
usermode_driver.c bpf: Fix umd memory leak in copy_process() 2021-03-30 14:32:03 +02:00
utsname_sysctl.c
utsname.c
watch_queue.c
watchdog_hld.c
watchdog.c ANDROID: softlockup: add vendor hook for a softlockup task 2021-02-04 23:55:45 +00:00
workqueue_internal.h
workqueue.c Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00