mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: "David S. Miller" <davem@redhat.com>
Cc: linux-kernel@vger.kernel.org, anton@samba.org
Subject: Re: [PATCH] bring sparc{64} into the generic siginfo fold
Date: Thu, 10 Oct 2002 16:07:32 +1000	[thread overview]
Message-ID: <20021010160732.0ac3c50f.sfr@canb.auug.org.au> (raw)
In-Reply-To: <20021009.224232.11156565.davem@redhat.com>

Hi Dave,

On Wed, 09 Oct 2002 22:42:32 -0700 (PDT) "David S. Miller" <davem@redhat.com> wrote:
>
>    From: Stephen Rothwell <sfr@canb.auug.org.au>
>    Date: Thu, 10 Oct 2002 15:43:32 +1000
> 
>    This patch (uncompiled, untested) enables sparc and sparc64 to use
>    the gerneic siginfo structure.  Hope you like it :-)
>    
> Thanks I'll have a look :)

This one is on top of the previous one and removes the arch specific
version of copy_siginfo_to_user from sparc and sparc64.

difstat:
 arch/sparc/kernel/signal.c    |   32 --------------------------------
 arch/sparc64/kernel/signal.c  |   32 --------------------------------
 include/asm-sparc/siginfo.h   |    1 -
 include/asm-sparc64/siginfo.h |    1 -
 kernel/signal.c               |    3 +++
 5 files changed, 3 insertions(+), 66 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.41-1.747-si.1/arch/sparc/kernel/signal.c 2.5.41-1.747-si.2/arch/sparc/kernel/signal.c
--- 2.5.41-1.747-si.1/arch/sparc/kernel/signal.c	2002-10-08 12:02:40.000000000 +1000
+++ 2.5.41-1.747-si.2/arch/sparc/kernel/signal.c	2002-10-10 16:00:14.000000000 +1000
@@ -90,38 +90,6 @@
 	__siginfo_fpu_t		fpu_state;
 };
 
-int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)
-{
-	if (!access_ok(VERIFY_WRITE, to, sizeof(siginfo_t)))
-		return -EFAULT;
-	if (from->si_code < 0)
-		return __copy_to_user(to, from, sizeof(siginfo_t));
-	else {
-		int err;
-
-		/* If you change siginfo_t structure, please be sure
-		   this code is fixed accordingly.
-		   It should never copy any pad contained in the structure
-		   to avoid security leaks, but must copy the generic
-		   3 ints plus the relevant union member.  */
-		err = __put_user(from->si_signo, &to->si_signo);
-		err |= __put_user(from->si_errno, &to->si_errno);
-		err |= __put_user((short)from->si_code, &to->si_code);
-		switch (from->si_code >> 16) {
-		case __SI_CHLD >> 16:
-			err |= __put_user(from->si_utime, &to->si_utime);
-			err |= __put_user(from->si_stime, &to->si_stime);
-		/* case __SI_RT: This is not generated by the kernel as of now.  */
-			err |= __put_user(from->si_status, &to->si_status);
-		default:
-			err |= __put_user(from->si_uid, &to->si_uid);
-			err |= __put_user(from->si_pid, &to->si_pid);
-			break;
-		}
-		return err;
-	}
-}
-
 /* Align macros */
 #define SF_ALIGNEDSZ  (((sizeof(struct signal_sframe) + 7) & (~7)))
 #define NF_ALIGNEDSZ  (((sizeof(struct new_signal_frame) + 7) & (~7)))
diff -ruN 2.5.41-1.747-si.1/arch/sparc64/kernel/signal.c 2.5.41-1.747-si.2/arch/sparc64/kernel/signal.c
--- 2.5.41-1.747-si.1/arch/sparc64/kernel/signal.c	2002-10-08 12:02:40.000000000 +1000
+++ 2.5.41-1.747-si.2/arch/sparc64/kernel/signal.c	2002-10-10 16:03:42.000000000 +1000
@@ -36,38 +36,6 @@
 static int do_signal(sigset_t *oldset, struct pt_regs * regs,
 		     unsigned long orig_o0, int ret_from_syscall);
 
-int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)
-{
-	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
-		return -EFAULT;
-	if (from->si_code < 0)
-		return __copy_to_user(to, from, sizeof(siginfo_t));
-	else {
-		int err;
-
-		/* If you change siginfo_t structure, please be sure
-		   this code is fixed accordingly.
-		   It should never copy any pad contained in the structure
-		   to avoid security leaks, but must copy the generic
-		   3 ints plus the relevant union member.  */
-		err = __put_user(*(long *)&from->si_signo, (long *)&to->si_signo);
-		err |= __put_user((short)from->si_code, &to->si_code);
-		switch (from->si_code >> 16) {
-		case __SI_CHLD >> 16:
-			err |= __put_user(from->si_utime, &to->si_utime);
-			err |= __put_user(from->si_stime, &to->si_stime);
-		case __SI_FAULT >> 16:
-		case __SI_POLL >> 16:
-			err |= __put_user(from->si_trapno, &to->si_trapno);
-		default:
-			err |= __put_user(from->si_addr, &to->si_addr);
-			break;
-		/* case __SI_RT: This is not generated by the kernel as of now.  */
-		}
-		return err;
-	}
-}
-
 /* {set, get}context() needed for 64-bit SparcLinux userland. */
 asmlinkage void sparc64_set_context(struct pt_regs *regs)
 {
diff -ruN 2.5.41-1.747-si.1/include/asm-sparc/siginfo.h 2.5.41-1.747-si.2/include/asm-sparc/siginfo.h
--- 2.5.41-1.747-si.1/include/asm-sparc/siginfo.h	2002-10-10 15:17:50.000000000 +1000
+++ 2.5.41-1.747-si.2/include/asm-sparc/siginfo.h	2002-10-10 16:01:26.000000000 +1000
@@ -7,7 +7,6 @@
 
 #define __ARCH_SI_UID_T		unsigned int
 #define __ARCH_SI_TRAPNO
-#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.41-1.747-si.1/include/asm-sparc64/siginfo.h 2.5.41-1.747-si.2/include/asm-sparc64/siginfo.h
--- 2.5.41-1.747-si.1/include/asm-sparc64/siginfo.h	2002-10-10 15:29:34.000000000 +1000
+++ 2.5.41-1.747-si.2/include/asm-sparc64/siginfo.h	2002-10-10 16:04:29.000000000 +1000
@@ -8,7 +8,6 @@
 
 #define __ARCH_SI_PREAMBLE_SIZE	(4 * sizeof(int))
 #define __ARCH_SI_TRAPNO
-#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.41-1.747-si.1/kernel/signal.c 2.5.41-1.747-si.2/kernel/signal.c
--- 2.5.41-1.747-si.1/kernel/signal.c	2002-10-08 12:03:00.000000000 +1000
+++ 2.5.41-1.747-si.2/kernel/signal.c	2002-10-10 16:01:38.000000000 +1000
@@ -1427,6 +1427,9 @@
 		break;
 	case __SI_FAULT:
 		err |= __put_user(from->si_addr, &to->si_addr);
+#ifdef __ARCH_SI_TRAPNO
+		err |= __put_user(from->si_trapno, &to->si_trapno);
+#endif
 		break;
 	case __SI_CHLD:
 		err |= __put_user(from->si_pid, &to->si_pid);

      reply	other threads:[~2002-10-10  6:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-10  5:43 Stephen Rothwell
2002-10-10  5:42 ` David S. Miller
2002-10-10  6:07   ` Stephen Rothwell [this message]

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=20021010160732.0ac3c50f.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=anton@samba.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®