linux-stable/kernel/sched
Xuewen Yan 470d347b14 sched/eevdf: Prevent vlag from going out of bounds in reweight_eevdf()
[ Upstream commit 1560d1f6eb ]

It was possible to have pick_eevdf() return NULL, which then causes a
NULL-deref. This turned out to be due to entity_eligible() returning
falsely negative because of a s64 multiplcation overflow.

Specifically, reweight_eevdf() computes the vlag without considering
the limit placed upon vlag as update_entity_lag() does, and then the
scaling multiplication (remember that weight is 20bit fixed point) can
overflow. This then leads to the new vruntime being weird which then
causes the above entity_eligible() to go side-ways and claim nothing
is eligible.

Thus limit the range of vlag accordingly.

All this was quite rare, but fatal when it does happen.

Closes: https://lore.kernel.org/all/ZhuYyrh3mweP_Kd8@nz.home/
Closes: https://lore.kernel.org/all/CA+9S74ih+45M_2TPUY_mPPVDhNvyYfy1J1ftSix+KjiTVxg8nw@mail.gmail.com/
Closes: https://lore.kernel.org/lkml/202401301012.2ed95df0-oliver.sang@intel.com/
Fixes: eab03c23c2 ("sched/eevdf: Fix vruntime adjustment on reweight")
Reported-by: Sergei Trofimovich <slyich@gmail.com>
Reported-by: Igor Raits <igor@gooddata.com>
Reported-by: Breno Leitao <leitao@debian.org>
Reported-by: kernel test robot <oliver.sang@intel.com>
Reported-by: Yujie Liu <yujie.liu@intel.com>
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
Reviewed-and-tested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240422082238.5784-1-xuewen.yan@unisoc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-02 16:32:49 +02:00
..
Makefile
autogroup.c
autogroup.h
build_policy.c
build_utility.c
clock.c Locking changes for v6.5: 2023-06-27 14:14:30 -07:00
completion.c sched: add a few helpers to wake up tasks on the current cpu 2023-07-17 16:08:08 -07:00
core.c sched: Simplify tg_set_cfs_bandwidth() 2024-04-03 15:28:18 +02:00
core_sched.c
cpuacct.c
cpudeadline.c
cpudeadline.h
cpufreq.c
cpufreq_schedutil.c cpufreq: schedutil: Update next_freq when cpufreq_limits change 2023-10-05 22:09:50 +02:00
cpupri.c sched/rt: Fix live lock between select_fallback_rq() and RT push 2023-09-28 22:58:13 +02:00
cpupri.h
cputime.c cputime: remove cputime_to_nsecs fallback 2022-12-27 12:52:17 +01:00
deadline.c sched: Fix stop_one_cpu_nowait() vs hotplug 2023-11-20 11:58:52 +01:00
debug.c sched/debug: Rename sysctl_sched_min_granularity to sysctl_sched_base_slice 2023-07-19 09:43:59 +02:00
fair.c sched/eevdf: Prevent vlag from going out of bounds in reweight_eevdf() 2024-05-02 16:32:49 +02:00
features.h sched/eevdf: Curb wakeup-preemption 2023-08-17 17:07:07 +02:00
idle.c kernel/sched: Modify initial boot task idle setup 2023-09-19 10:48:04 +02:00
isolation.c
loadavg.c
membarrier.c sched/membarrier: reduce the ability to hammer on sys_membarrier 2024-02-23 09:25:27 +01:00
pelt.c
pelt.h
psi.c Linux 6.5-rc2 2023-07-19 09:43:25 +02:00
rt.c sched/rt: Disallow writing invalid values to sched_rt_period_us 2024-03-01 13:34:47 +01:00
sched-pelt.h
sched.h sched: Add missing memory barrier in switch_mm_cid 2024-04-27 17:11:41 +02:00
smp.h sched, smp: Trace smp callback causing an IPI 2023-03-24 11:01:29 +01:00
stats.c
stats.h sched/psi: Use task->psi_flags to clear in CPU migration 2022-10-30 10:12:15 +01:00
stop_task.c
swait.c sched: add a few helpers to wake up tasks on the current cpu 2023-07-17 16:08:08 -07:00
topology.c sched/topology: Fix sched_numa_find_nth_cpu() in CPU-less case 2023-11-20 11:58:51 +01:00
wait.c sched: add a few helpers to wake up tasks on the current cpu 2023-07-17 16:08:08 -07:00
wait_bit.c