Skip to contentSkip to conversation

sigset_t32 broken?

DISCUSSION Andrew Clausen 5 participants 6 messages Jan 23, 2003 – Jan 27, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

Hi all,

Cut&paste from linux/asm/mips64/signal.h:

#define _NSIG           128
#define _NSIG_BPW       64
#define _NSIG_WORDS     (_NSIG / _NSIG_BPW)
typedef struct {
        long sig[_NSIG_WORDS];
} sigset_t;
#define _NSIG32         128
#define _NSIG_BPW32     32
#define _NSIG_WORDS32   (_NSIG32 / _NSIG_BPW32)
typedef struct {
        long sig[_NSIG_WORDS32];
} sigset_t32;

Shouldn't those two long's be replaced with u64 and u32 respectively? Is the second struct really meant to be twice the size the first?

Cheers,
Andrew

#1 lore raw
Quoted 3 lines · Andrew Clausen

Shouldn't those two long's be replaced with u64 and u32 respectively? Is the second struct really meant to be twice the size the first?

They should be the same size, otherwise sys32_rt_sigsuspend and sys32_rt_sigaction will return EINVAL. As the comment says:
/* XXX: Don't preclude handling different sized sigset_t's. */

I've posted a patch to fix that earlier this month (Monday 13 Jan 2003 "[2.5 PATCH] signal handling").

BTW, anyone working on mips64 2.5 kernel should have a look at my patch set (http://www.linux-mips.org/~glaurung/O2/linux-2.5.47/patches-2.5.47.tar.gz)
for patches named "linux-mips-*.diff" as they might be relevant for other machines than just the O2, and the more they are tested the better. A README is provided to explain briefly what they (try to) fix.

regards,
Vivien.

#2 lore raw
Quoted 10 lines · Vivien Chappelier
Quoted 3 lines

Shouldn't those two long's be replaced with u64 and u32 respectively? Is the second struct really meant to be twice the size the first?

They should be the same size, otherwise sys32_rt_sigsuspend and sys32_rt_sigaction will return EINVAL. As the comment says:
/* XXX: Don't preclude handling different sized sigset_t's. */

I've posted a patch to fix that earlier this month (Monday 13 Jan 2003 "[2.5 PATCH] signal handling").

Most of what your patch does is undoing an accidental commit of a signal rework that wasn't yet supposed to go out.

Ralf

#3 lore raw
Quoted 2 lines · Ralf Baechle

Most of what your patch does is undoing an accidental commit of a signal rework that wasn't yet supposed to go out.

Maybe.. but current version is still wrong :) The type of the sig array in the 32-bit compatibility struct sigset_t32 must be 32bit long, i.e. unsigned int not unsigned long.
And I think unsigned describes the data better than signed, but that's a matter of taste :) (coherent with the choice in asm-mips/signal.h).

Vivien.

asm-mips64/signal.h +2 -2
@@ -16,7 +16,7 @@
 #define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
 
 typedef struct {
-	long sig[_NSIG_WORDS];
+	unsigned long sig[_NSIG_WORDS];
 } sigset_t;
 
 #define _NSIG32		128
@@ -24,7 +24,7 @@
 #define _NSIG_WORDS32	(_NSIG32 / _NSIG_BPW32)
 
 typedef struct {
-	long sig[_NSIG_WORDS32];
+	unsigned int sig[_NSIG_WORDS32];
 } sigset_t32;
 
 typedef unsigned long old_sigset_t;		/* at least 32 bits */
#4 lore raw
Quoted 9 lines · Vivien Chappelier
Quoted 2 lines · Ralf Baechle

Most of what your patch does is undoing an accidental commit of a signal rework that wasn't yet supposed to go out.

Maybe.. but current version is still wrong :) The type of the sig array in the 32-bit compatibility struct sigset_t32 must be 32bit long, i.e. unsigned int not unsigned long.
And I think unsigned describes the data better than signed, but that's a matter of taste :) (coherent with the choice in asm-mips/signal.h).

Why not make it u32?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#5 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"geert" == Geert Uytterhoeven <[email protected]> writes:

Quoted 9 lines · Vivien Chappelier
Quoted 9 lines · Ralf Baechle
Quoted 2 lines

Most of what your patch does is undoing an accidental commit of a signal rework that wasn't yet supposed to go out.

Maybe.. but current version is still wrong :) The type of the sig array in the 32-bit compatibility struct sigset_t32 must be 32bit long, i.e. unsigned int not unsigned long.
And I think unsigned describes the data better than signed, but that's a matter of taste :) (coherent with the choice in asm-mips/signal.h).

geert> Why not make it u32?

Nahh, that will make it clear indeed to stupid's like me :p

Later ,Juan.

Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy