diff mbox

x86: move both exception tables into .rodata

Message ID 56E6E39E02000078000DC1B8@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich March 14, 2016, 3:15 p.m. UTC
While they are being written during early boot (when sorting them),
that writing takes place before we actually start fiddling with page
table permissions, so these tables can benefit from getting write
protected just like ordinary r/o data does (for now only when using
2M mappings).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86: move both exception tables into .rodata

While they are being written during early boot (when sorting them),
that writing takes place before we actually start fiddling with page
table permissions, so these tables can benefit from getting write
protected just like ordinary r/o data does (for now only when using
2M mappings).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -73,6 +73,17 @@ SECTIONS
        *(.rodata)
        *(.rodata.*)
 
+       . = ALIGN(8);
+       /* Exception table */
+       __start___ex_table = .;
+       *(.ex_table)
+       __stop___ex_table = .;
+
+       /* Pre-exception table */
+       __start___pre_ex_table = .;
+       *(.ex_table.pre)
+       __stop___pre_ex_table = .;
+
 #ifdef LOCK_PROFILE
        . = ALIGN(POINTER_ALIGN);
        __lock_profile_start = .;
@@ -154,16 +165,6 @@ SECTIONS
   __2M_rwdata_start = .;       /* Start of 2M superpages, mapped RW. */
   . = ALIGN(SMP_CACHE_BYTES);
   .data.read_mostly : {
-       /* Exception table */
-       __start___ex_table = .;
-       *(.ex_table)
-       __stop___ex_table = .;
-
-       /* Pre-exception table */
-       __start___pre_ex_table = .;
-       *(.ex_table.pre)
-       __stop___pre_ex_table = .;
-
        *(.data.read_mostly)
        . = ALIGN(8);
        __start_schedulers_array = .;

Comments

Andrew Cooper March 14, 2016, 3:25 p.m. UTC | #1
On 14/03/16 15:15, Jan Beulich wrote:
> While they are being written during early boot (when sorting them),
> that writing takes place before we actually start fiddling with page
> table permissions, so these tables can benefit from getting write
> protected just like ordinary r/o data does (for now only when using
> 2M mappings).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

I had a plan to modify the build to sort these at build time, like Linux
does.  But either way, this is an improvement.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -73,6 +73,17 @@  SECTIONS
        *(.rodata)
        *(.rodata.*)
 
+       . = ALIGN(8);
+       /* Exception table */
+       __start___ex_table = .;
+       *(.ex_table)
+       __stop___ex_table = .;
+
+       /* Pre-exception table */
+       __start___pre_ex_table = .;
+       *(.ex_table.pre)
+       __stop___pre_ex_table = .;
+
 #ifdef LOCK_PROFILE
        . = ALIGN(POINTER_ALIGN);
        __lock_profile_start = .;
@@ -154,16 +165,6 @@  SECTIONS
   __2M_rwdata_start = .;       /* Start of 2M superpages, mapped RW. */
   . = ALIGN(SMP_CACHE_BYTES);
   .data.read_mostly : {
-       /* Exception table */
-       __start___ex_table = .;
-       *(.ex_table)
-       __stop___ex_table = .;
-
-       /* Pre-exception table */
-       __start___pre_ex_table = .;
-       *(.ex_table.pre)
-       __stop___pre_ex_table = .;
-
        *(.data.read_mostly)
        . = ALIGN(8);
        __start_schedulers_array = .;