]> xenbits.xensource.com Git - xen.git/commit
gnttab: don't use possibly unbounded tail calls
authorJan Beulich <jbeulich@suse.com>
Thu, 17 Aug 2017 13:15:35 +0000 (15:15 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 17 Aug 2017 13:15:35 +0000 (15:15 +0200)
commit42c8ba5dfc0be9d646f191c744c5fa71d7f372fa
tree5e6b8e6e2f6c3aabde4ce06e90ced5f1a44d09cf
parentd38489de9df93a4679cae2ae02b75287778fb3ed
gnttab: don't use possibly unbounded tail calls

There is no guarantee that the compiler would actually translate them
to branches instead of calls, so only ones with a known recursion limit
are okay:
- __release_grant_for_copy() can call itself only once, as
  __acquire_grant_for_copy() won't permit use of multi-level transitive
  grants,
- __acquire_grant_for_copy() is fine to call itself with the last
  argument false, as that prevents further recursion,
- __acquire_grant_for_copy() must not call itself to recover from an
  observed change to the active entry's pin count

This is part of XSA-226.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 999d2ccb7f73408aa22656e1ba2f98b077eaa1c2
master date: 2017-08-17 14:39:18 +0200
xen/common/grant_table.c