gnttab: add preemption check to gnttab_release_mappings()
authorJan Beulich <jbeulich@suse.com>
Wed, 25 Aug 2021 13:07:25 +0000 (15:07 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 25 Aug 2021 13:07:25 +0000 (15:07 +0200)
commit29aeeda345168a70facfd7c7ef16fbea6d447061
tree0a35de9e260a28fa378277f8be708646f769cdb1
parent98bcd536c24ea35dcaed84cc35ce0f6c938ba9d6
gnttab: add preemption check to gnttab_release_mappings()

A guest may die with many grant mappings still in place, or simply with
a large maptrack table. Iterating through this may take more time than
is reasonable without intermediate preemption (to run softirqs and
perhaps the scheduler).

Move the invocation of the function to the section where other
restartable functions get invoked, and have the function itself check
for preemption every once in a while. Have it iterate the table
backwards, such that decreasing the maptrack limit is all it takes to
convey restart information.

In domain_teardown() introduce PROG_none such that inserting at the
front will be easier going forward.

This is part of CVE-2021-28698 / XSA-380.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
master commit: b1ee10be5625b7d502cef1e6ee3818610ab0d29c
master date: 2021-08-25 14:18:18 +0200
xen/common/domain.c
xen/common/grant_table.c
xen/include/xen/grant_table.h