[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/2] restrict concept of pIRQ to x86
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 4 May 2023 08:38:41 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=AYJ7iD/4wH8NobWx0XxiU2uD48mzWp79ptgMKoq265g=; b=XwNrnRBg6QPDKtE5WT330MYZnOOdvOpF+wGf8sqzxvz/c4KfQPArnBKuXLoEOjXNAYRi4lc4yH8/cQQAMhsxRuiCRFncAessvTmn1SnmCcNuk/og0AgDBYAuUHO90rjXlHy8PPV0lZ2Ri6aJKQ73eXGTOhEeJs+MDCFXILV9PMXG28QXb8kUOzYXmcrjzyr03jDzU6wWK7uj208DCngsfXp8EXnuqAkwLppJhQFVSy80QT9zvaZl/kYGQMWN9GH5AOcKQ6jX0IAgYow4qslzMzpJ6zzs7IBG6b561zLT6LA95VWyK/eIrOq5/19FKH47bta1rQueTi5yxFDH7Qz6EA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hK0z8MRh+oZMYIiPBu8adL2pdYoVh3ULBXAIMzQpRxPTUtBetPt3YCf+KhitQUsSUUG8NAx6Rl2Pg3u0TyZw+/fNrZIdIWBHg7csD7U1aBfJVPUuHQ6xOpmyoOogYG4uyZgsajTF3Vax0P/SaXeLtcA+h2L2M0V0e5cgQ3Lv0Rpx5iytXXG3IDafn20GvW0zZlO2LSpv91cLS3xkI7K+NCLLAK2GiRGU7CPFRztXWZpH/bWNLCni45R4TPTiP4DjcEesKIOqP1vNIW08hcM4ywyudRkcqvgqTK7LavWCawj44RPgDZ/V7EzP4AeIWA3rv7Ntmh1Eu3j49LnHoq7H7w==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
- Delivery-date: Thu, 04 May 2023 06:39:04 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 03.05.2023 17:33, Jan Beulich wrote:
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -683,11 +683,13 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xe
> unsigned int pirq = op->u.irq_permission.pirq, irq;
> int allow = op->u.irq_permission.allow_access;
>
> +#ifdef CONFIG_HAS_PIRQ
> if ( pirq >= current->domain->nr_pirqs )
> {
> ret = -EINVAL;
> break;
> }
> +#endif
> irq = pirq_access_permitted(current->domain, pirq);
> if ( !irq || xsm_irq_permission(XSM_HOOK, d, irq, allow) )
> ret = -EPERM;
It has occurred to me that in place of adding #ifdef here, we could simply
drop that if(), resulting in out-of-range value to also hit the -EPERM
path. Would that (a) be acceptable and (b) maybe be preferred for being
less code and (more importantly) less #ifdef-ary?
Jan
|