public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, realmode: set real_mode permissions early
@ 2012-12-27 18:22 Borislav Petkov
  2012-12-27 23:56 ` Yinghai Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2012-12-27 18:22 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: H. Peter Anvin, LKML

> commit 77e277cb85290a183bbc1995a1cd839b1c216f25
> Subject: [PATCH] x86, realmode: set real_mode permissions early
> Author: Yinghai Lu <yinghai@kernel.org>
> Date:   Mon Dec 24 18:00:21 2012 -0800
> 
>     x86, realmode: set real_mode permissions early
>     
>     We need to set trampoline code to EXEC early before we do smp
>     AP bootings.
>     
>     Found the problem after switching to #PF handler set page table,
>     and we do not set initial kernel low mapping with EXEC anymore.
>     
>     Change to use early_initcall instead that will make sure tramopline
>     will have EXEC set.
>     
>     Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> 
> diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
> index 80450261215c..0b7e840ad4d4 100644
> --- a/arch/x86/realmode/init.c
> +++ b/arch/x86/realmode/init.c
> @@ -111,5 +111,4 @@ static int __init set_real_mode_permissions(void)
>  
>  	return 0;
>  }
> -
> -arch_initcall(set_real_mode_permissions);
> +early_initcall(set_real_mode_permissions);

I'm looking at this patch in the -v8 branch: you need to update the
comment above that function to say that trampoline code needs to be
marked X now earlier.

Thanks.

-- 
Regards/Gruss,
Boris.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, realmode: set real_mode permissions early
  2012-12-27 18:22 [PATCH] x86, realmode: set real_mode permissions early Borislav Petkov
@ 2012-12-27 23:56 ` Yinghai Lu
  2012-12-28  0:01   ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Yinghai Lu @ 2012-12-27 23:56 UTC (permalink / raw)
  To: Borislav Petkov, Yinghai Lu, H. Peter Anvin, LKML

On Thu, Dec 27, 2012 at 10:22 AM, Borislav Petkov <bp@alien8.de> wrote:
>> commit 77e277cb85290a183bbc1995a1cd839b1c216f25
>> Subject: [PATCH] x86, realmode: set real_mode permissions early
>> Author: Yinghai Lu <yinghai@kernel.org>
>> Date:   Mon Dec 24 18:00:21 2012 -0800
>>
>>     x86, realmode: set real_mode permissions early
>>
>>     We need to set trampoline code to EXEC early before we do smp
>>     AP bootings.
>>
>>     Found the problem after switching to #PF handler set page table,
>>     and we do not set initial kernel low mapping with EXEC anymore.
>>
>>     Change to use early_initcall instead that will make sure tramopline
>>     will have EXEC set.
>>
>>     Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>
>> diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
>> index 80450261215c..0b7e840ad4d4 100644
>> --- a/arch/x86/realmode/init.c
>> +++ b/arch/x86/realmode/init.c
>> @@ -111,5 +111,4 @@ static int __init set_real_mode_permissions(void)
>>
>>       return 0;
>>  }
>> -
>> -arch_initcall(set_real_mode_permissions);
>> +early_initcall(set_real_mode_permissions);
>
> I'm looking at this patch in the -v8 branch: you need to update the
> comment above that function to say that trampoline code needs to be
> marked X now earlier.

Not sure if we really need to add such comment in the code.

Peter, what is your idea about this?

Yinghai

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, realmode: set real_mode permissions early
  2012-12-27 23:56 ` Yinghai Lu
@ 2012-12-28  0:01   ` H. Peter Anvin
  2012-12-28  0:57     ` Yinghai Lu
  0 siblings, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2012-12-28  0:01 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Borislav Petkov, LKML

On 12/27/2012 03:56 PM, Yinghai Lu wrote:
>>
>> I'm looking at this patch in the -v8 branch: you need to update the
>> comment above that function to say that trampoline code needs to be
>> marked X now earlier.
>
> Not sure if we really need to add such comment in the code.
>
> Peter, what is your idea about this?
>

It would be good to note why the early_initcall is the right phase.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, realmode: set real_mode permissions early
  2012-12-28  0:01   ` H. Peter Anvin
@ 2012-12-28  0:57     ` Yinghai Lu
  2012-12-28  1:09       ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Yinghai Lu @ 2012-12-28  0:57 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Borislav Petkov, LKML

On Thu, Dec 27, 2012 at 4:01 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 12/27/2012 03:56 PM, Yinghai Lu wrote:
>>>
>>>
>>> I'm looking at this patch in the -v8 branch: you need to update the
>>> comment above that function to say that trampoline code needs to be
>>> marked X now earlier.
>>
>>
>> Not sure if we really need to add such comment in the code.
>>
>> Peter, what is your idea about this?
>>
>
> It would be good to note why the early_initcall is the right phase.
>

How about:

---
Trampoline will be executed by APs with SMP,
So we need to set it EXEC in do_pre_smp_initcalls and it is early_initcall.
---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, realmode: set real_mode permissions early
  2012-12-28  0:57     ` Yinghai Lu
@ 2012-12-28  1:09       ` H. Peter Anvin
  0 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2012-12-28  1:09 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Borislav Petkov, LKML

Seems ok.

Yinghai Lu <yinghai@kernel.org> wrote:

>On Thu, Dec 27, 2012 at 4:01 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> On 12/27/2012 03:56 PM, Yinghai Lu wrote:
>>>>
>>>>
>>>> I'm looking at this patch in the -v8 branch: you need to update the
>>>> comment above that function to say that trampoline code needs to be
>>>> marked X now earlier.
>>>
>>>
>>> Not sure if we really need to add such comment in the code.
>>>
>>> Peter, what is your idea about this?
>>>
>>
>> It would be good to note why the early_initcall is the right phase.
>>
>
>How about:
>
>---
>Trampoline will be executed by APs with SMP,
>So we need to set it EXEC in do_pre_smp_initcalls and it is
>early_initcall.
>---

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-28  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-27 18:22 [PATCH] x86, realmode: set real_mode permissions early Borislav Petkov
2012-12-27 23:56 ` Yinghai Lu
2012-12-28  0:01   ` H. Peter Anvin
2012-12-28  0:57     ` Yinghai Lu
2012-12-28  1:09       ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox