Skip to contentSkip to conversation

siginfo pad problem.

DISCUSSION Kurt Roeckx 4 participants 7 messages Jul 21, 2003 – Jul 22, 2003

lore
Share & tools
lore
#0 lore raw

It seems the _timer part of siginfo is a little bit broken.

It has:

                        char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];

Where __ARCH_SI_UID_T can be a short.

I have no idea if on any arch it can be bigger than an int.

Kurt

#1 lore raw
Quoted 7 lines · On Mon, 21 Jul 2003 16:23:00 +0200 Kurt Roeckx <[email protected]> wrote:

It seems the _timer part of siginfo is a little bit broken.

It has:

                        char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];

Where __ARCH_SI_UID_T can be a short.

Except __ARCH_SI_UID_T is defined to be uid_t everywhere except sparc where it is "unsigned int". In include/linux/types.h, uid_t is typdef'ed to be __kernel_uid32_t (in the kernel), so __ARCH_SI_UID_T is always (at least) 32 bits.

I was worried about that the first time I saw it as well.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#2 lore raw
Quoted 7 lines · Stephen Rothwell
Quoted 6 lines · On Mon, 21 Jul 2003 16:23:00 +0200 Kurt Roeckx <[email protected]> wrote:

It seems the _timer part of siginfo is a little bit broken.

It has:

                        char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
Quoted 6 lines
Quoted 1 line

Where __ARCH_SI_UID_T can be a short.

Except __ARCH_SI_UID_T is defined to be uid_t everywhere except sparc where it is "unsigned int". In include/linux/types.h, uid_t is typdef'ed to be __kernel_uid32_t (in the kernel), so __ARCH_SI_UID_T is always (at least) 32 bits.

linux/types.h has:
#ifdef __KERNEL__
typedef __kernel_uid32_t uid_t;
#else
typedef __kernel_uid_t uid_t;
#endif /* __KERNEL__ */

And __kernel_uid_t is an "unsigned short"

Kurt

#3 lore raw

Hi Kurt,

Quoted 9 lines · On Mon, 21 Jul 2003 20:00:32 +0200 Kurt Roeckx <[email protected]> wrote:

linux/types.h has:
#ifdef __KERNEL__
typedef __kernel_uid32_t uid_t;
#else
typedef __kernel_uid_t uid_t;
#endif /* __KERNEL__ */

And __kernel_uid_t is an "unsigned short"

Anywhere this should be used (i.e. only in the kernel), uid_t will be __kernel_uid32_t. The change to this part of the siginfo_t structure has not yet propogated to the glibc headers and when it does, it is up to the glibc maintainers to make sure it matches what is used inside the kernel.

My extrapolation of your point leads me to ask why we even bother with __KERNEL__ in the kernel's header files anymore since we keep telling people that user mode programs should not use the kernel's header files.

You are right that if a user mode program include the kernel's siginfo.h (without defining __KERNEL__) it will not compile (on those architectures where __kernel_uid_t is "unsigned short") but the answer I keep seeing from this list is "Don't do that".

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#4 lore raw
Quoted 11 lines · Stephen Rothwell

Hi Kurt,

Quoted 8 lines · On Mon, 21 Jul 2003 20:00:32 +0200 Kurt Roeckx <[email protected]> wrote:

linux/types.h has:
#ifdef __KERNEL__
typedef __kernel_uid32_t uid_t;
#else
typedef __kernel_uid_t uid_t;
#endif /* __KERNEL__ */

Quoted 6 lines
Quoted 1 line

And __kernel_uid_t is an "unsigned short"

Anywhere this should be used (i.e. only in the kernel), uid_t will be __kernel_uid32_t. The change to this part of the siginfo_t structure has not yet propogated to the glibc headers and when it does, it is up to the glibc maintainers to make sure it matches what is used inside the kernel.

I'm still using libc5, and plan to do so for as long as I can.

Kurt

#5 lore raw
Quoted 1 line · Kurt Roeckx

I'm still using libc5, and plan to do so for as long as I can.

That's fine. Just install 2.4 kernel headers in /usr/include/linux and /usr/include/asm.

-- Jamie

#6 lore raw
In reply to Stephen Rothwell
Quoted 4 lines · Stephen Rothwell

Anywhere this should be used (i.e. only in the kernel), uid_t will be __kernel_uid32_t. The change to this part of the siginfo_t structure has not yet propogated to the glibc headers and when it does, it is up to the glibc maintainers to make sure it matches what is used inside the kernel.

??
glibc uses <bits/siginfo.h>, in which it uses __uid_t for si_uid fields. __uid_t is uint32_t on all arches.

Jakub