Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EB25CD98ED for ; Thu, 18 Jun 2026 12:52:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1341135.1601683 (Exim 4.92) (envelope-from ) id 1waCDj-0002FU-GJ; Thu, 18 Jun 2026 12:51:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1341135.1601683; Thu, 18 Jun 2026 12:51:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1waCDj-0002FN-Dd; Thu, 18 Jun 2026 12:51:47 +0000 Received: by outflank-mailman (input) for mailman id 1341135; Thu, 18 Jun 2026 12:51:46 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1waCDi-0002FH-LB for xen-devel@lists.xenproject.org; Thu, 18 Jun 2026 12:51:46 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1waCDi-00D2vb-1Z for xen-devel@lists.xenproject.org; Thu, 18 Jun 2026 14:51:46 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a33e9d0-5cb7-0a2a0a5109dd-0a2a450a9156-34 for ; Thu, 18 Jun 2026 14:51:45 +0200 Received: from [209.85.128.51] (helo=mail-wm1-f51.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.0) (envelope-from ) id 6a33e9e1-93a5-0a2a450a0019-d1558033b090-3 for ; Thu, 18 Jun 2026 14:51:45 +0200 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-490afc47455so3334855e9.2 for ; Thu, 18 Jun 2026 05:51:45 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4923a1d2d9esm40221315e9.1.2026.06.18.05.51.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jun 2026 05:51:44 -0700 (PDT) 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=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1781787105; x=1782391905; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=+mY/FuMB1Bn63cK0YzU0ctXmeFaqrHY0ttlgEs7+H1Y=; b=dP9TNvrHUuxxlyI0BDpiRI/4ET7Qk6yZxwUr6tJkhJLzq3j++6M8xXWQ1Vyseg+2uo 9dA7WkyR+fnMwCJUX8rq/PVLOkkqM01ZUUYjTlUYrhY+8n1zH4RkGj3zyWacLe3ggz1o KOWuPxpXhzRLVbDwgpHpHprsgxVoeBY1nZwtMrguLj7f90hh8sardwkcvXAsDJNbIRxF jG7VKrCI9tu5KKhwmnd9MVxA828FF4CgDCRoLt8xrqFR4qsOUKKJGmBRRqkwxiV3PaEp o9jONUVk6+eFlglFN7J1S3QMDnP2ihjvMV0eISzoE30wDhfWzboUUeJPe0oxbuHtRz0w qjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781787105; x=1782391905; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+mY/FuMB1Bn63cK0YzU0ctXmeFaqrHY0ttlgEs7+H1Y=; b=rBxkj5d/6Gyhi8mhrKhwQlXOZ0dboKzW00ABYptbm5K5RufnB12jBKcH43SUzNZbk8 tCTFyNrfUSy9j7sdMEFJfCIssZGT1oHQ5p8C+ByzL/cSBZ+exS/8NDCPHoJxcZmmj4Bc DZlMjDxJD6qIhMPq5CcRPsbK+Zixi6sV3AMVn62rfugSy06d5mW351v9EvlcCV9QiOvn 2/hE4QJnTbxFaccYHLtW52ffhEKadQbsaYOnZuSUoJf0KQ+Y/N+Tna6UfHd6WIRd9orh w4Mz0aLRa98nMlvA9rs0H8UGV6ZOijb2f55/21eI7Ju8Yoz5rY3Td7Ngb7z3rnKTSkS0 lSYg== X-Forwarded-Encrypted: i=1; AFNElJ8p/Dx0QOdQs7z5HHCY2oQ2vRi1IeFgK2nyq48eDmB+K8TCPt035zTywLQHue+yH08w/6uGIq+W6xc=@lists.xenproject.org X-Gm-Message-State: AOJu0Yx+W2iVsEJA1LHSIbEPhk1QhJCDAdM19iqxyzf5hDBFdbcc8xhT 4hsK5IvPbN9TA4CvKP6VXuFENauhY1Kxbw+JxOvP6tjgIpynm3eEyZlUfLezo/ju+Q== X-Gm-Gg: AfdE7cn7LR3iWEVE5P6h1MnPSNdNPJ39Y7O+rpdUAS6cDSHXvYFdengbtBV0c6eRLGA zS4cZhiYijVmBgJa1XDV0Lwj2TC+etxurMxNyK/oMK3TPZXMlBgJ6GIJK9D4ZsOwlBkolPNVCZW gx2BfTUM3fgAwm0Sti5fFM/EpbDAaDjso+hISisVHTCd7Gq8oJDZjKckrKQ9k9UHKXNDFeYesmK Ku02bMa1WXQWb7l+oMSjLctLZ4QtLbzFeblUnHCI3kAO20ABPVEoAR5nne3gTAEqy4Q1gLCq3UP q4bQLhOj4hl1Zsivin9ep0dD8/ry8n0dcw5sD5ZwUjlD7lIp4UJpV9yt2BtXiIEUjsR5W83iFN9 Qu20rY07bj2o3CU8vdB3XNMQz6p1ViFzrj3EZ0e6EE5dwTQhCKCeKgw7D4bASYxMpQd+L9qUVqw 2eQY/zuxeuN3WkyHXA1Cw+1Y+keRvEeipYnA9YBtJrK+Iu/56KfqE06bhcUO+g+wvwMzvIYvmBB HPv X-Received: by 2002:a05:600c:4fce:b0:490:ce99:d2ee with SMTP id 5b1f17b1804b1-4923a99aa02mr31990425e9.15.1781787105338; Thu, 18 Jun 2026 05:51:45 -0700 (PDT) Message-ID: <12468fb6-0cf7-4e27-89ca-8ec4640e569b@suse.com> Date: Thu, 18 Jun 2026 14:51:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH for-4.22] XSM: guard .sysctl() and .readconsole() hooks To: "Daniel P. Smith" Cc: Oleksii Kurochko , "xen-devel@lists.xenproject.org" , Andrew Cooper References: <8536e453-423d-45a0-bb82-38283eca4786@citrix.com> <0604a985-96fc-454f-b9a1-242bc6cce9b6@suse.com> <243c5119-a016-49f4-919e-efa492b02e5e@suse.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6U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1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-purgate-ID: tlsNG-4011c0/1781787105-B1BF3DB8-F81EA533/0/0 X-purgate-type: clean X-purgate-size: 3100 On 18.06.2026 14:48, Daniel P. Smith wrote: > On 6/18/26 8:42 AM, Jan Beulich wrote: >> On 18.06.2026 14:34, Daniel P. Smith wrote: >>> On 6/18/26 8:23 AM, Jan Beulich wrote: >>>> On 18.06.2026 14:13, Andrew Cooper wrote: >>>>> On 18/06/2026 12:32 pm, Jan Beulich wrote: >>>>>> Leaving the hook pointers in struct xsm_ops when !SYSCTL would lead to >>>>>> the BUG_ON() in xsm_fixup_ops() triggering for respectively configured >>>>>> hypervisors. >>>>>> >>>>>> While moving the #ifdef for the corresponding xsm_*() wrappers, also move >>>>>> those for xsm_page_offline() (where the hook pointer field already is >>>>>> suitably guarded). >>>>>> >>>>>> Fixes: c9eabaa03a68 ("xen/xsm: wrap around xsm_sysctl with CONFIG_SYSCTL") >>>>>> Fixes: bddd9af6049f ("xen/sysctl: wrap around XEN_SYSCTL_readconsole") >>>>>> Signed-off-by: Jan Beulich >>>>> >>>>> Ugly.  We probably ought to see about booting the RANDCONFIG hypervisor >>>>> too, which should be able to spot things like this. >>>>> >>>>> This is a regression vs 4.21, so does need including. >>>> >>>> Aiui it's a regression vs 4.20, i.e. will want backporting to 4.21. >>>> >>>>> Reviewed-by: Andrew Cooper , although... >>>> >>>> Thanks. >>>> >>>>>> --- a/xen/include/xsm/xsm.h >>>>>> +++ b/xen/include/xsm/xsm.h >>>>>> @@ -61,8 +61,10 @@ struct xsm_ops { >>>>>> #endif >>>>>> int (*set_target)(struct domain *d, struct domain *e); >>>>>> int (*domctl)(struct domain *d, struct xen_domctl *op); >>>>>> +#ifdef CONFIG_SYSCTL >>>>>> int (*sysctl)(int cmd); >>>>>> int (*readconsole)(uint32_t clear); >>>>>> +#endif >>>>> >>>>> ... this is now the 3rd CONFIG_SYSCTL in xsm_ops. >>>>> >>>>> I know it will grow the diff, but can we see about collecting them into >>>>> a single region, and in dummy_ops too?  It will shrink the overall >>>>> result, and the order of pointers in this ops structure is uninteresting. >>>> >>>> I have a far more consolidating patch in the works, which is how I actually >>>> noticed the issue. I'd prefer to keep things as simple as possible here. >>> >>> By the way, I was going back through this and notices that they are not >>> ifdef out in xsm/dummy.h. Are we relying on them being inlines to ensure >>> that they do not result in dead code? >> >> I think so. Maybe it's unhelpful that we have > > To be clear, you want to leave as is for now (or at least pick up in > another patch)? It's up to you - I can add the #ifdef there, but it doesn't look to strictly be needed. >> #define XSM_INLINE __maybe_unused >> >> and we may instead better want explicit #ifdef wherever necessary. > > It's been a while since I tore that apart, but I believe there is some > trickery hidden in XSM_INLINE depending on whether XSM is "on or off". I > could be wrong as it's been a while since I tried to unwrap all of it. Aiui the "trickery" is that it's #define XSM_INLINE __maybe_unused with XSM=y and #define XSM_INLINE always_inline with XSM=n. Jan