Skip to contentSkip to conversation

um: userspace - be more verbose in ptrace set regs error

PATCH In review Thomas Meyer 3 participants 4 messages May 23, 2017 – Jul 5, 2017 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: userspace - be more verbose in ptrace set regs error

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

---
 arch/um/os-Linux/skas/process.c | 10 ++++++++--

 1 file changed, 8 insertions(+), 2 deletions(-)
arch/um/os-Linux/skas/process.c +0 -0
index 4530867..819d686 100644
@@ -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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw

Thomas,

Quoted 34 lines · Thomas Meyer

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

---
 arch/um/os-Linux/skas/process.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
arch/um/os-Linux/skas/process.c +8 -3
index 4530867..819d686 100644
@@ -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();
 
------------------------------------------------------------------------------
Quoted 6 lines

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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

This patch is also malformed. :-(

Signature · 10 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw

Am Mittwoch, den 05.07.2017, 23:34 +0200 schrieb Richard Weinberger:

Quoted 41 lines

Thomas,

Quoted 37 lines · Thomas Meyer

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

---
 arch/um/os-Linux/skas/process.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
arch/um/os- renamed from arch/um/os-Linux/skas/process.c +0 -0

Linux/skas/process.c
index 4530867..819d686 100644

arch/um/os-Linux/skas/process.c +2 -1
@@ -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 "

arch/um/os-Linux/skas/process.c +4 -1
+                              "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 "

arch/um/os-Linux/skas/process.c +2 -0
+                              "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();
Quoted 10 lines
Quoted 8 lines

-----------------------------------------------------------------
-------------
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 [email protected]
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

Quoted 1 line

------------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw

Thomas,

Am 06.07.2017 um 00:06 schrieb Thomas Meyer:

Quoted 5 lines
Quoted 1 line

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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel