Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1704888 > unrolled thread

[PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes

Started byMikko Rapeli <mikko.rapeli@iki.fi>
First post2017-08-06 19:10 +0200
Last post2017-08-09 00:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
    Re: [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 00:50 +0200

#1704888 — [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2017-08-06 19:10 +0200
Subject[PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes
Message-ID<ubxdT-50T-7@gated-at.bofh.it>
Include linux/types.h and asm/msgbuf.h and use __kernel_size_t instead
of size_t.

Fixes userspace compilation errors like:

error: field ‘shm_perm’ has incomplete type
struct ipc64_perm shm_perm; /* operation perms */
error: unknown type name ‘size_t’
error: unknown type name ‘__kernel_time_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: H.J. Lu <hjl.tools@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/shmbuf.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 7e9fb2f0853b..ae867ad1e5e4 100644
--- a/include/uapi/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
@@ -1,7 +1,9 @@
 #ifndef __ASM_GENERIC_SHMBUF_H
 #define __ASM_GENERIC_SHMBUF_H
 
+#include <linux/types.h>
 #include <asm/bitsperlong.h>
+#include <asm/msgbuf.h>
 
 /*
  * The shmid64_ds structure for x86 architecture.
@@ -24,7 +26,7 @@
 
 struct shmid64_ds {
 	struct ipc64_perm	shm_perm;	/* operation perms */
-	size_t			shm_segsz;	/* size of segment (bytes) */
+	__kernel_size_t		shm_segsz;	/* size of segment (bytes) */
 	__kernel_time_t		shm_atime;	/* last attach time */
 #if __BITS_PER_LONG != 64
 	unsigned long		__unused1;
-- 
2.13.3

[toc] | [next] | [standalone]


#1706920

From"Dmitry V. Levin" <ldv@altlinux.org>
Date2017-08-09 00:50 +0200
Message-ID<uclu2-6Bf-27@gated-at.bofh.it>
In reply to#1704888

[Multipart message — attachments visible in raw view] — view raw

On Sun, Aug 06, 2017 at 06:43:59PM +0200, Mikko Rapeli wrote:
> Include linux/types.h and asm/msgbuf.h and use __kernel_size_t instead
> of size_t.
> 
> Fixes userspace compilation errors like:
> 
> error: field ‘shm_perm’ has incomplete type
> struct ipc64_perm shm_perm; /* operation perms */
> error: unknown type name ‘size_t’
> error: unknown type name ‘__kernel_time_t’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Cc: H.J. Lu <hjl.tools@gmail.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> ---
>  include/uapi/asm-generic/shmbuf.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
> index 7e9fb2f0853b..ae867ad1e5e4 100644
> --- a/include/uapi/asm-generic/shmbuf.h
> +++ b/include/uapi/asm-generic/shmbuf.h
> @@ -1,7 +1,9 @@
>  #ifndef __ASM_GENERIC_SHMBUF_H
>  #define __ASM_GENERIC_SHMBUF_H
>  
> +#include <linux/types.h>
>  #include <asm/bitsperlong.h>
> +#include <asm/msgbuf.h>
>  
>  /*
>   * The shmid64_ds structure for x86 architecture.
> @@ -24,7 +26,7 @@
>  
>  struct shmid64_ds {
>  	struct ipc64_perm	shm_perm;	/* operation perms */
> -	size_t			shm_segsz;	/* size of segment (bytes) */
> +	__kernel_size_t		shm_segsz;	/* size of segment (bytes) */
>  	__kernel_time_t		shm_atime;	/* last attach time */
>  #if __BITS_PER_LONG != 64
>  	unsigned long		__unused1;

Surprisingly enough, this replacement of size_t with __kernel_size_t
is not just correct, it's a fix for a more subtle bug on x32, see
http://lkml.kernel.org/r/20170302004607.GE27132@altlinux.org

I recommend splitting the change into "include" fix and "size_t" fix
like I did some time ago, see
http://lkml.kernel.org/r/20170302002253.GC27132@altlinux.org


-- 
ldv

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web