Skip to contentSkip to conversation

linux/compat.h includes asm/signal.h causing problems

DISCUSSION David Miller 4 participants 8 messages Oct 2, 2006 – Oct 3, 2006

lore
Share & tools
lore
#0 lore raw

On some platforms, including sparc64, asm/signal.h needs compat_sigset_t, but this is defined in linux/compat.h after asm/signal.h is included.

Andrew, aren't you doing sparc64 cross builds these days? :-)

This came from 3f2e05e90e0846c42626e3d272454f26be34a1bc

[PATCH] BLOCK: Revert patch to hack around undeclared sigset_t in linux/compat.h

Revert Andrew Morton's patch to temporarily hack around the lack of a declaration of sigset_t in linux/compat.h to make the block-disablement patches build on IA64. This got accidentally pushed to Linus and should be fixed in a different manner.

Also make linux/compat.h #include asm/signal.h to gain a definition of sigset_t so that it can externally declare sigset_from_compat().

This has been compile-tested for i386, x86_64, ia64, mips, mips64, frv, ppc and ppc64 and run-tested on frv.

It figures that one of the platforms it wasn't compile tested on is the one that breaks :-)

#1 lore raw
Quoted 19 lines · On Mon, 02 Oct 2006 13:14:14 -0700 (PDT) David Miller <[email protected]>…

On some platforms, including sparc64, asm/signal.h needs compat_sigset_t, but this is defined in linux/compat.h after asm/signal.h is included.

Andrew, aren't you doing sparc64 cross builds these days? :-)

This came from 3f2e05e90e0846c42626e3d272454f26be34a1bc

[PATCH] BLOCK: Revert patch to hack around undeclared sigset_t in linux/compat.h

Revert Andrew Morton's patch to temporarily hack around the lack of a declaration of sigset_t in linux/compat.h to make the block-disablement patches build on IA64. This got accidentally pushed to Linus and should be fixed in a different manner.

Also make linux/compat.h #include asm/signal.h to gain a definition of sigset_t so that it can externally declare sigset_from_compat().

Quoted 8 lines

This has been compile-tested for i386, x86_64, ia64, mips, mips64, frv, ppc and ppc64 and run-tested on frv.

It figures that one of the platforms it wasn't compile tested on is the one that breaks :-)

not me, boss - I told 'em that using sigset_t in compat.h was a minefield. sparc64 built OK with my hack-shouldnt-be-merged patch applied, which is how it was tested in -mm.

I don't know what a good fix is, really. I guess one could put the declaration of sigset_from_compat() into its own header file and include that header from the right places.

#2 lore raw

From: Andrew Morton <[email protected]>
Date: Mon, 2 Oct 2006 13:50:36 -0700

Quoted 3 lines

I don't know what a good fix is, really. I guess one could put the declaration of sigset_from_compat() into its own header file and include that header from the right places.

I'm working on a patch that puts the compat signal bits into include/asm-sparc64/compat_signal.h and adds the necessary includes to a few *.c files under arch/sparc64 when needed.

#3 lore raw

From: David Miller <[email protected]>
Date: Mon, 02 Oct 2006 14:04:37 -0700 (PDT)

Quoted 10 lines

From: Andrew Morton <[email protected]>
Date: Mon, 2 Oct 2006 13:50:36 -0700

Quoted 3 lines

I don't know what a good fix is, really. I guess one could put the declaration of sigset_from_compat() into its own header file and include that header from the right places.

I'm working on a patch that puts the compat signal bits into include/asm-sparc64/compat_signal.h and adds the necessary includes to a few *.c files under arch/sparc64 when needed.

Ok, this seems to work and is what I'll sent to Linus.

commit 0c2d4569948a93fac01a17e191ede4f754607a4a

Author: David S. Miller <[email protected]>
Date:   Mon Oct 2 14:17:57 2006 -0700

[SPARC64]: Move signal compat bits to new header file.

Create asm-sparc64/compat_signal.h and stuff things there.

This avoids the "linux/compat.h includes asm/signal.h but asm/signal.h needs compat_sigset_t which isn't defined yet" problems introduced recently.

arch/sparc64/kernel/signal32.c +1 -0
index 708ba9b..c45f21b 100644
@@ -29,6 +29,7 @@ #include <asm/pgtable.h>
 #include <asm/psrcompat.h>
 #include <asm/fpumacro.h>
 #include <asm/visasm.h>
+#include <asm/compat_signal.h>
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
arch/sparc64/kernel/sys_sparc32.c +1 -0
index 69444f2..7c6499c 100644
@@ -61,6 +61,7 @@ #include <asm/fpumacro.h>
 #include <asm/semaphore.h>
 #include <asm/mmu_context.h>
 #include <asm/a.out.h>
+#include <asm/compat_signal.h>
 
 asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
 {
arch/sparc64/kernel/sys_sunos32.c +1 -0
index 953296b..b21e8dd 100644
@@ -43,6 +43,7 @@ #include <asm/pconf.h>
 #include <asm/idprom.h> /* for gethostid() */
 #include <asm/unistd.h>
 #include <asm/system.h>
+#include <asm/compat_signal.h>
 
 /* For the nfs mount emulation */
 #include <linux/socket.h>
include/asm-sparc64/compat_signal.h new file +30 -0
new file mode 100644
index 0000000..7aefa30
@@ -0,0 +1,30 @@
+#ifndef _COMPAT_SIGNAL_H
+#define _COMPAT_SIGNAL_H
+
+#include <linux/config.h>
+#include <linux/compat.h>
+#include <asm/signal.h>
+
+#ifdef CONFIG_COMPAT
+struct __new_sigaction32 {
+	unsigned		sa_handler;
+	unsigned int    	sa_flags;
+	unsigned		sa_restorer;     /* not used by Linux/SPARC yet */
+	compat_sigset_t 	sa_mask;
+};
+
+struct __old_sigaction32 {
+	unsigned		sa_handler;
+	compat_old_sigset_t  	sa_mask;
+	unsigned int    	sa_flags;
+	unsigned		sa_restorer;     /* not used by Linux/SPARC yet */
+};
+
+typedef struct sigaltstack32 {
+	u32			ss_sp;
+	int			ss_flags;
+	compat_size_t		ss_size;
+} stack_t32;
+#endif
+
+#endif /* !(_COMPAT_SIGNAL_H) */
include/asm-sparc64/signal.h +4 -37

59 lines not on this page · raw message

#4 lore raw
Quoted 5 lines · David Miller
Quoted 3 lines

I'm working on a patch that puts the compat signal bits into include/asm-sparc64/compat_signal.h and adds the necessary includes to a few *.c files under arch/sparc64 when needed.

Ok, this seems to work and is what I'll sent to Linus.

Do you have an x86-hosted or an x86_64-hosted cross-compiler that targets sparc/sparc64?

David

#5 lore raw
Quoted 10 lines · David Howells
Quoted 5 lines · David Miller
Quoted 3 lines

I'm working on a patch that puts the compat signal bits into include/asm-sparc64/compat_signal.h and adds the necessary includes to a few *.c files under arch/sparc64 when needed.

Ok, this seems to work and is what I'll sent to Linus.

Do you have an x86-hosted or an x86_64-hosted cross-compiler that targets sparc/sparc64?

I do, it's not a problem...

#6 lore raw
Quoted 1 line · Al Viro

I do, it's not a problem...

Actually, I was asking for myself. Can I grab a copy?

David

#7 lore raw
Quoted 6 lines · On Tue, 03 Oct 2006 13:21:19 +0100 David Howells <[email protected]> wrote:
Quoted 1 line · Al Viro

I do, it's not a problem...

Actually, I was asking for myself. Can I grab a copy?

x86 binaries:

http://userweb.kernel.org/~akpm/sparc-cross.tar.bz2
http://userweb.kernel.org/~akpm/sparc64-cross.tar.bz2

script to run them:

#!/bin/sh

if [ x$ARCH == x ]
then
echo '$ARCH' unset
exit 1
fi

if [ x$J == x ]
then

	J=256

fi

if [ x"$DISTCC_HOSTS" != x ]
then
DISTCC="distcc"
fi

XARCH="$ARCH-unknown-linux-gnu"
I=vmlinux

[ $ARCH = alpha ] && CT=gcc-4.1.0-glibc-2.3.6
[ $ARCH = arm ] && CT=gcc-3.4.5-glibc-2.3.6
[ $ARCH = i386 ] && CT=gcc-4.1.0-glibc-2.3.6 && XARCH=i686-unknown-linux-gnu && I=bzImage
[ $ARCH = ia64 ] && CT=gcc-3.4.5-glibc-2.3.6
[ $ARCH = m68k ] && CT=gcc-4.1.0-glibc-2.3.6
[ $ARCH = mips ] && CT=gcc-3.4.5-glibc-2.3.6
[ $ARCH = powerpc ] && CT=gcc-4.1.0-glibc-2.3.6 && XARCH=powerpc-405-linux-gnu
[ $ARCH = s390 ] && CT=gcc-4.1.0-glibc-2.3.6
[ $ARCH = sh ] && CT=gcc-3.4.5-glibc-2.3.6 && XARCH=sh4-unknown-linux-gnu
[ $ARCH = sparc ] && CT=gcc-4.1.0-glibc-2.3.6
[ $ARCH = sparc64 ] && CT=gcc-3.4.5-glibc-2.3.6
[ $ARCH = x86_64 ] && CT=gcc-4.0.2-glibc-2.3.6 && I=bzImage
[ $ARCH = parisc ] && CT=gcc-4.0.2-glibc-2.3.6 && I=bzImage

if [ $# -eq 0 ]
then
WHAT="$I modules"
else

	WHAT="$*"

fi

PATH=$PATH:/opt/crosstool/$CT/$XARCH/bin export PATH

export CROSS_COMPILE=/opt/crosstool/$CT/$XARCH/bin/$XARCH-

export CC="$DISTCC /opt/crosstool/$CT/$XARCH/bin/$XARCH-gcc"

if [ "$ECHO" != "" ]
then

	echo CROSS_COMPILE=$CROSS_COMPILE CC=\"$CC\" make -j$J $* CC=\"$CC\" $WHAT
else
	nice -20 make -j$J $* CC="$CC" $WHAT 2>/tmp/log-$ARCH || FAILED=1

fi

cat /tmp/log-$ARCH
[ "$FAILED" != "" ] && echo "**FAILED**"