]> xenbits.xensource.com Git - people/iwj/xen.git/commit
mm: make opt_bootscrub non-init
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 26 Nov 2018 17:55:48 +0000 (18:55 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 27 Nov 2018 17:02:55 +0000 (17:02 +0000)
commit43fa95ae6a64132b8ebe3025bd187ab9df68677b
tree896478ba18e02cc4d78a48414cd32ad9bea25f3e
parent9ac13813d59479ac6c568ae3d838d034ea0ccdc8
mm: make opt_bootscrub non-init

LLVM code generation can attempt to load from a variable in the next
condition of an expression under certain circumstances, thus turning
the following condition:

if ( system_state < SYS_STATE_active && opt_bootscrub == BOOTSCRUB_IDLE )

Into:

0xffff82d080223967 <+103>: cmpl   $0x3,0x37b032(%rip) # 0xffff82d08059e9a0 <system_state>
0xffff82d08022396e <+110>: setb   -0x29(%rbp)
0xffff82d080223972 <+114>: cmpl   $0x2,0x228a8b(%rip) # 0xffff82d08044c404 <opt_bootscrub>

Such code will trigger a page fault if system_state >=
SYS_STATE_active because opt_bootscrub will be unmapped.

Fix this by making opt_bootscrub non-init, thus preventing the page
fault. The LLVM bug with the discussion about this issue can be found
at:

https://bugs.llvm.org/show_bug.cgi?id=39707

I haven't been able to find any other instances of such conditional
expression that uses system_state together with an init variable or
function.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
xen/common/page_alloc.c