diff mbox

[v05,60/72] arch/arm/include/uapi/asm/signal.h: use __kernel_size_t instead of size_t

Message ID 1471890809-4383-61-git-send-email-mikko.rapeli@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Mikko Rapeli Aug. 22, 2016, 6:33 p.m. UTC
Fixes uapi header compilation error from userspace on ARCH=arm:

asm/signal.h:112:2: error: unknown type name ‘size_t’
  size_t ss_size;

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 arch/arm/include/uapi/asm/signal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnd Bergmann Aug. 24, 2016, 3:02 p.m. UTC | #1
On Monday, August 22, 2016 8:33:17 PM CEST Mikko Rapeli wrote:
> diff --git a/arch/arm/include/uapi/asm/signal.h b/arch/arm/include/uapi/asm/signal.h
> index 33073bd..859f2de 100644
> --- a/arch/arm/include/uapi/asm/signal.h
> +++ b/arch/arm/include/uapi/asm/signal.h
> @@ -113,7 +113,7 @@ struct sigaction {
>  typedef struct sigaltstack {
>         void __user *ss_sp;
>         int ss_flags;
> -       size_t ss_size;
> +       __kernel_size_t ss_size;
>  } stack_t;

I was going to reply with an Ack, but on further consideration,
I'm not sure if we can't do this in general: size_t may be either
'unsigned int' or 'unsigned long' (depending on the architecture
and toolchain), and if kernel and glibc disagree on this, we
have a problem with any user space code that expects sigaltstack->ss_size
to be the same type as size_t (as mandated by the man page).

I wonder if there is another way to address this.

	Arnd
Mikko Rapeli Nov. 16, 2016, 2:11 p.m. UTC | #2
On Wed, Aug 24, 2016 at 05:02:56PM +0200, Arnd Bergmann wrote:
> On Monday, August 22, 2016 8:33:17 PM CEST Mikko Rapeli wrote:
> > diff --git a/arch/arm/include/uapi/asm/signal.h b/arch/arm/include/uapi/asm/signal.h
> > index 33073bd..859f2de 100644
> > --- a/arch/arm/include/uapi/asm/signal.h
> > +++ b/arch/arm/include/uapi/asm/signal.h
> > @@ -113,7 +113,7 @@ struct sigaction {
> >  typedef struct sigaltstack {
> >         void __user *ss_sp;
> >         int ss_flags;
> > -       size_t ss_size;
> > +       __kernel_size_t ss_size;
> >  } stack_t;
> 
> I was going to reply with an Ack, but on further consideration,
> I'm not sure if we can't do this in general: size_t may be either
> 'unsigned int' or 'unsigned long' (depending on the architecture
> and toolchain), and if kernel and glibc disagree on this, we
> have a problem with any user space code that expects sigaltstack->ss_size
> to be the same type as size_t (as mandated by the man page).
> 
> I wonder if there is another way to address this.

I presume that kernel headers need to follow libc in this case and include
<stddef.h>?

-Mikko
diff mbox

Patch

diff --git a/arch/arm/include/uapi/asm/signal.h b/arch/arm/include/uapi/asm/signal.h
index 33073bd..859f2de 100644
--- a/arch/arm/include/uapi/asm/signal.h
+++ b/arch/arm/include/uapi/asm/signal.h
@@ -113,7 +113,7 @@  struct sigaction {
 typedef struct sigaltstack {
 	void __user *ss_sp;
 	int ss_flags;
-	size_t ss_size;
+	__kernel_size_t ss_size;
 } stack_t;