From: "Daniel P. Smith" <dpsmith@apertussolutions.com>
To: Jan Beulich <jbeulich@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Teddy Astie" <teddy.astie@vates.tech>,
"Roger Pau Monné" <roger@xenproject.org>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Volodymyr Babchuk" <volodymyr_babchuk@epam.com>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>
Subject: Re: [PATCH 24/24] XSM: fold xsm_{,un}bind_pt_irq() hooks
Date: Thu, 13 Aug 2026 07:32:30 -0400 [thread overview]
Message-ID: <2a04c020-1adc-4c1a-8d64-bc737781c1ad@apertussolutions.com> (raw)
In-Reply-To: <03d4456b-9e85-469c-a2a1-769faad67bb0@suse.com>
On 7/28/26 9:26 AM, Jan Beulich wrote:
> Like other resource management hooks they are mainly different in "add
> resource" vs "remove resource". Hence like in other cases a single hook
> can easily serve both purposes, with minor tweaking of
> flask_bind_pt_irq(). While adjusting that function, also defer the setting
> of "dperm", which is only needed in the "map" case.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/arm/domctl.c
> +++ b/xen/arch/arm/domctl.c
> @@ -104,7 +104,7 @@ long arch_do_domctl(struct xen_domctl *d
> if ( rc )
> return rc;
>
> - rc = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind);
> + rc = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind, true);
> if ( rc )
> return rc;
>
> @@ -140,7 +140,7 @@ long arch_do_domctl(struct xen_domctl *d
> if ( irq != virq )
> return -EINVAL;
>
> - rc = xsm_unbind_pt_irq(XSM_DM_PRIV, d, bind);
> + rc = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind, false);
> if ( rc )
> return rc;
>
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -622,7 +622,7 @@ long arch_do_domctl(
> if ( !is_hvm_domain(d) )
> break;
>
> - ret = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind);
> + ret = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind, true);
> if ( ret )
> break;
>
> @@ -660,7 +660,7 @@ long arch_do_domctl(
> if ( !is_hvm_domain(d) )
> break;
>
> - ret = xsm_unbind_pt_irq(XSM_DM_PRIV, d, bind);
> + ret = xsm_bind_pt_irq(XSM_DM_PRIV, d, bind, false);
> if ( ret )
> break;
>
> --- a/xen/include/xsm/dummy.h
> +++ b/xen/include/xsm/dummy.h
> @@ -478,14 +478,8 @@ static XSM_INLINE int xsm_map_domain_irq
> }
>
> static XSM_INLINE int xsm_bind_pt_irq(
> - XSM_DEFAULT_ARG struct domain *d, struct xen_domctl_bind_pt_irq *bind)
> -{
> - XSM_ASSERT_ACTION(XSM_DM_PRIV);
> - return xsm_default_action(action, current->domain, d);
> -}
> -
> -static XSM_INLINE int xsm_unbind_pt_irq(
> - XSM_DEFAULT_ARG struct domain *d, struct xen_domctl_bind_pt_irq *bind)
> + XSM_DEFAULT_ARG struct domain *d, struct xen_domctl_bind_pt_irq *bind,
> + bool allow)
> {
> XSM_ASSERT_ACTION(XSM_DM_PRIV);
> return xsm_default_action(action, current->domain, d);
> --- a/xen/include/xsm/hooks.h
> +++ b/xen/include/xsm/hooks.h
> @@ -72,8 +72,8 @@ XSM_HOOK(int, map_domain_pirq, struct do
> #endif
>
> XSM_HOOK(int, map_domain_irq, struct domain *, int, const pci_sbdf_t *, bool)
> -XSM_HOOK(int, bind_pt_irq, struct domain *, struct xen_domctl_bind_pt_irq *)
> -XSM_HOOK(int, unbind_pt_irq, struct domain *, struct xen_domctl_bind_pt_irq *)
> +XSM_HOOK(int, bind_pt_irq, struct domain *, struct xen_domctl_bind_pt_irq *,
> + bool)
>
> XSM_HOOK(int, irq_permission, struct domain *, int, bool)
> XSM_HOOK(int, iomem_permission, struct domain *, uint64_t, uint64_t, bool)
> --- a/xen/xsm/flask/hooks.c
> +++ b/xen/xsm/flask/hooks.c
> @@ -1090,16 +1090,15 @@ static int cf_check flask_map_domain_irq
> }
>
> static int cf_check flask_bind_pt_irq(
> - struct domain *d, struct xen_domctl_bind_pt_irq *bind)
> + struct domain *d, struct xen_domctl_bind_pt_irq *bind, bool access)
> {
> - uint32_t dsid, rsid;
> + uint32_t dsid, rsid, dperm;
> int rc = -EPERM;
> int irq;
> struct avc_audit_data ad;
> - uint32_t dperm = flask_iommu_resource_use_perm(d);
>
> - rc = current_has_perm(d, SECCLASS_RESOURCE, RESOURCE__ADD);
> - if ( rc )
> + rc = current_has_perm(d, SECCLASS_RESOURCE, resource_to_perm(access));
> + if ( rc || access )
Same as on patch 23, check is inverted.
v/r,
dps
prev parent reply other threads:[~2026-08-13 11:32 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 13:10 [PATCH 00/24] XSM: follow-on to XSAs 492 and 499 Jan Beulich
2026-07-28 13:13 ` [PATCH 01/24] XSM: reduce redundancy in hook machinery Jan Beulich
2026-07-30 15:05 ` Daniel P. Smith
2026-07-30 15:18 ` Jan Beulich
2026-07-30 18:21 ` Daniel P. Smith
2026-07-31 8:03 ` Jan Beulich
2026-08-02 14:46 ` Daniel P. Smith
2026-07-28 13:14 ` [PATCH 02/24] XSM: make .grant_*() hooks dependent upon GRANT_TABLE=y Jan Beulich
2026-07-30 18:23 ` Daniel P. Smith
2026-07-28 13:14 ` [PATCH 03/24] XSM: make .{,un}map_domain_pirq() hooks dependent upon HAS_PIRQ=y Jan Beulich
2026-08-02 14:50 ` Daniel P. Smith
2026-07-28 13:14 ` [PATCH 04/24] XSM: make PCI hooks dependent upon HAS_PCI=y Jan Beulich
2026-08-02 14:53 ` Daniel P. Smith
2026-07-28 13:15 ` [PATCH 05/24] XSM: make .iomem_mapping_vcpi() hook dependent upon HAS_VPCI=y Jan Beulich
2026-08-02 14:56 ` Daniel P. Smith
2026-07-28 13:15 ` [PATCH 06/24] XSM: make .kexec() hook dependent upon KEXEC=y Jan Beulich
2026-08-02 14:57 ` Daniel P. Smith
2026-07-28 13:15 ` [PATCH 07/24] XSM: make .hypfs() hook dependent upon HYPFS=y Jan Beulich
2026-08-02 14:58 ` Daniel P. Smith
2026-07-28 13:16 ` [PATCH 08/24] XSM: make .hvm_altp2mhvm_op() hook dependent upon ALTP2M=y Jan Beulich
2026-08-02 14:58 ` Daniel P. Smith
2026-07-28 13:17 ` [PATCH 09/24] XSM: make .hvm_param*() hooks dependent upon HVM=y Jan Beulich
2026-08-02 15:05 ` Daniel P. Smith
2026-08-03 9:55 ` Jan Beulich
2026-08-02 15:05 ` Daniel P. Smith
2026-07-28 13:17 ` [PATCH 10/24] XSM: make .dm_op() hook dependent upon IOREQ_SERVER=y Jan Beulich
2026-08-02 15:07 ` Daniel P. Smith
2026-07-28 13:18 ` [PATCH 11/24] XSM: make certain x86-specific hooks dependent upon PV=y Jan Beulich
2026-08-02 15:08 ` Daniel P. Smith
2026-07-28 13:18 ` [PATCH 12/24] x86/mm: get_page_from_l1e() is PV-or-shadow-only Jan Beulich
2026-08-02 15:55 ` Daniel P. Smith
2026-08-03 10:11 ` Jan Beulich
2026-08-13 11:51 ` Daniel P. Smith
2026-08-13 12:14 ` Jan Beulich
2026-08-13 13:02 ` Daniel P. Smith
2026-07-28 13:19 ` [PATCH 13/24] x86: restrict PHYSDEVOP_* when PV=n Jan Beulich
2026-08-05 22:38 ` Daniel P. Smith
2026-07-28 13:19 ` [PATCH 14/24] XSM/dummy: fold cf_check into XSM_INLINE Jan Beulich
2026-08-05 22:39 ` Daniel P. Smith
2026-07-28 13:20 ` [PATCH 15/24] XSM/dummy: drop redundant return statements Jan Beulich
2026-08-05 22:40 ` Daniel P. Smith
2026-07-28 13:20 ` [PATCH 16/24] XSM: suppress hypercall when XSM=n Jan Beulich
2026-08-05 22:42 ` Daniel P. Smith
2026-07-28 13:22 ` [PATCH 17/24] XSM: make Argo hooks well-formed ones Jan Beulich
2026-08-03 21:01 ` Jason Andryuk
2026-08-04 7:53 ` Jan Beulich
2026-08-04 14:27 ` Jason Andryuk
2026-08-05 9:11 ` Jan Beulich
2026-08-06 0:37 ` Daniel P. Smith
2026-08-05 23:02 ` Daniel P. Smith
2026-08-06 7:16 ` Jan Beulich
2026-08-06 14:09 ` Jason Andryuk
2026-08-13 12:09 ` Daniel P. Smith
2026-08-15 1:12 ` Jason Andryuk
2026-07-28 13:22 ` [PATCH 18/24] XSM: make XSM " Jan Beulich
2026-08-06 0:53 ` Daniel P. Smith
2026-08-06 7:22 ` Jan Beulich
2026-07-28 13:23 ` [PATCH 19/24] XSM: convert "allow" (Flask: "access") parameters to bool Jan Beulich
2026-08-06 0:56 ` Daniel P. Smith
2026-07-28 13:23 ` [PATCH 20/24] XSM: fold xsm_{,un}map_domain_pirq() hooks Jan Beulich
2026-08-06 1:10 ` Daniel P. Smith
2026-08-06 7:36 ` Jan Beulich
2026-08-06 8:02 ` Jan Beulich
2026-08-13 12:42 ` Daniel P. Smith
2026-08-13 13:02 ` Jan Beulich
2026-08-13 13:05 ` Daniel P. Smith
2026-07-28 13:24 ` [PATCH 21/24] x86: type-correct last parameter of map_domain_pirq() Jan Beulich
2026-07-28 13:25 ` [PATCH 22/24] XSM: pass just SBDF to xsm_{,un}map_domain_irq() Jan Beulich
2026-08-06 1:16 ` Daniel P. Smith
2026-07-28 13:26 ` [PATCH 23/24] XSM: fold xsm_{,un}map_domain_irq() hooks Jan Beulich
2026-08-13 11:27 ` Daniel P. Smith
2026-07-28 13:26 ` [PATCH 24/24] XSM: fold xsm_{,un}bind_pt_irq() hooks Jan Beulich
2026-08-13 11:32 ` Daniel P. Smith [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a04c020-1adc-4c1a-8d64-bc737781c1ad@apertussolutions.com \
--to=dpsmith@apertussolutions.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--cc=volodymyr_babchuk@epam.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.