linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error
@ 2017-05-23 22:45 Thomas Meyer
  2017-07-05 21:34 ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Meyer @ 2017-05-23 22:45 UTC (permalink / raw)
  To: user-mode-linux-devel

When ptrace fails to set GP/FP regs for the target process,
log the error before crashing the UML kernel.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 arch/um/os-Linux/skas/process.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 4530867..819d686 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -352,11 +352,17 @@ void userspace(struct uml_pt_regs *regs)
 		 * fail.  In this case, there is nothing to do but
 		 * just kill the process.
 		 */
-		if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
+		if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
+			printk(UM_KERN_ERR "userspace - ptrace set regs "
+			       "failed, errno = %d\n", errno);
 			fatal_sigsegv();
+		}
 
-		if (put_fp_registers(pid, regs->fp))
+		if (put_fp_registers(pid, regs->fp)) {
+			printk(UM_KERN_ERR "userspace - ptrace set fp regs "
+			       "failed, errno = %d\n", errno);
 			fatal_sigsegv();
+		}
 
 		/* Now we set local_using_sysemu to be used for one loop */
 		local_using_sysemu = get_using_sysemu();

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

* Re: [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error
  2017-05-23 22:45 [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error Thomas Meyer
@ 2017-07-05 21:34 ` Richard Weinberger
  2017-07-05 22:06   ` Thomas Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2017-07-05 21:34 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: user-mode-linux-devel

Thomas,

On Wed, May 24, 2017 at 12:45 AM, Thomas Meyer <thomas@m3y3r.de> wrote:
> When ptrace fails to set GP/FP regs for the target process,
> log the error before crashing the UML kernel.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>  arch/um/os-Linux/skas/process.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
> index 4530867..819d686 100644
> --- a/arch/um/os-Linux/skas/process.c
> +++ b/arch/um/os-Linux/skas/process.c
> @@ -352,11 +352,17 @@ void userspace(struct uml_pt_regs *regs)
>                  * fail.  In this case, there is nothing to do but
>                  * just kill the process.
>                  */
> -               if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
> +               if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
> +                       printk(UM_KERN_ERR "userspace - ptrace set regs "
> +                              "failed, errno = %d\n", errno);
>                         fatal_sigsegv();
> +               }
>
> -               if (put_fp_registers(pid, regs->fp))
> +               if (put_fp_registers(pid, regs->fp)) {
> +                       printk(UM_KERN_ERR "userspace - ptrace set fp regs "
> +                              "failed, errno = %d\n", errno);
>                         fatal_sigsegv();
> +               }
>
>                 /* Now we set local_using_sysemu to be used for one loop */
>                 local_using_sysemu = get_using_sysemu();
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> User-mode-linux-devel mailing list
> User-mode-linux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

This patch is also malformed. :-(

-- 
Thanks,
//richard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error
  2017-07-05 21:34 ` Richard Weinberger
@ 2017-07-05 22:06   ` Thomas Meyer
  2017-07-05 22:09     ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Meyer @ 2017-07-05 22:06 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: user-mode-linux-devel

Am Mittwoch, den 05.07.2017, 23:34 +0200 schrieb Richard Weinberger:
> Thomas,
> 
> On Wed, May 24, 2017 at 12:45 AM, Thomas Meyer <thomas@m3y3r.de>
> wrote:
> > When ptrace fails to set GP/FP regs for the target process,
> > log the error before crashing the UML kernel.
> > 
> > Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> > ---
> >  arch/um/os-Linux/skas/process.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-
> > Linux/skas/process.c
> > index 4530867..819d686 100644
> > --- a/arch/um/os-Linux/skas/process.c
> > +++ b/arch/um/os-Linux/skas/process.c
> > @@ -352,11 +352,17 @@ void userspace(struct uml_pt_regs *regs)
> >                  * fail.  In this case, there is nothing to do but
> >                  * just kill the process.
> >                  */
> > -               if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
> > +               if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
> > +                       printk(UM_KERN_ERR "userspace - ptrace set
> > regs "
> > +                              "failed, errno = %d\n", errno);
> >                         fatal_sigsegv();
> > +               }
> > 
> > -               if (put_fp_registers(pid, regs->fp))
> > +               if (put_fp_registers(pid, regs->fp)) {
> > +                       printk(UM_KERN_ERR "userspace - ptrace set
> > fp regs "
> > +                              "failed, errno = %d\n", errno);
> >                         fatal_sigsegv();
> > +               }
> > 
> >                 /* Now we set local_using_sysemu to be used for one
> > loop */
> >                 local_using_sysemu = get_using_sysemu();
> > 
> > -----------------------------------------------------------------
> > -------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > User-mode-linux-devel mailing list
> > User-mode-linux-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
> 
> This patch is also malformed. :-(

I wonder why evolution is messing up my emails...

will check and resend...

sorry and kind regards
thomas

> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error
  2017-07-05 22:06   ` Thomas Meyer
@ 2017-07-05 22:09     ` Richard Weinberger
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Weinberger @ 2017-07-05 22:09 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: user-mode-linux-devel

Thomas,

Am 06.07.2017 um 00:06 schrieb Thomas Meyer:
>> This patch is also malformed. :-(
> 
> I wonder why evolution is messing up my emails...
> 
> will check and resend...

Just use git send-email :)

Thanks,
//richard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error
@ 2017-07-05 22:31 Thomas Meyer
  2017-07-07  9:06 ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Meyer @ 2017-07-05 22:31 UTC (permalink / raw)
  To: user-mode-linux-devel

When ptrace fails to set GP/FP regs for the target process,
log the error before crashing the UML kernel.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 arch/um/os-Linux/skas/process.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 4530867..819d686 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -352,11 +352,17 @@ void userspace(struct uml_pt_regs *regs)
 		 * fail.  In this case, there is nothing to do but
 		 * just kill the process.
 		 */
-		if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
+		if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) {
+			printk(UM_KERN_ERR "userspace - ptrace set regs "
+			       "failed, errno = %d\n", errno);
 			fatal_sigsegv();
+		}
 
-		if (put_fp_registers(pid, regs->fp))
+		if (put_fp_registers(pid, regs->fp)) {
+			printk(UM_KERN_ERR "userspace - ptrace set fp regs "
+			       "failed, errno = %d\n", errno);
 			fatal_sigsegv();
+		}
 
 		/* Now we set local_using_sysemu to be used for one loop */
 		local_using_sysemu = get_using_sysemu();
-- 
2.9.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error
  2017-07-05 22:31 Thomas Meyer
@ 2017-07-07  9:06 ` Richard Weinberger
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Weinberger @ 2017-07-07  9:06 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: user-mode-linux-devel@lists.sourceforge.net

On Thu, Jul 6, 2017 at 12:31 AM, Thomas Meyer <thomas@m3y3r.de> wrote:
> When ptrace fails to set GP/FP regs for the target process,
> log the error before crashing the UML kernel.
>
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
>  arch/um/os-Linux/skas/process.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Applied.

-- 
Thanks,
//richard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

end of thread, other threads:[~2017-07-07  9:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-23 22:45 [uml-devel] [PATCH] um: userspace - be more verbose in ptrace set regs error Thomas Meyer
2017-07-05 21:34 ` Richard Weinberger
2017-07-05 22:06   ` Thomas Meyer
2017-07-05 22:09     ` Richard Weinberger
  -- strict thread matches above, loose matches on Subject: below --
2017-07-05 22:31 Thomas Meyer
2017-07-07  9:06 ` Richard Weinberger

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