mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] move do_suspend_lowlevel to correct segment
@ 2006-06-15  3:39 Shaohua Li
  2006-06-15  9:19 ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Shaohua Li @ 2006-06-15  3:39 UTC (permalink / raw)
  To: lkml; +Cc: Len Brown, Pavel Machek, Andrew Morton


Move do_suspend_lowlevel to correct segment. If it is in the same hugepage
with ro data, mark_rodata_ro will make it unexecutable.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---

 linux-2.6.17-rc5-root/arch/i386/kernel/acpi/wakeup.S |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff -puN arch/i386/kernel/acpi/wakeup.S~wakeup arch/i386/kernel/acpi/wakeup.S
--- linux-2.6.17-rc5/arch/i386/kernel/acpi/wakeup.S~wakeup	2006-06-14 09:21:26.000000000 +0800
+++ linux-2.6.17-rc5-root/arch/i386/kernel/acpi/wakeup.S	2006-06-14 09:21:57.000000000 +0800
@@ -265,11 +265,6 @@ ENTRY(acpi_copy_wakeup_routine)
 	movl	$0x12345678, saved_magic
 	ret
 
-.data
-ALIGN
-ENTRY(saved_magic)	.long	0
-ENTRY(saved_eip)	.long	0
-
 save_registers:
 	leal	4(%esp), %eax
 	movl	%eax, saved_context_esp
@@ -304,7 +299,11 @@ ret_point:
 	call	restore_processor_state
 	ret
 
+.data
 ALIGN
+ENTRY(saved_magic)	.long	0
+ENTRY(saved_eip)	.long	0
+
 # saved registers
 saved_gdt:	.long	0,0
 saved_idt:	.long	0,0
_

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

* Re: [PATCH] move do_suspend_lowlevel to correct segment
  2006-06-15  3:39 [PATCH] move do_suspend_lowlevel to correct segment Shaohua Li
@ 2006-06-15  9:19 ` Pavel Machek
  2006-06-16  0:52   ` Shaohua Li
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2006-06-15  9:19 UTC (permalink / raw)
  To: Shaohua Li; +Cc: lkml, Len Brown, Andrew Morton

Hi!

> Move do_suspend_lowlevel to correct segment. If it is in the same hugepage
> with ro data, mark_rodata_ro will make it unexecutable.

I guess I do not know enough about segments... Original code puts
saved_magic into .data (and probably puts save_registers there by
mistake, too -- so you are fixing things), but you put saved_magic
code into .data, too, so how does its read-only status change?

Does x86-64 need similar fix?
								Pavel


> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> ---
> 
>  linux-2.6.17-rc5-root/arch/i386/kernel/acpi/wakeup.S |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff -puN arch/i386/kernel/acpi/wakeup.S~wakeup arch/i386/kernel/acpi/wakeup.S
> --- linux-2.6.17-rc5/arch/i386/kernel/acpi/wakeup.S~wakeup	2006-06-14 09:21:26.000000000 +0800
> +++ linux-2.6.17-rc5-root/arch/i386/kernel/acpi/wakeup.S	2006-06-14 09:21:57.000000000 +0800
> @@ -265,11 +265,6 @@ ENTRY(acpi_copy_wakeup_routine)
>  	movl	$0x12345678, saved_magic
>  	ret
>  
> -.data
> -ALIGN
> -ENTRY(saved_magic)	.long	0
> -ENTRY(saved_eip)	.long	0
> -
>  save_registers:
>  	leal	4(%esp), %eax
>  	movl	%eax, saved_context_esp
> @@ -304,7 +299,11 @@ ret_point:
>  	call	restore_processor_state
>  	ret
>  
> +.data
>  ALIGN
> +ENTRY(saved_magic)	.long	0
> +ENTRY(saved_eip)	.long	0
> +
>  # saved registers
>  saved_gdt:	.long	0,0
>  saved_idt:	.long	0,0
> _

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH] move do_suspend_lowlevel to correct segment
  2006-06-15  9:19 ` Pavel Machek
@ 2006-06-16  0:52   ` Shaohua Li
  0 siblings, 0 replies; 3+ messages in thread
From: Shaohua Li @ 2006-06-16  0:52 UTC (permalink / raw)
  To: Pavel Machek; +Cc: lkml, Len Brown, Andrew Morton

Hi Pavel,
On Thu, 2006-06-15 at 11:19 +0200, Pavel Machek wrote:
> > Move do_suspend_lowlevel to correct segment. If it is in the same hugepage
> > with ro data, mark_rodata_ro will make it unexecutable.
> 
> I guess I do not know enough about segments... Original code puts
> saved_magic into .data (and probably puts save_registers there by
> mistake, too -- so you are fixing things), but you put saved_magic
> code into .data, too, so how does its read-only status change?
No, mark_rodata_ro will call change_page_attr, which will split huge
page into small pages, and changes the attr of the pages to PAGE_KERNEL.
mark_rodata_ro just changes rodata to read-only page attr.

> Does x86-64 need similar fix?
It appears not needed

Thanks,
Shaohua
> 
> 
> > Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> > ---
> > 
> >  linux-2.6.17-rc5-root/arch/i386/kernel/acpi/wakeup.S |    9 ++++-----
> >  1 files changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff -puN arch/i386/kernel/acpi/wakeup.S~wakeup arch/i386/kernel/acpi/wakeup.S
> > --- linux-2.6.17-rc5/arch/i386/kernel/acpi/wakeup.S~wakeup	2006-06-14 09:21:26.000000000 +0800
> > +++ linux-2.6.17-rc5-root/arch/i386/kernel/acpi/wakeup.S	2006-06-14 09:21:57.000000000 +0800
> > @@ -265,11 +265,6 @@ ENTRY(acpi_copy_wakeup_routine)
> >  	movl	$0x12345678, saved_magic
> >  	ret
> >  
> > -.data
> > -ALIGN
> > -ENTRY(saved_magic)	.long	0
> > -ENTRY(saved_eip)	.long	0
> > -
> >  save_registers:
> >  	leal	4(%esp), %eax
> >  	movl	%eax, saved_context_esp
> > @@ -304,7 +299,11 @@ ret_point:
> >  	call	restore_processor_state
> >  	ret
> >  
> > +.data
> >  ALIGN
> > +ENTRY(saved_magic)	.long	0
> > +ENTRY(saved_eip)	.long	0
> > +
> >  # saved registers
> >  saved_gdt:	.long	0,0
> >  saved_idt:	.long	0,0
> > _
> 
-- 
Shaohua Li <shaohua.li@intel.com>

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

end of thread, other threads:[~2006-06-16  0:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-15  3:39 [PATCH] move do_suspend_lowlevel to correct segment Shaohua Li
2006-06-15  9:19 ` Pavel Machek
2006-06-16  0:52   ` Shaohua Li

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

all inboxes | Powered by JetHome®