lkml.org 
[lkml]   [2022]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 03/16] x86/boot: Set cr0 to known state in trampoline
On 2022-10-19 10:44, Andrew Cooper wrote:
> On 06/09/2022 11:41, Evgeniy Baskov wrote:
>> diff --git a/arch/x86/boot/compressed/head_64.S
>> b/arch/x86/boot/compressed/head_64.S
>> index d33f060900d2..5273367283b7 100644
>> --- a/arch/x86/boot/compressed/head_64.S
>> +++ b/arch/x86/boot/compressed/head_64.S
>> @@ -619,9 +619,8 @@ SYM_CODE_START(trampoline_32bit_src)
>> /* Set up new stack */
>> leal TRAMPOLINE_32BIT_STACK_END(%ecx), %esp
>>
>> - /* Disable paging */
>> - movl %cr0, %eax
>> - btrl $X86_CR0_PG_BIT, %eax
>> + /* Disable paging and setup CR0 */
>> + movl $(CR0_STATE & ~X86_CR0_PG), %eax
>
> Why here?  WP is ignored when PG is disabled.
>
> ~Andrew

PG is enabled lower in this function, so WP can also be set there,
it should not make any difference. The only important thing is that
WP supposed to be set in trampoline code.

If you think, that it would be more logical to set PG and WP
simultaneously, I can change it to be that way.

Thanks,
Evgeniy Baskov

\
 
 \ /
  Last update: 2022-10-20 15:27    [W:1.060 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site