From nobody Sun Apr 12 22:37:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1775840568; cv=none; d=zohomail.com; s=zohoarc; b=oDqj4fbvAhRgxCu4dow01e5S5cwZ1Fdrr8Jej7R7Bs4YEECPmUbC2VxLQsFJTUgnj0zEGhbynxUu4Z9jI49Y3igMbXLQSOUwJ6YaSRAPW2/akoDdfdb4O4mE7ta+COwgEGNgc3QrYFeKtk8FbOL16E0Dz+rhG6lksi2GZ3srUps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775840568; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=i2MeOwOQ0HpzPcQqHFqvJhQPkk3zuHdR2kp1S4waI/Y=; b=hm2gS1VnuktFiymQXMNBKCu5HsAZHNUH7c2pbu/UPJEW+sxUw3tYtn30C8nJDsBtzDanD7i6Bg9hGKbZ2PM6RXdaXx4LfJfZvQRuXWwIRinNZCl3zFj+4Y/p4Wbd+dI/LEpW1Ki2k/VNpDfg9KEmjM/m/9V7qty16hRWc4WfGSw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1775840568327498.8975522629506; Fri, 10 Apr 2026 10:02:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1279586.1563958 (Exim 4.92) (envelope-from ) id 1wBFFL-00072I-P1; Fri, 10 Apr 2026 17:02:19 +0000 Received: by outflank-mailman (output) from mailman id 1279586.1563958; Fri, 10 Apr 2026 17:02:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wBFFL-00072B-L4; Fri, 10 Apr 2026 17:02:19 +0000 Received: by outflank-mailman (input) for mailman id 1279586; Fri, 10 Apr 2026 16:40:55 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wBEud-0004ce-Ol for xen-devel@lists.xenproject.org; Fri, 10 Apr 2026 16:40:55 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wBEud-00GILx-4t for xen-devel@lists.xenproject.org; Fri, 10 Apr 2026 18:40:55 +0200 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69d92808-e002-0a2a0a5209dd-0a2a4509c3b6-20 for ; Fri, 10 Apr 2026 18:40:55 +0200 Received: from [209.85.221.53] (helo=mail-wr1-f53.google.com) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.0) (envelope-from ) id 69d92816-bf79-0a2a45090019-d155dd35e810-3 for ; Fri, 10 Apr 2026 18:40:55 +0200 Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-43cf7683a28so1518543f8f.2 for ; Fri, 10 Apr 2026 09:40:55 -0700 (PDT) Received: from thinkpad-t470s.. (93-138-230-56.adsl.net.t-com.hr. [93.138.230.56]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-43d63de2a74sm9148616f8f.3.2026.04.10.09.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 09:40:53 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775839254; x=1776444054; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=i2MeOwOQ0HpzPcQqHFqvJhQPkk3zuHdR2kp1S4waI/Y=; b=NFd8cvwowwrgrHBayC1FeAFp5rfctjN3P3lIzetmZT07Y8fnV2XY54bTusXlwb3D5z GNhaoQX2GbBNfKdi3xlNXWxdazkh9WsirjkSfcx2xHLvur9tziXbbrRYWYEkb+MaFb2t 1rOXA+qKvnqtXNQEXqv3XVsvoACa64mnPcuEBk9LCUC6ZlKkMIYFvCZufkF1Rrqf+8nJ 9uULkOXM1Dlcvbq68IVzyxEvgtuMksL/DDDmLgjRcEpE1MLVUoqTvwrLtizFJVzwvCpq +vdNU1ZLBbEIrvm9mP/6Pk+hDkXlRC+Xf/qSN8Vt1xBcte9zW3M2/+yKRfCHep9PV8dl TGtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775839254; x=1776444054; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=i2MeOwOQ0HpzPcQqHFqvJhQPkk3zuHdR2kp1S4waI/Y=; b=ct8I4oN+oNlkR3H/nhpMQp7H6ToQouEZul0MwMCeJMTL4LzkWZWaGATuxBwm7gWh4v vmvW8OKyRq2lLt9mqGaZCNEJNBUkNs04Ve49M3pi+1YqDnevMsgGbLCCBOgKvoy9BRbK +LMES04Ce54rIJWTxK5nIh8exqkrI40vdC2UwYOpu53//HxxgyIslfcxR++p+CMDCSwb PybPrdqgcy8PAKFKoGI2rkjxR+n3WMDsHZ4Kh+Yei1kyYCBA7q0rP/QancDQhB1GPNCz dY+gzctjVgFV68hw1oN2oqroHmxYH3PdAjeN20VPIPlfDe1R6f6wZadr0VJfPgRfH5Vl sikg== X-Gm-Message-State: AOJu0Yw9MpYrVas/qWT1Okp+8fQ6ZLc9LGMQvOLFqo8htkYh6nTrL10m lY3XVf+KxufDHG8VpqdYR7fJxqfCoVoGwaJB5qn3iVK6HKhZxlI/4+hQLEjtCLeh X-Gm-Gg: AeBDietOq6Lnk347PS0e0J/VLDVaBqhZlVb7nV5U59hD55KigXi0AMQGRh0x1tH1NQH 86QneOHQlYJsDPJzms9spxUA+YcX15+z6jGplUyi+oP1k4BeB8ykuOryiFKjtFoMizAc4HVvbSd CUaAoMGVZM7GgiRjqcFzOU+JvaNY2hvAMhAQP6k9rbX5YzYYynj9LtpN6mDdUn8CTaRL0lc25u0 WihXEU0WOGErWzTj/U47zuNocr/5CKG9Pv0TL6rbpwaxAv41jZrMQQd+gAAk24tvmuzbTp0036o PqYShDv2h3saAxC9bP+bQRAQNpWi/DEEGllK5OWQGkVAoJiOZAtIW7T9Wjy+CpBtWp4a9mSvbB9 ggWklPiLe0RNB4eTUgxSgtL7ph9+uC3ytaZV/7WgRd6Dlb8a3oDDM3YgCZcKPojd1+54aMdpy7N Nbk6HGkw1DQoLO1iiJWbSfp/+fUoWEQOxHU68Cs0JzU2Ns/W9exD95itsXLbsHuPb1Q0Y= X-Received: by 2002:a05:6000:611:b0:43d:613:33d8 with SMTP id ffacd0b85a97d-43d642b9e4amr6075919f8f.29.1775839253942; Fri, 10 Apr 2026 09:40:53 -0700 (PDT) From: Ruslan Ruslichenko To: xen-devel@lists.xenproject.org Cc: volodymyr_babchuk@epam.com, Ruslan_Ruslichenko@epam.com, Dario Faggioli , Juergen Gross , George Dunlap Subject: [PATCH] xen/sched: fix scheduler callback verification on init Date: Fri, 10 Apr 2026 18:40:39 +0200 Message-ID: <20260410164039.1000284-1-ruslichenko.r@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-bad1c0/1775839255-5CDF7152-028EBDF8/0/0 X-purgate-type: clean X-purgate-size: 1916 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1775840570042158500 Content-Type: text/plain; charset="utf-8" From: Ruslan Ruslichenko During core scheduler initialization, each registered scheduler is sanity tested in two steps: - it must provide required callbacks (e.g. init, do_schedule). - if global_init callback is present, it must succeed. If any of the steps fail, scheduler entry is cleared in global 'schedulers' array. However, in the current implementation, if verification fails during the first step, the scheduler entry is cleared but verification sequence is not interrupted. This lead to NULL pointer dereference when subsequent required callbacks verified, and possible during the second step. The patch fixes the crashes by adding check inside sched_test_func macro and skipping the call to a global_init if first step did not pass. Signed-off-by: Ruslan Ruslichenko --- xen/common/sched/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index a57d5dd929..4270c89491 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -3017,7 +3017,7 @@ void __init scheduler_init(void) for ( i =3D 0; i < NUM_SCHEDULERS; i++) { #define sched_test_func(f) \ - if ( !schedulers[i]->f ) \ + if ( schedulers[i] && !schedulers[i]->f ) \ { \ printk("scheduler %s misses .%s, dropped\n", \ schedulers[i]->opt_name, #f); \ @@ -3034,6 +3034,9 @@ void __init scheduler_init(void) =20 #undef sched_test_func =20 + if ( !schedulers[i] ) + continue; + if ( schedulers[i]->global_init && schedulers[i]->global_init() < = 0 ) { printk("scheduler %s failed initialization, dropped\n", --=20 2.43.0