x86/power/64: Use char arrays for asm function names
Subsystems (2)
PATCH 1/1 x86/power/64: Use char arrays for asm function names
This switches the hibernate_64.S function names into character arrays to match other areas of the kernel where this is done (e.g., linker scripts). Specifically this fixes a compile-time error noticed by the future CONFIG_FORTIFY_SOURCE routines that complained about PAGE_SIZE being copied out of the "single byte" core_restore_code variable.
Additionally drops the "acpi_save_state_mem" exern which does not appear to be used anywhere else in the kernel.
--- arch/x86/include/asm/suspend_64.h | 5 ++--- arch/x86/power/hibernate_64.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-)
arch/x86/include/asm/suspend_64.h +2 -3
@@ -42,8 +42,7 @@ struct saved_context { set_debugreg((thread)->debugreg##register, register)/* routines for saving/restoring kernel state */ -extern int acpi_save_state_mem (void ); -extern char core_restore_code; -extern char restore_registers; +extern char core_restore_code[]; +extern char restore_registers[];#endif /* _ASM_X86_SUSPEND_64_H */
arch/x86/power/hibernate_64.c +3 -3
@@ -147,7 +147,7 @@ static int relocate_restore_code(void)if (!relocated_restore_code)return -ENOMEM ; -memcpy ((void *)relocated_restore_code, &core_restore_code,PAGE_SIZE ); +memcpy ((void *)relocated_restore_code, core_restore_code,PAGE_SIZE );/* Make the page containing the relocated code executable */ pgd = (pgd_t *)__va (read_cr3 ()) +pgd_index (relocated_restore_code);
@@ -292,8 +292,8 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size)if (max_size <sizeof (struct restore_data_record ))return -EOVERFLOW ; - rdr->jump_address = (unsigned long )&restore_registers; - rdr->jump_address_phys =__pa_symbol (&restore_registers); + rdr->jump_address = (unsigned long )restore_registers; + rdr->jump_address_phys =__pa_symbol (restore_registers); rdr->cr3 = restore_cr3; rdr->magic =RESTORE_MAGIC ;
Signature · 6 lines
2.7.4 -- Kees Cook Pixel Security
Quoted 11 lines · Kees Cook
This switches the
hibernate_64.Sfunction names into character arrays to match other areas of the kernel where this is done (e.g., linker scripts). Specifically this fixes a compile-time error noticed by the futureCONFIG_FORTIFY_SOURCEroutines that complained aboutPAGE_SIZEbeing copied out of the "single byte"core_restore_codevariable.Additionally drops the "
acpi_save_state_mem" exern which does not appear to be used anywhere else in the kernel.Cc Daniel Micay <[email protected]>Signed-off-by Kees Cook <[email protected]>
Or I can queue this up if that's preferred.
Quoted 45 lines
--- arch/x86/include/asm/suspend_64.h | 5 ++--- arch/x86/power/hibernate_64.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-)arch/x86/include/asm/suspend_64.h +2
-3@@ -42,8 +42,7 @@ struct saved_context { set_debugreg((thread)->debugreg##register, register)/* routines for saving/restoring kernel state */ -extern int acpi_save_state_mem (void ); -extern char core_restore_code; -extern char restore_registers; +extern char core_restore_code[]; +extern char restore_registers[];#endif /* _ASM_X86_SUSPEND_64_H */ arch/x86/power/hibernate_64.c +3
-3@@ -147,7 +147,7 @@ static int relocate_restore_code(void)if (!relocated_restore_code)return -ENOMEM ; -memcpy ((void *)relocated_restore_code, &core_restore_code,PAGE_SIZE ); +memcpy ((void *)relocated_restore_code, core_restore_code,PAGE_SIZE );/* Make the page containing the relocated code executable */ pgd = (pgd_t *)__va (read_cr3 ()) +pgd_index (relocated_restore_code);@@ -292,8 +292,8 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size)if (max_size <sizeof (struct restore_data_record ))return -EOVERFLOW ; - rdr->jump_address = (unsigned long )&restore_registers; - rdr->jump_address_phys =__pa_symbol (&restore_registers); + rdr->jump_address = (unsigned long )restore_registers; + rdr->jump_address_phys =__pa_symbol (restore_registers); rdr->cr3 = restore_cr3; rdr->magic =RESTORE_MAGIC ;
Ingo Molnar
Acked-byQuoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Kees Cook
This switches the
hibernate_64.Sfunction names into character arrays to match other areas of the kernel where this is done (e.g., linker scripts). Specifically this fixes a compile-time error noticed by the futureCONFIG_FORTIFY_SOURCEroutines that complained aboutPAGE_SIZEbeing copied out of the "single byte"core_restore_codevariable.Additionally drops the "
acpi_save_state_mem" exern which does not appear to be used anywhere else in the kernel.
Quoted 6 lines
Quoted 2 lines
Cc Daniel Micay <[email protected]>Signed-off-by Kees Cook <[email protected]>Or I can queue this up if that's preferred.
LGTM too!
Thanks,
Ingo
Quoted 5 lines · Kees Cook
This switches the
hibernate_64.Sfunction names into character arrays to match other areas of the kernel where this is done (e.g., linker scripts). Specifically this fixes a compile-time error noticed by the futureCONFIG_FORTIFY_SOURCEroutines that complained aboutPAGE_SIZEbeing copied out of the "single byte"core_restore_codevariable.
Can we get equivalent fix for suspend_32.h?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html