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 <tho...@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

Reply via email to