* [Devel] [PATCH vz10] sched: enforce the 0..1 bound on sched_cpulimit_scale_cpufreq
@ 2026-08-05 13:45 Konstantin Khorenko
2026-08-26 16:48 ` Konstantin Khorenko
2026-08-28 17:09 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
0 siblings, 2 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-08-05 13:45 UTC (permalink / raw)
The sched_cpulimit_scale_cpufreq sysctl was registered with
.extra1 = SYSCTL_ZERO
.extra2 = SYSCTL_ONE
but with .proc_handler = proc_dointvec.
proc_dointvec() ignores extra1/extra2, so the intended [0, 1] clamp was
never applied. sysctl_sched_cpulimit_scale_cpufreq is also unsigned int,
so proc_dointvec() is the wrong signedness for it in the first place.
Use proc_douintvec_minmax() so the already-declared bounds are honoured
and an out-of-range write is rejected.
Fixes: 4e99efb641da0 ("sched: Port CONFIG_CFS_CPULIMIT feature")
Feature: sched: ability to limit number of CPUs available to a CT
https://virtuozzo.atlassian.net/browse/VSTOR-137234
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d5b4d8c97a0c7..7580067e7f44a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4753,7 +4753,7 @@ static struct ctl_table sched_core_sysctls[] = {
.data = &sysctl_sched_cpulimit_scale_cpufreq,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Devel] [PATCH vz10] sched: enforce the 0..1 bound on sched_cpulimit_scale_cpufreq
2026-08-05 13:45 [Devel] [PATCH vz10] sched: enforce the 0..1 bound on sched_cpulimit_scale_cpufreq Konstantin Khorenko
@ 2026-08-26 16:48 ` Konstantin Khorenko
2026-08-28 17:09 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-08-26 16:48 UTC (permalink / raw)
To: Vasileios Almpanis, OpenVZ devel list
a kind ping
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
On 8/5/26 15:45, Konstantin Khorenko wrote:
> The sched_cpulimit_scale_cpufreq sysctl was registered with
> .extra1 = SYSCTL_ZERO
> .extra2 = SYSCTL_ONE
> but with .proc_handler = proc_dointvec.
>
> proc_dointvec() ignores extra1/extra2, so the intended [0, 1] clamp was
> never applied. sysctl_sched_cpulimit_scale_cpufreq is also unsigned int,
> so proc_dointvec() is the wrong signedness for it in the first place.
>
> Use proc_douintvec_minmax() so the already-declared bounds are honoured
> and an out-of-range write is rejected.
>
> Fixes: 4e99efb641da0 ("sched: Port CONFIG_CFS_CPULIMIT feature")
> Feature: sched: ability to limit number of CPUs available to a CT
> https://virtuozzo.atlassian.net/browse/VSTOR-137234
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
> kernel/sched/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index d5b4d8c97a0c7..7580067e7f44a 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4753,7 +4753,7 @@ static struct ctl_table sched_core_sysctls[] = {
> .data = &sysctl_sched_cpulimit_scale_cpufreq,
> .maxlen = sizeof(unsigned int),
> .mode = 0644,
> - .proc_handler = proc_dointvec,
> + .proc_handler = proc_douintvec_minmax,
> .extra1 = SYSCTL_ZERO,
> .extra2 = SYSCTL_ONE,
> },
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Devel] [PATCH RHEL10 COMMIT] sched: enforce the 0..1 bound on sched_cpulimit_scale_cpufreq
2026-08-05 13:45 [Devel] [PATCH vz10] sched: enforce the 0..1 bound on sched_cpulimit_scale_cpufreq Konstantin Khorenko
2026-08-26 16:48 ` Konstantin Khorenko
@ 2026-08-28 17:09 ` Konstantin Khorenko
1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-08-28 17:09 UTC (permalink / raw)
To: Konstantin Khorenko; +Cc: OpenVZ devel
The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git@bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.39.1.16.11.vz10
------>
commit 58d8489a47affd692c11d97592c092a3c377e047
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Wed Aug 5 15:45:32 2026 +0200
sched: enforce the 0..1 bound on sched_cpulimit_scale_cpufreq
The sched_cpulimit_scale_cpufreq sysctl was registered with
.extra1 = SYSCTL_ZERO
.extra2 = SYSCTL_ONE
but with .proc_handler = proc_dointvec.
proc_dointvec() ignores extra1/extra2, so the intended [0, 1] clamp was
never applied. sysctl_sched_cpulimit_scale_cpufreq is also unsigned int,
so proc_dointvec() is the wrong signedness for it in the first place.
Use proc_douintvec_minmax() so the already-declared bounds are honoured
and an out-of-range write is rejected.
Fixes: 4e99efb641da0 ("sched: Port CONFIG_CFS_CPULIMIT feature")
Feature: sched: ability to limit number of CPUs available to a CT
https://virtuozzo.atlassian.net/browse/VSTOR-137234
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
Reviewed-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index fb2477cb1d076..9275501bc3ad0 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4755,7 +4755,7 @@ static struct ctl_table sched_core_sysctls[] = {
.data = &sysctl_sched_cpulimit_scale_cpufreq,
.maxlen = sizeof(unsigned int),
.mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = proc_douintvec_minmax,
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-28 17:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-05 13:45 [Devel] [PATCH vz10] sched: enforce the 0..1 bound on sched_cpulimit_scale_cpufreq Konstantin Khorenko
2026-08-26 16:48 ` Konstantin Khorenko
2026-08-28 17:09 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox