public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] missing bit from signal patches
@ 2002-05-30  0:18 Stephen Rothwell
  2002-05-30  8:04 ` Roman Zippel
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Rothwell @ 2002-05-30  0:18 UTC (permalink / raw)
  To: Linus; +Cc: Trivial Kernel Patches, LKML

Hi Linus,

The following should allow the affected architectures to build in
2.5.19 as currently there will be two definitions of
copy_siginfo_to_user.

Please apply.

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

diff -ruN 2.5.19/include/asm-alpha/siginfo.h 2.5.19-si.1/include/asm-alpha/siginfo.h
--- 2.5.19/include/asm-alpha/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.1/include/asm-alpha/siginfo.h	Mon May 27 00:55:05 2002
@@ -6,6 +6,7 @@
 #define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE/sizeof(int)) - 4)
 
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.19/include/asm-cris/siginfo.h 2.5.19-si.1/include/asm-cris/siginfo.h
--- 2.5.19/include/asm-cris/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.1/include/asm-cris/siginfo.h	Mon May 27 00:55:05 2002
@@ -1,6 +1,8 @@
 #ifndef _CRIS_SIGINFO_H
 #define _CRIS_SIGINFO_H
 
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
+
 #include <asm-generic/siginfo.h>
 
 #endif
diff -ruN 2.5.19/include/asm-ia64/siginfo.h 2.5.19-si.1/include/asm-ia64/siginfo.h
--- 2.5.19/include/asm-ia64/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.1/include/asm-ia64/siginfo.h	Mon May 27 00:55:05 2002
@@ -13,6 +13,7 @@
 #define HAVE_ARCH_SIGINFO_T
 
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.19/include/asm-mips64/siginfo.h 2.5.19-si.1/include/asm-mips64/siginfo.h
--- 2.5.19/include/asm-mips64/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.1/include/asm-mips64/siginfo.h	Mon May 27 00:55:05 2002
@@ -13,6 +13,7 @@
 
 #define HAVE_ARCH_SIGINFO_T
 #define HAVE_ARCH_SIGEVENT_T
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.19/include/asm-parisc/siginfo.h 2.5.19-si.1/include/asm-parisc/siginfo.h
--- 2.5.19/include/asm-parisc/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.1/include/asm-parisc/siginfo.h	Mon May 27 00:55:05 2002
@@ -1,6 +1,8 @@
 #ifndef _PARISC_SIGINFO_H
 #define _PARISC_SIGINFO_H
 
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
+
 #include <asm-generic/siginfo.h>
 
 /*
diff -ruN 2.5.19/include/asm-sparc/siginfo.h 2.5.19-si.1/include/asm-sparc/siginfo.h
--- 2.5.19/include/asm-sparc/siginfo.h	Thu May 30 09:44:39 2002
+++ 2.5.19-si.1/include/asm-sparc/siginfo.h	Mon May 27 00:55:05 2002
@@ -7,6 +7,7 @@
 
 #define HAVE_ARCH_SIGINFO_T
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.19/include/asm-sparc64/siginfo.h 2.5.19-si.1/include/asm-sparc64/siginfo.h
--- 2.5.19/include/asm-sparc64/siginfo.h	Thu May 30 09:44:39 2002
+++ 2.5.19-si.1/include/asm-sparc64/siginfo.h	Mon May 27 00:55:05 2002
@@ -10,6 +10,7 @@
 #define HAVE_ARCH_SIGINFO_T
 
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 

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

* Re: missing bit from signal patches
  2002-05-30  0:18 [PATCH] missing bit from signal patches Stephen Rothwell
@ 2002-05-30  8:04 ` Roman Zippel
  2002-05-30 12:08   ` Stephen Rothwell
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2002-05-30  8:04 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: LKML

Hi,

On Thu, 30 May 2002, Stephen Rothwell wrote:

> The following should allow the affected architectures to build in
> 2.5.19 as currently there will be two definitions of
> copy_siginfo_to_user.

There are other build problems. m68k doesn't compile, because siginfo_t is
defined after the generic include and the inline functions in there access
that structure. On the other hand I can't put the include after the
definition, as it depends on other defines in the include.
I worked around it with some ugly hacks, but a proper fix would be very
welcome.

bye, Roman


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

* Re: missing bit from signal patches
  2002-05-30  8:04 ` Roman Zippel
@ 2002-05-30 12:08   ` Stephen Rothwell
  2002-05-30 12:46     ` Roman Zippel
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Rothwell @ 2002-05-30 12:08 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel, Linus, Trivial Kernel Patches

Hi Roman,

On Thu, 30 May 2002 10:04:03 +0200 (CEST) Roman Zippel <zippel@linux-m68k.org> wrote:
>
> On Thu, 30 May 2002, Stephen Rothwell wrote:
> 
> > The following should allow the affected architectures to build in
> > 2.5.19 as currently there will be two definitions of
> > copy_siginfo_to_user.
> 
> There are other build problems. m68k doesn't compile, because siginfo_t is
> defined after the generic include and the inline functions in there access
> that structure. On the other hand I can't put the include after the
> definition, as it depends on other defines in the include.
> I worked around it with some ugly hacks, but a proper fix would be very
> welcome.

Is the following a more ugly hack than yours?

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

diff -ruN 2.5.19-si/include/asm-generic/siginfo.h 2.5.19-si.3/include/asm-generic/siginfo.h
--- 2.5.19-si/include/asm-generic/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.3/include/asm-generic/siginfo.h	Thu May 30 22:04:54 2002
@@ -64,7 +64,11 @@
 	} _sifields;
 } siginfo_t;
 
-#endif
+#else /* HAVE_ARCH_SIGINFO_T */
+
+struct siginfo;
+
+#endif /* HAVE_ARCH_SIGINFO_T */
 
 /*
  * How these fields are to be accessed.

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

* Re: missing bit from signal patches
  2002-05-30 12:08   ` Stephen Rothwell
@ 2002-05-30 12:46     ` Roman Zippel
  2002-05-30 13:26       ` Stephen Rothwell
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2002-05-30 12:46 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-kernel

Hi,

On Thu, 30 May 2002, Stephen Rothwell wrote:

> Is the following a more ugly hack than yours?

Yes. :)
The problem is copy_siginfo(), which wants to access struct siginfo.
Copy the m68k version of siginfo.h and try to compile that.

bye, Roman


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

* Re: missing bit from signal patches
  2002-05-30 12:46     ` Roman Zippel
@ 2002-05-30 13:26       ` Stephen Rothwell
  2002-05-30 14:16         ` Peter Wächtler
  2002-05-30 19:57         ` Roman Zippel
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-05-30 13:26 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel

Hi Roman,

On Thu, 30 May 2002 14:46:20 +0200 (CEST) Roman Zippel <zippel@linux-m68k.org> wrote:
>
> On Thu, 30 May 2002, Stephen Rothwell wrote:
> 
> > Is the following a more ugly hack than yours?
> 
> Yes. :)
> The problem is copy_siginfo(), which wants to access struct siginfo.
> Copy the m68k version of siginfo.h and try to compile that.

OK, sorry, brain fart :-)

It seems that is an architecture defines its own siginfo_t then it must
also define its own copy_siginfo function (for now anyway).

Try this ...

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

diff -ruN 2.5.19/include/asm-alpha/siginfo.h 2.5.19-si.4/include/asm-alpha/siginfo.h
--- 2.5.19/include/asm-alpha/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.4/include/asm-alpha/siginfo.h	Thu May 30 23:11:50 2002
@@ -6,6 +6,7 @@
 #define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE/sizeof(int)) - 4)
 
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.19/include/asm-cris/siginfo.h 2.5.19-si.4/include/asm-cris/siginfo.h
--- 2.5.19/include/asm-cris/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.4/include/asm-cris/siginfo.h	Thu May 30 23:11:50 2002
@@ -1,6 +1,8 @@
 #ifndef _CRIS_SIGINFO_H
 #define _CRIS_SIGINFO_H
 
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
+
 #include <asm-generic/siginfo.h>
 
 #endif
diff -ruN 2.5.19/include/asm-ia64/siginfo.h 2.5.19-si.4/include/asm-ia64/siginfo.h
--- 2.5.19/include/asm-ia64/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.4/include/asm-ia64/siginfo.h	Thu May 30 23:11:50 2002
@@ -13,6 +13,7 @@
 #define HAVE_ARCH_SIGINFO_T
 
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.19/include/asm-m68k/siginfo.h 2.5.19-si.4/include/asm-m68k/siginfo.h
--- 2.5.19/include/asm-m68k/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.4/include/asm-m68k/siginfo.h	Thu May 30 23:17:10 2002
@@ -2,6 +2,7 @@
 #define _M68K_SIGINFO_H
 
 #define HAVE_ARCH_SIGINFO_T
+#define HAVE_ARCH_COPY_SIGINFO
 
 #include <asm-generic/siginfo.h>
 
@@ -68,6 +69,18 @@
 #define si_uid16	_sifields._kill._uid
 #else
 #define si_uid		_sifields._kill._uid
+
+#include <linux/string.h>
+
+static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
+{
+	if (from->si_code < 0)
+		memcpy(to, from, sizeof(*to));
+	else
+		/* _sigchld is currently the largest know union member */
+		memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
+}
+
 #endif /* __KERNEL__ */
 
 #endif
diff -ruN 2.5.19/include/asm-mips/siginfo.h 2.5.19-si.4/include/asm-mips/siginfo.h
--- 2.5.19/include/asm-mips/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.4/include/asm-mips/siginfo.h	Thu May 30 23:18:46 2002
@@ -12,8 +12,8 @@
 #define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE/sizeof(int)) - 4)
 
 #define HAVE_ARCH_SIGINFO_T
-
 #define HAVE_ARCH_SIGEVENT_T
+#define HAVE_ARCH_COPY_SIGINFO
 
 #include <asm-generic/siginfo.h>
 
@@ -121,5 +121,20 @@
 		} _sigev_thread;
 	} _sigev_un;
 } sigevent_t;
+
+#ifdef __KERNEL__
+
+#include <linux/string.h>
+
+static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
+{
+	if (from->si_code < 0)
+		memcpy(to, from, sizeof(*to));
+	else
+		/* _sigchld is currently the largest know union member */
+		memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
+}
+
+#endif
 
 #endif /* _ASM_SIGINFO_H */
diff -ruN 2.5.19/include/asm-mips64/siginfo.h 2.5.19-si.4/include/asm-mips64/siginfo.h
--- 2.5.19/include/asm-mips64/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.4/include/asm-mips64/siginfo.h	Thu May 30 23:19:33 2002
@@ -13,6 +13,8 @@
 
 #define HAVE_ARCH_SIGINFO_T
 #define HAVE_ARCH_SIGEVENT_T
+#define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
@@ -120,5 +122,20 @@
 		} _sigev_thread;
 	} _sigev_un;
 } sigevent_t;
+
+#ifdef __KERNEL__
+
+#include <linux/string.h>
+
+static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
+{
+	if (from->si_code < 0)
+		memcpy(to, from, sizeof(*to));
+	else
+		/* _sigchld is currently the largest know union member */
+		memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
+}
+
+#endif
 
 #endif /* _ASM_SIGINFO_H */
diff -ruN 2.5.19/include/asm-parisc/siginfo.h 2.5.19-si.4/include/asm-parisc/siginfo.h
--- 2.5.19/include/asm-parisc/siginfo.h	Thu May 30 09:44:38 2002
+++ 2.5.19-si.4/include/asm-parisc/siginfo.h	Thu May 30 23:11:50 2002
@@ -1,6 +1,8 @@
 #ifndef _PARISC_SIGINFO_H
 #define _PARISC_SIGINFO_H
 
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
+
 #include <asm-generic/siginfo.h>
 
 /*
diff -ruN 2.5.19/include/asm-sparc/siginfo.h 2.5.19-si.4/include/asm-sparc/siginfo.h
--- 2.5.19/include/asm-sparc/siginfo.h	Thu May 30 09:44:39 2002
+++ 2.5.19-si.4/include/asm-sparc/siginfo.h	Thu May 30 23:11:50 2002
@@ -7,6 +7,7 @@
 
 #define HAVE_ARCH_SIGINFO_T
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 
diff -ruN 2.5.19/include/asm-sparc64/siginfo.h 2.5.19-si.4/include/asm-sparc64/siginfo.h
--- 2.5.19/include/asm-sparc64/siginfo.h	Thu May 30 09:44:39 2002
+++ 2.5.19-si.4/include/asm-sparc64/siginfo.h	Thu May 30 23:11:50 2002
@@ -10,6 +10,7 @@
 #define HAVE_ARCH_SIGINFO_T
 
 #define HAVE_ARCH_COPY_SIGINFO
+#define HAVE_ARCH_COPY_SIGINFO_TO_USER
 
 #include <asm-generic/siginfo.h>
 

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

* Re: missing bit from signal patches
  2002-05-30 13:26       ` Stephen Rothwell
@ 2002-05-30 14:16         ` Peter Wächtler
  2002-05-30 19:57         ` Roman Zippel
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Wächtler @ 2002-05-30 14:16 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Roman Zippel, linux-kernel

Stephen Rothwell wrote:
> Hi Roman,
> 
> On Thu, 30 May 2002 14:46:20 +0200 (CEST) Roman Zippel <zippel@linux-m68k.org> wrote:
> 
>>On Thu, 30 May 2002, Stephen Rothwell wrote:
>>
>>
>>>Is the following a more ugly hack than yours?
>>>
>>Yes. :)
>>The problem is copy_siginfo(), which wants to access struct siginfo.
>>Copy the m68k version of siginfo.h and try to compile that.
>>
> 
> OK, sorry, brain fart :-)
> 
> It seems that is an architecture defines its own siginfo_t then it must
> also define its own copy_siginfo function (for now anyway).
> 
> Try this ...
> 

Why is that done so complicated?
Why not just copy the struct over?
When the kernel generates the signal, I hope the mem is zeroed
and we copy it to user. When a user sends a signal, you want to
prevent sending of arbitrary data? Why is that not done where
the permission check happens?

What do I miss?








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

* Re: missing bit from signal patches
  2002-05-30 13:26       ` Stephen Rothwell
  2002-05-30 14:16         ` Peter Wächtler
@ 2002-05-30 19:57         ` Roman Zippel
  2002-05-31  0:24           ` Stephen Rothwell
  1 sibling, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2002-05-30 19:57 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-kernel

Hi,

Stephen Rothwell wrote:

> Try this ...

This almost works. :)

> diff -ruN 2.5.19/include/asm-m68k/siginfo.h 2.5.19-si.4/include/asm-m68k/siginfo.h
> --- 2.5.19/include/asm-m68k/siginfo.h   Thu May 30 09:44:38 2002
> +++ 2.5.19-si.4/include/asm-m68k/siginfo.h      Thu May 30 23:17:10 2002
> @@ -2,6 +2,7 @@
>  #define _M68K_SIGINFO_H
> 
>  #define HAVE_ARCH_SIGINFO_T
> +#define HAVE_ARCH_COPY_SIGINFO
> 
>  #include <asm-generic/siginfo.h>
> 
> @@ -68,6 +69,18 @@
>  #define si_uid16       _sifields._kill._uid
>  #else
>  #define si_uid         _sifields._kill._uid
> +
> +#include <linux/string.h>
> +
> +static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
> +{
> +       if (from->si_code < 0)
> +               memcpy(to, from, sizeof(*to));
> +       else
> +               /* _sigchld is currently the largest know union member */
> +               memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
> +}
> +
>  #endif /* __KERNEL__ */
> 
>  #endif

The function is in the #else part of #ifdef __KERNEL__.

bye, Roman

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

* Re: missing bit from signal patches
  2002-05-30 19:57         ` Roman Zippel
@ 2002-05-31  0:24           ` Stephen Rothwell
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Rothwell @ 2002-05-31  0:24 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel

Hi Roman,

On Thu, 30 May 2002 21:57:58 +0200 Roman Zippel <zippel@linux-m68k.org> wrote:
>
> Hi,
> 
> Stephen Rothwell wrote:
> 
> > Try this ...
> 
> This almost works. :)

Just goes to show I should go to bed earlier :-)

I assume it works if you put the function definition in the right place?

I will redo the patch (looking harder this time now that I am awake)
and submit it to Linus.


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

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

end of thread, other threads:[~2002-05-31  0:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-30  0:18 [PATCH] missing bit from signal patches Stephen Rothwell
2002-05-30  8:04 ` Roman Zippel
2002-05-30 12:08   ` Stephen Rothwell
2002-05-30 12:46     ` Roman Zippel
2002-05-30 13:26       ` Stephen Rothwell
2002-05-30 14:16         ` Peter Wächtler
2002-05-30 19:57         ` Roman Zippel
2002-05-31  0:24           ` Stephen Rothwell

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