public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@davemloft.net>
To: linux-arch@vger.kernel.org
Subject: ptrace compat issue
Date: Tue, 04 Apr 2006 20:16:33 -0700 (PDT)	[thread overview]
Message-ID: <20060404.201633.80781445.davem@davemloft.net> (raw)


Others may run into this too, so I'm mentioning this.

PTRACE_GETEVENTMSG writes a long into the user address space, this has
to be made an int for compat tasks.  If you get this wrong a lot of
debugging things will break, as GDB currently makes extensive use of
this facility these days.

It might be nice to try and consolidate this into a single location,
but I frankly think that's overkill and doing it in the per-arch
ptrace() syscall handler is just the easiest thing to do right now.

diff-tree acdb28098a91c930909c257da1c0837b875a11fb (from c5959ae91b2e6e93000c58d428f91c5b5b46868d)
Author: David S. Miller <davem@sunset.davemloft.net>
Date:   Tue Apr 4 16:54:40 2006 -0700

    [SPARC64]: Translate PTRACE_GETEVENTMSG for 32-bit tasks.
    
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index c910af5..49e6ded 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -609,6 +609,22 @@ #endif
 
 	/* PTRACE_DUMPCORE unsupported... */
 
+	case PTRACE_GETEVENTMSG: {
+		int err;
+
+		if (test_thread_flag(TIF_32BIT))
+			err = put_user(child->ptrace_message,
+				       (unsigned int __user *) data);
+		else
+			err = put_user(child->ptrace_message,
+				       (unsigned long __user *) data);
+		if (err)
+			pt_error_return(regs, -err);
+		else
+			pt_succ_return(regs, 0);
+		break;
+	}
+
 	default: {
 		int err = ptrace_request(child, request, addr, data);
 		if (err)

                 reply	other threads:[~2006-04-05  3:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060404.201633.80781445.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox