Skip to contentSkip to conversation

x86, realmode: set real_mode permissions early

PATCH In review Borislav Petkov 3 participants 5 messages Dec 27, 2012 – Dec 28, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, realmode: set real_mode permissions early

Quoted 23 lines

commit 77e277cb85290a183bbc1995a1cd839b1c216f25
Subject: [PATCH] x86, realmode: set real_mode permissions early
Author: Yinghai Lu <[email protected]>
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.

arch/x86/realmode/init.c +0 -0
index 80450261215c..0b7e840ad4d4 100644

arch/x86/realmode/init.c static int __init set_real_mode_permissions(void) · line 114

Quoted 6 lines
arch/x86/realmode/init.c +1 -2
@@ -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.

Signature · 2 lines
Regards/Gruss,
Boris.
#1 lore raw
Quoted 24 lines · Borislav Petkov
Quoted 24 lines

commit 77e277cb85290a183bbc1995a1cd839b1c216f25
Subject: [PATCH] x86, realmode: set real_mode permissions early
Author: Yinghai Lu <[email protected]>
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.

arch/x86/realmode/init.c +0 -0
index 80450261215c..0b7e840ad4d4 100644
@@ -111,5 +111,4 @@ static int __init set_real_mode_permissions(void)
 
Quoted 9 lines

arch/x86/realmode/init.c static int __init set_real_mode_permissions(void) · line 114

Quoted 5 lines
arch/x86/realmode/init.c +1 -2
      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

#2 lore raw
Quoted 9 lines · Yinghai Lu
Quoted 4 lines

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

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#3 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Yinghai Lu
Quoted 5 lines

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.

Quoted 7 lines
Quoted 4 lines

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.
---

#4 lore raw

Seems ok.

Quoted 24 lines · Yinghai Lu
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Yinghai Lu
Quoted 5 lines

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.

Quoted 7 lines
Quoted 4 lines

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.
---

Signature · 1 line
Sent from my mobile phone. Please excuse brevity and lack of formatting.