public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/1] uml: fix handling of no fpx_regs [critical, for 2.6.12]
@ 2005-04-25 19:12 blaisorblade
  2005-04-25 19:57 ` Alexander Nyberg
  0 siblings, 1 reply; 3+ messages in thread
From: blaisorblade @ 2005-04-25 19:12 UTC (permalink / raw)
  To: akpm
  Cc: jdike, bstroesser, linux-kernel, user-mode-linux-devel,
	blaisorblade, aleidenf


From: Andree Leidenfrost <aleidenf@bigpond.net.au>, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Fix the error path, which is triggered when the processor misses the fpx regs
(i.e. the "fxsr" cpuinfo feature). For instance by VIA C3 Samuel2. Tested and
obvious, please merge ASAP.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff -puN arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling arch/um/os-Linux/sys-i386/registers.c
--- linux-2.6.12/arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling	2005-04-25 21:03:11.000000000 +0200
+++ linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c	2005-04-25 21:08:07.000000000 +0200
@@ -105,14 +105,15 @@ void init_registers(int pid)
 		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
 		      err);
 
+	errno = 0;
 	err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
 	if(!err)
 		return;
+	if(errno != EIO)
+		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
+		      errno);
 
 	have_fpx_regs = 0;
-	if(err != EIO)
-		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
-		      err);
 
 	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
 	if(err)
_

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

* Re: [patch 1/1] uml: fix handling of no fpx_regs [critical, for 2.6.12]
  2005-04-25 19:12 [patch 1/1] uml: fix handling of no fpx_regs [critical, for 2.6.12] blaisorblade
@ 2005-04-25 19:57 ` Alexander Nyberg
  2005-04-26  9:44   ` Andree Leidenfrost
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Nyberg @ 2005-04-25 19:57 UTC (permalink / raw)
  To: blaisorblade
  Cc: akpm, jdike, bstroesser, linux-kernel, user-mode-linux-devel,
	aleidenf

mån 2005-04-25 klockan 21:12 +0200 skrev blaisorblade@yahoo.it:
> From: Andree Leidenfrost <aleidenf@bigpond.net.au>, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> 
> Fix the error path, which is triggered when the processor misses the fpx regs
> (i.e. the "fxsr" cpuinfo feature). For instance by VIA C3 Samuel2. Tested and
> obvious, please merge ASAP.
> 
> Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> ---
> 
>  linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff -puN arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling arch/um/os-Linux/sys-i386/registers.c
> --- linux-2.6.12/arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling	2005-04-25 21:03:11.000000000 +0200
> +++ linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c	2005-04-25 21:08:07.000000000 +0200
> @@ -105,14 +105,15 @@ void init_registers(int pid)
>  		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
>  		      err);
>  
> +	errno = 0;
>  	err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
>  	if(!err)
>  		return;
> +	if(errno != EIO)
> +		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
> +		      errno);

Looks like you mean "if (err != EIO)" here


>  	have_fpx_regs = 0;
> -	if(err != EIO)
> -		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
> -		      err);
>  
>  	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
>  	if(err)




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

* Re: [patch 1/1] uml: fix handling of no fpx_regs [critical, for 2.6.12]
  2005-04-25 19:57 ` Alexander Nyberg
@ 2005-04-26  9:44   ` Andree Leidenfrost
  0 siblings, 0 replies; 3+ messages in thread
From: Andree Leidenfrost @ 2005-04-26  9:44 UTC (permalink / raw)
  To: Alexander Nyberg
  Cc: blaisorblade, akpm, jdike, bstroesser, linux-kernel,
	user-mode-linux-devel

[-- Attachment #1: Type: text/plain, Size: 1965 bytes --]

Hi Alexander

On Mon, 2005-04-25 at 21:57 +0200, Alexander Nyberg wrote:
> mån 2005-04-25 klockan 21:12 +0200 skrev blaisorblade@yahoo.it:
> > From: Andree Leidenfrost <aleidenf@bigpond.net.au>, Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> > 
> > Fix the error path, which is triggered when the processor misses the fpx regs
> > (i.e. the "fxsr" cpuinfo feature). For instance by VIA C3 Samuel2. Tested and
> > obvious, please merge ASAP.
> > 
> > Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> > ---
> > 
> >  linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c |    7 ++++---
> >  1 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff -puN arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling arch/um/os-Linux/sys-i386/registers.c
> > --- linux-2.6.12/arch/um/os-Linux/sys-i386/registers.c~uml-fix-no_fpx_regs_handling	2005-04-25 21:03:11.000000000 +0200
> > +++ linux-2.6.12-paolo/arch/um/os-Linux/sys-i386/registers.c	2005-04-25 21:08:07.000000000 +0200
> > @@ -105,14 +105,15 @@ void init_registers(int pid)
> >  		panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
> >  		      err);
> >  
> > +	errno = 0;
> >  	err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
> >  	if(!err)
> >  		return;
> > +	if(errno != EIO)
> > +		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
> > +		      errno);
> 
> Looks like you mean "if (err != EIO)" here

No. The patch is correct.

ptrace will always return -1 in case of an error. The actual error code
is in errno, hence this is what needs to be compared to EIO. Please also
see the ptrace manpage.

> >  	have_fpx_regs = 0;
> > -	if(err != EIO)
> > -		panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",
> > -		      err);
> >  
> >  	err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
> >  	if(err)

Best regards
Andree
-- 
Andree Leidenfrost
Sydney - Australia


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2005-04-26  9:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-25 19:12 [patch 1/1] uml: fix handling of no fpx_regs [critical, for 2.6.12] blaisorblade
2005-04-25 19:57 ` Alexander Nyberg
2005-04-26  9:44   ` Andree Leidenfrost

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