[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v6 1/2] xen/console: add build-time rate-limiting controls


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Thu, 12 Nov 2026 10:20:41 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 148.163.138.245) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; arc=none (0)
  • 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=iu88BXIsjZUIxJM2ma9TdD9eNdYGgctO4D7rLHkMF4k=; b=DqqxyqgTYrk00Sk5PnMPRQkS8V+xUT9BJkg5JfJi30WQtECZ9NO9gMRj6W8qP+tfo0DSqWxRxtXKlA4+7sjidnMeC2lHmP6phTtMRtluK1pIcrcmuje6FuRJH1PNqeRQdvXgF38eAZ+90myR0JYZ8zTjyxBkMOuQLD2sHgsVZnT7ZlLiX6QA6LMETCr7/BctnbPVdHdgg75HRCTONByhoD8Y5CODGZnTgnoW0kdPd5TwfrtcBTI4GlJ7rHsG/HLQMKQZpqd7DMAWBTcMR5hXIcmTvXTIA2FeZ/12WZt3V6X3NmpiIDOyda2E2BpO8Komz6+PSnmY23z6VnxdhDTrRQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=I4A6YtH2G9r1lJPAFIMGDHraA0AH3UEsCzda14EDzZcrqZCS0UX4cR6Duk5dpmvRTQqKzxHGBkHcw0mJhVRkIuwu0GDq2j8LmdM/n7xrO4374Uzx6NQsClSuhvnunx1vJmZ4M+bfXIsg2VpyYmiMHo9uOyiUyPZ08obuqcQu23ci/qHu+NC8+kUA23g7rsfM+r02Ydko7d3gWIew1WN04S2RrgbFVa+gLx2VMpEz2NSToByzg7YQeFEeofLYlSLLmu7P7ugp9BmmxQmjSDtp1EahjMxZxrbowalxm/lki7692H4WZJwF/HRv9IpFiPsnKq8hI2Syq+i0wIgB1DJKUQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger@xxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxx, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Fri, 13 Nov 2026 12:19:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx>

Introduce CONFIG_PRINTK_RATELIMIT_MS and CONFIG_PRINTK_RATELIMIT_BURST
for configuring rate-limiting policy at the compile time.

Use symbols for global rate-limiting initialization in the console driver.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
Changes since v5:
- updated notes on security supportable rate-limiting configurations
---
 xen/common/Kconfig         | 30 ++++++++++++++++++++++++++++++
 xen/drivers/char/console.c |  6 ++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 5b289e444fa5..539cccf21029 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -675,4 +675,34 @@ config PM_STATS
          Enable collection of performance management statistics to aid in
          analyzing and tuning power/performance characteristics of the system
 
+menu "Console rate-limiting"
+       visible if EXPERT
+
+config PRINTK_RATELIMIT_MS
+       int "printk rate-limiting time window (milliseconds)"
+       default 5000
+       help
+         Specifies the time window, in milliseconds, for rate-limited printk
+         messages. No more than `CONFIG_PRINTK_RATELIMIT_BURST` messages will 
be
+         printed within this window.
+
+         Setting this value to 0 disables rate-limiting entirely.
+
+         Rate-limiting configurations within [0..5000) milliseconds are not
+         security supported.
+
+config PRINTK_RATELIMIT_BURST
+       int "printk rate-limited message burst size"
+       default 10
+       help
+         Defines the maximum number of rate-limited printk messages that may
+         be printed within each `CONFIG_PRINTK_RATELIMIT_MS` time window.
+
+         Setting this value to 0 disables rate-limiting entirely.
+
+         Rate-limiting configurations with burst size larger than default 10
+         are not security supported.
+
+endmenu
+
 endmenu
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index e4df0bbc2eec..1a8beb6665c1 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1330,10 +1330,12 @@ bool __printk_ratelimit(unsigned int ratelimit_ms,
 }
 
 /* Minimum time in ms between messages */
-static const unsigned int printk_ratelimit_ms = 5 * 1000;
+static const unsigned int printk_ratelimit_ms =
+    CONFIG_PRINTK_RATELIMIT_MS;
 
 /* Number of messages we send before ratelimiting */
-static const unsigned int printk_ratelimit_burst = 10;
+static const unsigned int printk_ratelimit_burst =
+    CONFIG_PRINTK_RATELIMIT_BURST;
 
 bool printk_ratelimit(void)
 {
-- 
2.56.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.