]> xenbits.xensource.com Git - xen.git/commit
xen/arm: Allocate and free P2M pages from the P2M pool
authorHenry Wang <Henry.Wang@arm.com>
Tue, 11 Oct 2022 13:10:34 +0000 (15:10 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Oct 2022 13:10:34 +0000 (15:10 +0200)
commit7ad38a39f08aadc1578bdb46ccabaad79ed0faee
tree5e9c25634d830a3c7ecec3ef22f6624e6f69b214
parentc5215044578e88b401a1296ed6302df05c113c5f
xen/arm: Allocate and free P2M pages from the P2M pool

This commit sets/tearsdown of p2m pages pool for non-privileged Arm
guests by calling `p2m_set_allocation` and `p2m_teardown_allocation`.

- For dom0, P2M pages should come from heap directly instead of p2m
pool, so that the kernel may take advantage of the extended regions.

- For xl guests, the setting of the p2m pool is called in
`XEN_DOMCTL_shadow_op` and the p2m pool is destroyed in
`domain_relinquish_resources`. Note that domctl->u.shadow_op.mb is
updated with the new size when setting the p2m pool.

- For dom0less domUs, the setting of the p2m pool is called before
allocating memory during domain creation. Users can specify the p2m
pool size by `xen,domain-p2m-mem-mb` dts property.

To actually allocate/free pages from the p2m pool, this commit adds
two helper functions namely `p2m_alloc_page` and `p2m_free_page` to
`struct p2m_domain`. By replacing the `alloc_domheap_page` and
`free_domheap_page` with these two helper functions, p2m pages can
be added/removed from the list of p2m pool rather than from the heap.

Since page from `p2m_alloc_page` is cleaned, take the opportunity
to remove the redundant `clean_page` in `p2m_create_table`.

This is part of CVE-2022-33747 / XSA-409.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
master commit: cbea5a1149ca7fd4b7cdbfa3ec2e4f109b601ff7
master date: 2022-10-11 14:28:44 +0200
docs/misc/arm/device-tree/booting.txt
xen/arch/arm/domain.c
xen/arch/arm/domain_build.c
xen/arch/arm/domctl.c
xen/arch/arm/p2m.c