From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Masahiro Yamada <masahiroy@kernel.org>, Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] uapi: fix asm/shmbuf.h userspace compilation errors
Date: Mon, 27 Dec 2021 13:53:04 +0300 [thread overview]
Message-ID: <20211227105303.GA25101@altlinux.org> (raw)
In-Reply-To: <CAK8P3a1=-Q=gVRyk+PwqxTeTPXa4yrmqWKG7SyZng2d7bcbG=g@mail.gmail.com> <CAK8P3a1_QLguZ6XEGC9TdGUmF0R3bKaU2EiJ6m+Gf=KpYnmqqw@mail.gmail.com>
Userspace cannot compile <asm/shmbuf.h> due to some missing type
definitions. For example, compiling it for x86_64 fails with the
following diagnostics:
HDRTEST usr/include/asm/shmbuf.h
In file included from ./usr/include/asm/shmbuf.h:6,
from <command-line>:
./usr/include/asm-generic/shmbuf.h:26:33: error: field 'shm_perm' has incomplete type
26 | struct ipc64_perm shm_perm; /* operation perms */
| ^~~~~~~~
./usr/include/asm-generic/shmbuf.h:27:9: error: unknown type name 'size_t'
27 | size_t shm_segsz; /* size of segment (bytes) */
| ^~~~~~
./usr/include/asm-generic/shmbuf.h:40:9: error: unknown type name '__kernel_pid_t'
40 | __kernel_pid_t shm_cpid; /* pid of creator */
| ^~~~~~~~~~~~~~
./usr/include/asm-generic/shmbuf.h:41:9: error: unknown type name '__kernel_pid_t'
41 | __kernel_pid_t shm_lpid; /* pid of last operator */
| ^~~~~~~~~~~~~~
Replace size_t with __kernel_size_t and include <asm/ipcbuf.h> to make
asm/shmbuf.h self-contained, also add it to the compile-test coverage.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
This was submitted almost 5 years ago [1] and acked by Arnd, so I was
under impression that it was applied among others of this kind, but,
apparently, it's still relevant.
v2: squash two patches into a single patch, update commit message,
remove usr/include/Makefile exception for asm/shmbuf.h.
[1] https://lore.kernel.org/lkml/20170302004607.GE27132@altlinux.org/T/#u
arch/mips/include/uapi/asm/shmbuf.h | 6 ++++--
arch/parisc/include/uapi/asm/shmbuf.h | 1 +
arch/powerpc/include/uapi/asm/shmbuf.h | 4 +++-
arch/sparc/include/uapi/asm/shmbuf.h | 4 +++-
arch/x86/include/uapi/asm/shmbuf.h | 4 +++-
arch/xtensa/include/uapi/asm/shmbuf.h | 4 +++-
include/uapi/asm-generic/shmbuf.h | 3 ++-
usr/include/Makefile | 1 -
8 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/arch/mips/include/uapi/asm/shmbuf.h b/arch/mips/include/uapi/asm/shmbuf.h
index 680bb95b2240..cfddd497e6a8 100644
--- a/arch/mips/include/uapi/asm/shmbuf.h
+++ b/arch/mips/include/uapi/asm/shmbuf.h
@@ -2,6 +2,8 @@
#ifndef _ASM_SHMBUF_H
#define _ASM_SHMBUF_H
+#include <asm/ipcbuf.h>
+
/*
* The shmid64_ds structure for the MIPS architecture.
* Note extra padding because this structure is passed back and forth
@@ -16,7 +18,7 @@
#ifdef __mips64
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) */
long shm_atime; /* last attach time */
long shm_dtime; /* last detach time */
long shm_ctime; /* last change time */
@@ -29,7 +31,7 @@ struct shmid64_ds {
#else
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) */
unsigned long shm_atime; /* last attach time */
unsigned long shm_dtime; /* last detach time */
unsigned long shm_ctime; /* last change time */
diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h
index 5da3089be65e..4b1d6c0b1216 100644
--- a/arch/parisc/include/uapi/asm/shmbuf.h
+++ b/arch/parisc/include/uapi/asm/shmbuf.h
@@ -3,6 +3,7 @@
#define _PARISC_SHMBUF_H
#include <asm/bitsperlong.h>
+#include <asm/ipcbuf.h>
/*
* The shmid64_ds structure for parisc architecture.
diff --git a/arch/powerpc/include/uapi/asm/shmbuf.h b/arch/powerpc/include/uapi/asm/shmbuf.h
index 00422b2f3c63..8a274dbf7b20 100644
--- a/arch/powerpc/include/uapi/asm/shmbuf.h
+++ b/arch/powerpc/include/uapi/asm/shmbuf.h
@@ -2,6 +2,8 @@
#ifndef _ASM_POWERPC_SHMBUF_H
#define _ASM_POWERPC_SHMBUF_H
+#include <asm/ipcbuf.h>
+
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -34,7 +36,7 @@ struct shmid64_ds {
unsigned long shm_ctime; /* last change time */
unsigned long __unused4;
#endif
- size_t shm_segsz; /* size of segment (bytes) */
+ __kernel_size_t shm_segsz; /* size of segment (bytes) */
__kernel_pid_t shm_cpid; /* pid of creator */
__kernel_pid_t shm_lpid; /* pid of last operator */
unsigned long shm_nattch; /* no. of current attaches */
diff --git a/arch/sparc/include/uapi/asm/shmbuf.h b/arch/sparc/include/uapi/asm/shmbuf.h
index a5d7d8d681c4..1b10b3c91d1b 100644
--- a/arch/sparc/include/uapi/asm/shmbuf.h
+++ b/arch/sparc/include/uapi/asm/shmbuf.h
@@ -2,6 +2,8 @@
#ifndef _SPARC_SHMBUF_H
#define _SPARC_SHMBUF_H
+#include <asm/ipcbuf.h>
+
/*
* The shmid64_ds structure for sparc architecture.
* Note extra padding because this structure is passed back and forth
@@ -25,7 +27,7 @@ struct shmid64_ds {
unsigned long shm_ctime_high;
unsigned long shm_ctime; /* last change time */
#endif
- size_t shm_segsz; /* size of segment (bytes) */
+ __kernel_size_t shm_segsz; /* size of segment (bytes) */
__kernel_pid_t shm_cpid; /* pid of creator */
__kernel_pid_t shm_lpid; /* pid of last operator */
unsigned long shm_nattch; /* no. of current attaches */
diff --git a/arch/x86/include/uapi/asm/shmbuf.h b/arch/x86/include/uapi/asm/shmbuf.h
index fce18eaa070c..3e61a65d8512 100644
--- a/arch/x86/include/uapi/asm/shmbuf.h
+++ b/arch/x86/include/uapi/asm/shmbuf.h
@@ -13,9 +13,11 @@
* from other 32-bit architectures.
*/
+#include <asm/ipcbuf.h>
+
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_long_t shm_atime; /* last attach time */
__kernel_long_t shm_dtime; /* last detach time */
__kernel_long_t shm_ctime; /* last change time */
diff --git a/arch/xtensa/include/uapi/asm/shmbuf.h b/arch/xtensa/include/uapi/asm/shmbuf.h
index 554a57a6a90f..a54411e1ec2a 100644
--- a/arch/xtensa/include/uapi/asm/shmbuf.h
+++ b/arch/xtensa/include/uapi/asm/shmbuf.h
@@ -20,9 +20,11 @@
#ifndef _XTENSA_SHMBUF_H
#define _XTENSA_SHMBUF_H
+#include <asm/ipcbuf.h>
+
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) */
unsigned long shm_atime; /* last attach time */
unsigned long shm_atime_high;
unsigned long shm_dtime; /* last detach time */
diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 2bab955e0fed..dc16f82be778 100644
--- a/include/uapi/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
@@ -3,6 +3,7 @@
#define __ASM_GENERIC_SHMBUF_H
#include <asm/bitsperlong.h>
+#include <asm/ipcbuf.h>
/*
* The shmid64_ds structure for x86 architecture.
@@ -24,7 +25,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) */
#if __BITS_PER_LONG == 64
long shm_atime; /* last attach time */
long shm_dtime; /* last detach time */
diff --git a/usr/include/Makefile b/usr/include/Makefile
index 1c2ae1368079..129d13e71691 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -20,7 +20,6 @@ override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include
# Please consider to fix the header first.
#
# Sorted alphabetically.
-no-header-test += asm/shmbuf.h
no-header-test += asm/signal.h
no-header-test += asm/ucontext.h
no-header-test += drm/vmwgfx_drm.h
--
ldv
next prev parent reply other threads:[~2021-12-27 10:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-26 18:29 [PATCH] uapi: fix asm/ipcbuf.h userspace compilation errors Dmitry V. Levin
2017-02-26 18:29 ` Dmitry V. Levin
2017-03-01 16:23 ` Arnd Bergmann
2017-03-02 0:22 ` [PATCH 1/3] uapi: fix asm/msgbuf.h " Dmitry V. Levin
2017-03-02 0:22 ` Dmitry V. Levin
2017-03-02 0:22 ` [PATCH 2/3] uapi: fix asm/sembuf.h " Dmitry V. Levin
2017-03-02 0:22 ` Dmitry V. Levin
2017-03-02 0:22 ` [PATCH 3/3] uapi: fix asm/shmbuf.h " Dmitry V. Levin
2017-03-02 0:22 ` Dmitry V. Levin
2017-03-02 13:14 ` Arnd Bergmann
2017-03-02 13:14 ` Arnd Bergmann
2021-12-27 10:53 ` Dmitry V. Levin [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-03-02 0:46 [PATCH] uapi: fix another asm/shmbuf.h userspace compilation error Dmitry V. Levin
2017-03-02 0:46 ` Dmitry V. Levin
2017-03-02 13:07 ` Arnd Bergmann
2017-03-02 13:07 ` Arnd Bergmann
2017-03-26 3:27 ` [PATCH 0/5] uapi: fix userspace compilation of asm/ ipc headers Dmitry V. Levin
2017-03-26 3:30 ` [PATCH 1/5] uapi: fix asm/ipcbuf.h userspace compilation errors Dmitry V. Levin
2017-03-26 3:30 ` [PATCH 2/5] uapi: fix asm/msgbuf.h " Dmitry V. Levin
2017-03-26 3:30 ` Dmitry V. Levin
2017-03-26 3:30 ` [PATCH 3/5] uapi: fix asm/sembuf.h " Dmitry V. Levin
2017-03-26 3:30 ` Dmitry V. Levin
2017-03-26 3:30 ` [PATCH 4/5] uapi: fix asm/shmbuf.h " Dmitry V. Levin
2017-03-26 3:30 ` Dmitry V. Levin
2017-03-26 3:30 ` [PATCH 5/5] uapi: fix another asm/shmbuf.h userspace compilation error Dmitry V. Levin
2017-03-26 3:30 ` Dmitry V. Levin
2017-08-04 15:22 ` [PATCH] " James Hogan
2017-08-04 15:22 ` James Hogan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211227105303.GA25101@altlinux.org \
--to=ldv@altlinux.org \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).