page-alloc: detect double free earlier
authorJan Beulich <jbeulich@suse.com>
Mon, 13 May 2019 07:58:57 +0000 (09:58 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 13 May 2019 07:58:57 +0000 (09:58 +0200)
commitf882fadbeb8bc4d09f6522e0769baff13b89bdb9
tree77d36db736d76e19412fb814b023293ca1af3ffe
parent24f1a58d1954f56f28e494f45e2ea9aa7f78f5fb
page-alloc: detect double free earlier

Right now this goes unnoticed until some subsequent page allocator
operation stumbles across the thus corrupted list. We can do better:
Only PGC_state_inuse and PGC_state_offlining pages can legitimately be
passed to free_heap_pages().

Take the opportunity and also restrict the PGC_broken check to the
PGC_state_offlining case, as only pages of that type or
PGC_state_offlined may have this flag set on them. Similarly, since
PGC_state_offlined is not a valid input state, the setting of "tainted"
can be restricted to just this case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/page_alloc.c