[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/sched: validate RTDS putinfo period and budget
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
- Date: Wed, 25 Mar 2026 17:14:12 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4CL2YapEIHWElPPtkTCLPLMf2g8TP4z6plQvXNazHVs=; b=G0oXmeow/N217h/SR/7J3yTAwZCEvb19qjAm2uY11ysyDsnYEmLjErmTYG7afH0j5ThJTrnxMKfvm751pnsCAzaQl3d2ys3v2Hok/XTskrZi+sLj2vMhYjemLRKp7GxnGqu1K284BNe4nmMqbsW2HBYJCMT0t9NnW9bnuql4uKgmICuCJAYEwFNB9teG4qVnKaSvPWCFySxAeguudxglJT2s7FZr85V4fQLAHl9zk/CS2S4fw2/T9NU24qNG+HIyeDbU+e98uZ65euyW1dLItShguAeqgatfwsYUynxzAMElCC29xZ84F1qB7jEn39wIXKfh4CJZhd2Pj7upztsX8w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hDhswLNuQU6AJ+o4ski3QweA7WDK411SbzAITywOgaHlapE0ccdjB8kVIEBZlo2SR27ANnePFoRxSUbVSAt9Pu8HIa9/VWo5rkDGH3BhStiOawiaecrgm3aEoCpGXyzY2c3OZP2nJ7th7CW4kdJX9QZUqEHgFYBiOX4pKWRDSQnrKJPUDttmf1lDBU8l6hXKkjIna1jGvfgfftkhkSthE+uREynDUkNTyZQ9jXnI1qJTFMBle7eplIEWLd9mqdtZD3bA3UQ7S8CUrOR34nbff+fxfG3apjG2SVX79ZsFE6oIQKIp6z8jQniPAVcVFvh0VuOgoc2FVdvSDYDvKcwNPQ==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Dario Faggioli <dfaggioli@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Meng Xu <mengxu@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 25 Mar 2026 15:14:29 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi Jan,
On 25/03/2026 13:50, Jan Beulich wrote:
On 25.03.2026 10:43, Oleksii Moisieiev wrote:
The RTDS domain-wide XEN_DOMCTL_SCHEDOP_putinfo path only checks for
zero values before applying period and budget to all vCPUs in the
domain.
This is weaker than the per-vCPU XEN_DOMCTL_SCHEDOP_putvcpuinfo path,
which already rejects values below the minimum, above the maximum, and
cases where budget exceeds period.
Use the same validation rules for putinfo as for putvcpuinfo, so
invalid domain-wide updates are rejected with -EINVAL instead of being
applied inconsistently.
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
---
xen/common/sched/rt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/xen/common/sched/rt.c b/xen/common/sched/rt.c
index 7b1f64a779..62188f37c6 100644
--- a/xen/common/sched/rt.c
+++ b/xen/common/sched/rt.c
@@ -1388,7 +1388,10 @@ rt_dom_cntl(
op->u.rtds.budget = RTDS_DEFAULT_BUDGET / MICROSECS(1);
break;
case XEN_DOMCTL_SCHEDOP_putinfo:
- if ( op->u.rtds.period == 0 || op->u.rtds.budget == 0 )
+ if ( op->u.rtds.period > RTDS_MAX_PERIOD ||
+ op->u.rtds.budget < RTDS_MIN_BUDGET ||
+ op->u.rtds.budget > op->u.rtds.period ||
+ op->u.rtds.period < RTDS_MIN_PERIOD )
Besides there being an indentation issue here, are the inputs of putinfo
really in different units than those of putvcpuinfo? The latter first
applies MICROSECS() before comparing against bounds. Assuming they are
using identical units (actually, they do, as putinfo uses MICROSECS()
when storing the values into the internal structure), I guess you'd best
make a small helper function used by both.
That's a good point. thank you. And sorry for the intendation. will fix.
Jan
|