* [gentoo-commits] proj/toolchain/linux-headers-patches:master commit in: 5.4/
@ 2020-05-08 21:59 Sergei Trofimovich
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Trofimovich @ 2020-05-08 21:59 UTC (permalink / raw
To: gentoo-commits
commit: 1bef8acc4b8c09637b3b233ece30a9e9c694bf8c
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 8 21:59:16 2020 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 8 21:59:16 2020 +0000
URL: https://gitweb.gentoo.org/proj/toolchain/linux-headers-patches.git/commit/?id=1bef8acc
5.4: backport from 5.6 time64 alsa patches
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
5.4/01_all_backport-5.6-alsa-timespec64-p1.patch | 49 +++++
5.4/01_all_backport-5.6-alsa-timespec64-p2.patch | 41 ++++
5.4/01_all_backport-5.6-alsa-timespec64-p3.patch | 96 +++++++++
5.4/01_all_backport-5.6-alsa-timespec64-p4.patch | 47 +++++
5.4/01_all_backport-5.6-alsa-timespec64-p5.patch | 73 +++++++
5.4/01_all_backport-5.6-alsa-timespec64-p6.patch | 248 +++++++++++++++++++++++
5.4/01_all_backport-5.6-alsa-timespec64-p7.patch | 68 +++++++
5.4/01_all_backport-5.6-alsa-timespec64-p8.patch | 53 +++++
8 files changed, 675 insertions(+)
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p1.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p1.patch
new file mode 100644
index 0000000..1195ca2
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p1.patch
@@ -0,0 +1,49 @@
+From a07804cc7472d8aa5db03ea5d75f3d8d80abb687 Mon Sep 17 00:00:00 2001
+From: Baolin Wang <baolin.wang@linaro.org>
+Date: Tue, 24 Apr 2018 20:06:09 +0800
+Subject: [PATCH] ALSA: Avoid using timespec for struct snd_timer_status
+
+struct snd_timer_status uses 'timespec' type variables to record
+timestamp, which will be changed to an incompatible layout with
+updated user space using 64-bit time_t.
+
+To handle both the old and the new layout on 32-bit architectures,
+this patch introduces 'struct snd_timer_status32' and 'struct snd_timer_status64'
+to handle 32bit time_t and 64bit time_t in native mode and compat mode,
+which replaces timespec with s64 type.
+
+When glibc changes time_t to 64-bit, any recompiled program will issue
+ioctl commands that the kernel does not understand without this patch.
+
+In the public uapi header, snd_timer_status is now guarded by
+an #ifndef __KERNEL__ to avoid referencing 'struct timespec'.
+The timespec definition will be removed from the kernel to prevent
+new y2038 bugs and to avoid the conflict with an incompatible libc
+type of the same name.
+
+Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 2 ++
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -761,6 +761,7 @@ struct snd_timer_params {
+ unsigned char reserved[60]; /* reserved */
+ };
+
++#ifndef __KERNEL__
+ struct snd_timer_status {
+ struct timespec tstamp; /* Timestamp - last update */
+ unsigned int resolution; /* current period resolution in ns */
+@@ -769,6 +770,7 @@ struct snd_timer_status {
+ unsigned int queue; /* used queue size */
+ unsigned char reserved[64]; /* reserved */
+ };
++#endif
+
+ #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
+ #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
+--
+2.26.2
+
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p2.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p2.patch
new file mode 100644
index 0000000..865e118
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p2.patch
@@ -0,0 +1,41 @@
+From a4e7dd35b9dac21fa7b33e8788b51c7fbc7a49f1 Mon Sep 17 00:00:00 2001
+From: Baolin Wang <baolin.wang@linaro.org>
+Date: Tue, 24 Apr 2018 20:06:10 +0800
+Subject: [PATCH] ALSA: Avoid using timespec for struct snd_ctl_elem_value
+
+The struct snd_ctl_elem_value will use 'timespec' type variables to record
+timestamp, which is not year 2038 safe on 32bits system.
+
+Since there are no drivers will implemented the tstamp member of the
+struct snd_ctl_elem_value, and also the stucture size will not be changed
+if we change timespec to s64 for tstamp member of struct snd_ctl_elem_value.
+
+From Takashi's comments, "In the library, applications are not expected
+to access to this structure directly. The applications get opaque pointer
+to the structure and must use any control APIs to operate it. Actually the
+library produce no API to handle 'struct snd_ctl_elem_value.tstamp'. This
+means that we can drop this member from alsa-lib without decline of
+functionality." Thus we can simply remove the tstamp member to avoid using
+the type which is not year 2038 safe on 32bits system.
+
+Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -957,8 +957,7 @@ struct snd_ctl_elem_value {
+ } bytes;
+ struct snd_aes_iec958 iec958;
+ } value; /* RO */
+- struct timespec tstamp;
+- unsigned char reserved[128-sizeof(struct timespec)];
++ unsigned char reserved[128];
+ };
+
+ struct snd_ctl_tlv {
+--
+2.26.2
+
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p3.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p3.patch
new file mode 100644
index 0000000..062cfba
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p3.patch
@@ -0,0 +1,96 @@
+From 3ddee7f88aaf2dee38f7016ac8fd48dd9fdb43e3 Mon Sep 17 00:00:00 2001
+From: Baolin Wang <baolin.wang@linaro.org>
+Date: Tue, 24 Apr 2018 20:06:11 +0800
+Subject: [PATCH] ALSA: Avoid using timespec for struct snd_pcm_status
+
+The struct snd_pcm_status will use 'timespec' type variables to record
+timestamp, which is not year 2038 safe on 32bits system.
+
+Userspace will use SNDRV_PCM_IOCTL_STATUS and SNDRV_PCM_IOCTL_STATUS_EXT
+as commands to issue ioctl() to fill the 'snd_pcm_status' structure in
+userspace. The command number is always defined through _IOR/_IOW/IORW,
+so when userspace changes the definition of 'struct timespec' to use
+64-bit types, the command number also changes.
+
+Thus in the kernel, we now need to define two versions of each such ioctl
+and corresponding ioctl commands to handle 32bit time_t and 64bit time_t
+in native mode:
+struct snd_pcm_status32 {
+ ......
+
+ s32 trigger_tstamp_sec;
+ s32 trigger_tstamp_nsec;
+
+ ......
+
+ s32 audio_tstamp_sec;
+ s32 audio_tstamp_nsec;
+
+ ......
+};
+
+struct snd_pcm_status64 {
+ ......
+
+ s32 trigger_tstamp_sec;
+ s32 trigger_tstamp_nsec;
+
+ ......
+
+ s32 audio_tstamp_sec;
+ s32 audio_tstamp_nsec;
+
+ ......
+};
+
+Moreover in compat file, we renamed or introduced new structures to handle
+32bit/64bit time_t in compatible mode. The 'struct snd_pcm_status32' and
+snd_pcm_status_user32() are used to handle 32bit time_t in compat mode.
+'struct compat_snd_pcm_status64' and snd_pcm_status_user_compat64() are used
+to handle 64bit time_t.
+
+The implicit padding before timespec is made explicit to avoid incompatible
+structure layout between 32-bit and 64-bit x86 due to the different
+alignment requirements, and the snd_pcm_status structure is now hidden
+from the kernel to avoid relying on the timespec definitio definitionn
+
+Finally we can replace SNDRV_PCM_IOCTL_STATUS and SNDRV_PCM_IOCTL_STATUS_EXT
+with new commands and introduce new functions to fill new 'struct snd_pcm_status64'
+instead of using unsafe 'struct snd_pcm_status'. Then in future, the new
+commands can be matched when userspace changes 'timespec' to 64bit type
+to make a size change of 'struct snd_pcm_status'. When glibc changes time_t
+to 64-bit, any recompiled program will issue ioctl commands that the kernel
+does not understand without this patch.
+
+Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 6 ++
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -456,8 +456,13 @@ enum {
+ SNDRV_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
+ };
+
++#ifndef __KERNEL__
++/* explicit padding avoids incompatibility between i386 and x86-64 */
++typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)] __time_pad;
++
+ struct snd_pcm_status {
+ snd_pcm_state_t state; /* stream state */
++ __time_pad pad1; /* align to timespec */
+ struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
+ struct timespec tstamp; /* reference timestamp */
+ snd_pcm_uframes_t appl_ptr; /* appl ptr */
+@@ -473,6 +478,7 @@ struct snd_pcm_status {
+ __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */
+ unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */
+ };
++#endif
+
+ struct snd_pcm_mmap_status {
+ snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
+--
+2.26.2
+
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p4.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p4.patch
new file mode 100644
index 0000000..03b54d1
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p4.patch
@@ -0,0 +1,47 @@
+From d9e5582c4bb219f3459e39f65410f0e5128fbe91 Mon Sep 17 00:00:00 2001
+From: Baolin Wang <baolin.wang@linaro.org>
+Date: Tue, 24 Apr 2018 20:06:12 +0800
+Subject: [PATCH] ALSA: Avoid using timespec for struct snd_rawmidi_status
+
+The struct snd_rawmidi_status will use 'timespec' type variables to record
+timestamp, which is not year 2038 safe on 32bits system.
+
+Thus we introduced 'struct snd_rawmidi_status32' and 'struct snd_rawmidi_status64'
+to handle 32bit time_t and 64bit time_t in native mode, which replace
+timespec with s64 type.
+
+In compat mode, we renamed or introduced new structures to handle 32bit/64bit
+time_t in compatible mode. The 'struct snd_rawmidi_status32' and
+snd_rawmidi_ioctl_status32() are used to handle 32bit time_t in compat mode.
+'struct compat_snd_rawmidi_status64' is used to handle 64bit time_t.
+
+When glibc changes time_t to 64-bit, any recompiled program will issue ioctl
+commands that the kernel does not understand without this patch.
+
+Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 3 +
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -654,13 +654,16 @@ struct snd_rawmidi_params {
+ unsigned char reserved[16]; /* reserved for future use */
+ };
+
++#ifndef __KERNEL__
+ struct snd_rawmidi_status {
+ int stream;
++ __time_pad pad1;
+ struct timespec tstamp; /* Timestamp */
+ size_t avail; /* available bytes */
+ size_t xruns; /* count of overruns since last status (in bytes) */
+ unsigned char reserved[16]; /* reserved for future use */
+ };
++#endif
+
+ #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
+ #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
+--
+2.26.2
+
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p5.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p5.patch
new file mode 100644
index 0000000..4c53f28
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p5.patch
@@ -0,0 +1,73 @@
+From 07094ae6f9527279de6fd0c59e88f6d0423585b1 Mon Sep 17 00:00:00 2001
+From: Baolin Wang <baolin.wang@linaro.org>
+Date: Tue, 24 Apr 2018 20:06:13 +0800
+Subject: [PATCH] ALSA: Avoid using timespec for struct snd_timer_tread
+
+The struct snd_timer_tread will use 'timespec' type variables to record
+timestamp, which is not year 2038 safe on 32bits system.
+
+Since the struct snd_timer_tread is passed through read() rather than
+ioctl(), and the read syscall has no command number that lets us pick
+between the 32-bit or 64-bit version of this structure.
+
+Thus we introduced one new command SNDRV_TIMER_IOCTL_TREAD64 and new
+struct snd_timer_tread64 replacing timespec with s64 type to handle
+64bit time_t. That means we will set tu->tread = TREAD_FORMAT_64BIT
+when user space has a 64bit time_t, then we will copy to user with
+struct snd_timer_tread64. Otherwise we will use 32bit time_t variables
+when copying to user.
+
+Moreover this patch replaces timespec type with timespec64 type and
+related y2038 safe APIs.
+
+Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 15 +++-
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -783,7 +783,7 @@ struct snd_timer_status {
+
+ #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
+ #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
+-#define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int)
++#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)
+ #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo)
+ #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams)
+ #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus)
+@@ -796,6 +796,15 @@ struct snd_timer_status {
+ #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1)
+ #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2)
+ #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3)
++#define SNDRV_TIMER_IOCTL_TREAD64 _IOW('T', 0xa4, int)
++
++#if __BITS_PER_LONG == 64
++#define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
++#else
++#define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
++ SNDRV_TIMER_IOCTL_TREAD_OLD : \
++ SNDRV_TIMER_IOCTL_TREAD64)
++#endif
+
+ struct snd_timer_read {
+ unsigned int resolution;
+@@ -821,11 +830,15 @@ enum {
+ SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10,
+ };
+
++#ifndef __KERNEL__
+ struct snd_timer_tread {
+ int event;
++ __time_pad pad1;
+ struct timespec tstamp;
+ unsigned int val;
++ __time_pad pad2;
+ };
++#endif
+
+ /****************************************************************************
+ * *
+--
+2.26.2
+
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p6.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p6.patch
new file mode 100644
index 0000000..0f7ed72
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p6.patch
@@ -0,0 +1,248 @@
+From 80fe7430c7085951d1246d83f638cc17e6c0be36 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 24 Apr 2018 20:06:15 +0800
+Subject: [PATCH] ALSA: add new 32-bit layout for snd_pcm_mmap_status/control
+
+The snd_pcm_mmap_status and snd_pcm_mmap_control interfaces are one of the
+trickiest areas to get right when moving to 64-bit time_t in user space.
+
+The snd_pcm_mmap_status structure layout is incompatible with user space
+that uses a 64-bit time_t, so we need a new layout for it. Since the
+SNDRV_PCM_IOCTL_SYNC_PTR ioctl combines it with snd_pcm_mmap_control
+into snd_pcm_sync_ptr, we need to change those two as well.
+
+Both structures are also exported via an mmap() operation on certain
+architectures, and this suffers from incompatibility between 32-bit
+and 64-bit user space. As we have to change both structures anyway,
+this is a good opportunity to fix the mmap() problem as well, so let's
+standardize on the existing 64-bit layout of the structure where possible.
+
+The downside is that we lose mmap() support for existing 32-bit x86 and
+powerpc applications, adding that would introduce very noticeable runtime
+overhead and complexity. My assumption here is that not too many people
+will miss the removed feature, given that:
+
+- Almost all x86 and powerpc users these days are on 64-bit kernels,
+the majority of today's 32-bit users are on architectures that never
+supported mmap (ARM, MIPS, ...).
+- It never worked in compat mode (it was intentionally disabled there)
+- The application already needs to work with a fallback to
+SNDRV_PCM_IOCTL_SYNC_PTR, which will keep working with both the old
+and new structure layout.
+
+Both the ioctl() and mmap() based interfaces are changed at the same
+time, as they are based on the same structures. Unlike other interfaces,
+we change the uapi header to export both the traditional structure and
+a version that is portable between 32-bit and 64-bit user space code
+and that corresponds to the existing 64-bit layout. We further check the
+__USE_TIME_BITS64 macro that will be defined by future C library versions
+whenever we use the new time_t definition, so any existing user space
+source code will not see any changes until it gets rebuilt against a new
+C library. However, the new structures are all visible in addition to the
+old ones, allowing applications to explicitly request the new structures.
+
+In order to detect the difference between the old snd_pcm_mmap_status and
+the new __snd_pcm_mmap_status64 structure from the ioctl command number,
+we rely on one quirk in the structure definition: snd_pcm_mmap_status
+must be aligned to alignof(time_t), which leads the compiler to insert
+four bytes of padding in struct snd_pcm_sync_ptr after 'flags' and a
+corresponding change in the size of snd_pcm_sync_ptr itself. On x86-32
+(and only there), the compiler doesn't use 64-bit alignment in structure,
+so I'm adding an explicit pad in the structure that has no effect on the
+existing 64-bit architectures but ensures that the layout matches for x86.
+
+The snd_pcm_uframes_t type compatibility requires another hack: we can't
+easily make that 64 bit wide, so I leave the type as 'unsigned long',
+but add padding before and after it, to ensure that the data is properly
+aligned to the respective 64-bit field in the in-kernel structure.
+
+For the SNDRV_PCM_MMAP_OFFSET_STATUS/CONTROL constants that are used
+as the virtual file offset in the mmap() function, we also have to
+introduce new constants that depend on hte __USE_TIME_BITS64 macro:
+The existing macros are renamed to SNDRV_PCM_MMAP_OFFSET_STATUS_OLD
+and SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD, they continue to work fine on
+64-bit architectures, but stop working on native 32-bit user space.
+The replacement _NEW constants are now used by default for user space
+built with __USE_TIME_BITS64, those now work on all new kernels for x86,
+ppc and alpha (32 and 64 bit, native and compat). It might be a good idea
+for a future alsa-lib to support both the _OLD and _NEW macros and use
+the corresponding structures directly. Unmodified alsa-lib source code
+will retain the current behavior, so it will no longer be able to use
+mmap() for the status/control structures on 32-bit systems, until either
+the C library gets updated to 64-bit time_t or alsa-lib gets updated to
+support both mmap() layouts.
+
+Co-developed-with: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 110 ++++++++++++++++++++++++++++++++----
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -35,6 +35,8 @@
+ #include <time.h>
+ #endif
+
++#include <asm/byteorder.h>
++
+ /*
+ * protocol version
+ */
+@@ -301,7 +303,9 @@ typedef int __bitwise snd_pcm_subformat_t;
+ #define SNDRV_PCM_INFO_DRAIN_TRIGGER 0x40000000 /* internal kernel flag - trigger in drain */
+ #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
+
+-
++#if (__BITS_PER_LONG == 32 && defined(__USE_TIME_BITS64)) || defined __KERNEL__
++#define __SND_STRUCT_TIME64
++#endif
+
+ typedef int __bitwise snd_pcm_state_t;
+ #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
+@@ -317,8 +321,17 @@ typedef int __bitwise snd_pcm_state_t;
+
+ enum {
+ SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000,
+- SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000,
+- SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000,
++ SNDRV_PCM_MMAP_OFFSET_STATUS_OLD = 0x80000000,
++ SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD = 0x81000000,
++ SNDRV_PCM_MMAP_OFFSET_STATUS_NEW = 0x82000000,
++ SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW = 0x83000000,
++#ifdef __SND_STRUCT_TIME64
++ SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_NEW,
++ SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW,
++#else
++ SNDRV_PCM_MMAP_OFFSET_STATUS = SNDRV_PCM_MMAP_OFFSET_STATUS_OLD,
++ SNDRV_PCM_MMAP_OFFSET_CONTROL = SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD,
++#endif
+ };
+
+ union snd_pcm_sync_id {
+@@ -480,16 +493,46 @@ struct snd_pcm_status {
+ };
+ #endif
+
+-struct snd_pcm_mmap_status {
++/*
++ * For mmap operations, we need the 64-bit layout, both for compat mode,
++ * and for y2038 compatibility. For 64-bit applications, the two definitions
++ * are identical, so we keep the traditional version.
++ */
++#ifdef __SND_STRUCT_TIME64
++#define __snd_pcm_mmap_status64 snd_pcm_mmap_status
++#define __snd_pcm_mmap_control64 snd_pcm_mmap_control
++#define __snd_pcm_sync_ptr64 snd_pcm_sync_ptr
++#ifdef __KERNEL__
++#define __snd_timespec64 __kernel_timespec
++#else
++#define __snd_timespec64 timespec
++#endif
++struct __snd_timespec {
++ __s32 tv_sec;
++ __s32 tv_nsec;
++};
++#else
++#define __snd_pcm_mmap_status snd_pcm_mmap_status
++#define __snd_pcm_mmap_control snd_pcm_mmap_control
++#define __snd_pcm_sync_ptr snd_pcm_sync_ptr
++#define __snd_timespec timespec
++struct __snd_timespec64 {
++ __s64 tv_sec;
++ __s64 tv_nsec;
++};
++
++#endif
++
++struct __snd_pcm_mmap_status {
+ snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */
+ int pad1; /* Needed for 64 bit alignment */
+ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
+- struct timespec tstamp; /* Timestamp */
++ struct __snd_timespec tstamp; /* Timestamp */
+ snd_pcm_state_t suspended_state; /* RO: suspended stream state */
+- struct timespec audio_tstamp; /* from sample counter or wall clock */
++ struct __snd_timespec audio_tstamp; /* from sample counter or wall clock */
+ };
+
+-struct snd_pcm_mmap_control {
++struct __snd_pcm_mmap_control {
+ snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
+ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
+ };
+@@ -498,14 +541,59 @@ struct snd_pcm_mmap_control {
+ #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */
+ #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */
+
+-struct snd_pcm_sync_ptr {
++struct __snd_pcm_sync_ptr {
+ unsigned int flags;
+ union {
+- struct snd_pcm_mmap_status status;
++ struct __snd_pcm_mmap_status status;
++ unsigned char reserved[64];
++ } s;
++ union {
++ struct __snd_pcm_mmap_control control;
++ unsigned char reserved[64];
++ } c;
++};
++
++#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
++typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
++typedef char __pad_after_uframe[0];
++#endif
++
++#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
++typedef char __pad_before_uframe[0];
++typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
++#endif
++
++struct __snd_pcm_mmap_status64 {
++ __s32 state; /* RO: state - SNDRV_PCM_STATE_XXXX */
++ __u32 pad1; /* Needed for 64 bit alignment */
++ __pad_before_uframe __pad1;
++ snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
++ __pad_after_uframe __pad2;
++ struct __snd_timespec64 tstamp; /* Timestamp */
++ __s32 suspended_state; /* RO: suspended stream state */
++ __u32 pad3; /* Needed for 64 bit alignment */
++ struct __snd_timespec64 audio_tstamp; /* sample counter or wall clock */
++};
++
++struct __snd_pcm_mmap_control64 {
++ __pad_before_uframe __pad1;
++ snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */
++ __pad_before_uframe __pad2;
++
++ __pad_before_uframe __pad3;
++ snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */
++ __pad_after_uframe __pad4;
++};
++
++struct __snd_pcm_sync_ptr64 {
++ __u32 flags;
++ __u32 pad1;
++ union {
++ struct __snd_pcm_mmap_status64 status;
+ unsigned char reserved[64];
+ } s;
+ union {
+- struct snd_pcm_mmap_control control;
++ struct __snd_pcm_mmap_control64 control;
+ unsigned char reserved[64];
+ } c;
+ };
+@@ -590,6 +678,8 @@ enum {
+ #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status)
+ #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t)
+ #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22)
++#define __SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct __snd_pcm_sync_ptr)
++#define __SNDRV_PCM_IOCTL_SYNC_PTR64 _IOWR('A', 0x23, struct __snd_pcm_sync_ptr64)
+ #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
+ #define SNDRV_PCM_IOCTL_STATUS_EXT _IOWR('A', 0x24, struct snd_pcm_status)
+ #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info)
+--
+2.26.2
+
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p7.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p7.patch
new file mode 100644
index 0000000..0cea471
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p7.patch
@@ -0,0 +1,68 @@
+From 1cfaef9617033f38eba9cc725809ed32bcdb3dc5 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 13 Nov 2019 17:49:14 +0100
+Subject: [PATCH] ALSA: bump uapi version numbers
+
+Change SNDRV_PCM_VERSION, SNDRV_RAWMIDI_VERSION and SNDRV_TIMER_VERSION
+to indicate the addition of the time64 version of the mmap interface and
+these ioctl commands:
+
+SNDRV_PCM_IOCTL_SYNC
+SNDRV_RAWMIDI_IOCTL_STATUS
+SNDRV_PCM_IOCTL_STATUS
+SNDRV_PCM_IOCTL_STATUS_EXT
+SNDRV_TIMER_IOCTL_TREAD
+SNDRV_TIMER_IOCTL_STATUS
+
+32-bit applications built with 64-bit time_t require both the headers
+and the running kernel to support at least the new API version. When
+built with earlier kernel headers, some of these may not work
+correctly, so applications are encouraged to fail compilation like
+
+ #if SNDRV_PCM_VERSION < SNDRV_PROTOCOL_VERSION(2, 0, 15)
+ extern int __fail_build_for_time_64[sizeof(long) - sizeof(time_t)];
+ #endif
+
+or provide their own updated copy of the header file.
+At runtime, the interface is unchanged for 32-bit time_t, but new
+kernels are required to work with user compiled with 64-bit time_t.
+
+A runtime check can be used to detect old kernel versions and
+warn about those.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+---
+ include/uapi/sound/asound.h | 6 +++---
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -156,7 +156,7 @@ struct snd_hwdep_dsp_image {
+ * *
+ *****************************************************************************/
+
+-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 14)
++#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 15)
+
+ typedef unsigned long snd_pcm_uframes_t;
+ typedef signed long snd_pcm_sframes_t;
+@@ -710,7 +710,7 @@ enum {
+ * Raw MIDI section - /dev/snd/midi??
+ */
+
+-#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0)
++#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
+
+ enum {
+ SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
+@@ -766,7 +766,7 @@ struct snd_rawmidi_status {
+ * Timer section - /dev/snd/timer
+ */
+
+-#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
++#define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 7)
+
+ enum {
+ SNDRV_TIMER_CLASS_NONE = -1,
+--
+2.26.2
+
diff --git a/5.4/01_all_backport-5.6-alsa-timespec64-p8.patch b/5.4/01_all_backport-5.6-alsa-timespec64-p8.patch
new file mode 100644
index 0000000..d9a9530
--- /dev/null
+++ b/5.4/01_all_backport-5.6-alsa-timespec64-p8.patch
@@ -0,0 +1,53 @@
+From 7fd7d6c5045113350fcf78e865ced8a80dbde9fb Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 20 Dec 2019 16:34:14 +0100
+Subject: [PATCH] ALSA: uapi: Fix typos and header inclusion in asound.h
+
+The recent changes in uapi/asoundlib.h caused some build errors in
+alsa-lib side because of a typo and the new included files.
+Basically asound.h is supposed to be usable also on non-Linux systems,
+so we've tried to avoid the Linux-specific include files.
+
+This patch is an attempt to recover from those changes.
+
+Fixes: 3ddee7f88aaf ("ALSA: Avoid using timespec for struct snd_pcm_status")
+Fixes: 80fe7430c708 ("ALSA: add new 32-bit layout for snd_pcm_mmap_status/control")
+Link: https://lore.kernel.org/r/20191220153415.2740-5-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+---
+ include/uapi/sound/asound.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/include/uapi/sound/asound.h
++++ b/include/uapi/sound/asound.h
+@@ -26,7 +26,9 @@
+
+ #if defined(__KERNEL__) || defined(__linux__)
+ #include <linux/types.h>
++#include <asm/byteorder.h>
+ #else
++#include <endian.h>
+ #include <sys/ioctl.h>
+ #endif
+
+@@ -35,8 +37,6 @@
+ #include <time.h>
+ #endif
+
+-#include <asm/byteorder.h>
+-
+ /*
+ * protocol version
+ */
+@@ -471,7 +471,7 @@ enum {
+
+ #ifndef __KERNEL__
+ /* explicit padding avoids incompatibility between i386 and x86-64 */
+-typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)] __time_pad;
++typedef struct { unsigned char pad[sizeof(time_t) - sizeof(int)]; } __time_pad;
+
+ struct snd_pcm_status {
+ snd_pcm_state_t state; /* stream state */
+--
+2.26.2
+
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/toolchain/linux-headers-patches:master commit in: 5.4/
@ 2019-12-08 11:25 Sergei Trofimovich
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Trofimovich @ 2019-12-08 11:25 UTC (permalink / raw
To: gentoo-commits
commit: 03d5f5353d05cbeaa3ada858c4adb833cb19ae59
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 8 11:03:22 2019 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Dec 8 11:03:22 2019 +0000
URL: https://gitweb.gentoo.org/proj/toolchain/linux-headers-patches.git/commit/?id=03d5f535
5.4: copy 5.3 patches as is
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
...0001-linux-stat.h-remove-__GLIBC__-checks.patch | 28 ++++++++
5.4/00_all_0002-netfilter-pull-in-limits.h.patch | 28 ++++++++
5.4/00_all_0003-convert-PAGE_SIZE-usage.patch | 54 +++++++++++++++
...ric-fcntl.h-namespace-kernel-file-structs.patch | 54 +++++++++++++++
..._0005-unifdef-drop-unused-errno.h-include.patch | 32 +++++++++
| 33 ++++++++++
...k-drop-int-cast-on-length-arg-in-NLMSG_OK.patch | 43 ++++++++++++
| 76 ++++++++++++++++++++++
...ecific-inclusion-of-sysinfo.h-in-kernel.h.patch | 46 +++++++++++++
9 files changed, 394 insertions(+)
diff --git a/5.4/00_all_0001-linux-stat.h-remove-__GLIBC__-checks.patch b/5.4/00_all_0001-linux-stat.h-remove-__GLIBC__-checks.patch
new file mode 100644
index 0000000..24a4199
--- /dev/null
+++ b/5.4/00_all_0001-linux-stat.h-remove-__GLIBC__-checks.patch
@@ -0,0 +1,28 @@
+From 1f4498530090a5fe7f6b2c46f2beb8818d7cb27b Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 29 Dec 2008 06:52:59 -0500
+Subject: [PATCH] linux/stat.h: remove __GLIBC__ checks
+
+Only check __KERNEL__ so we don't assume the C library is glibc.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ include/uapi/linux/stat.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
+index 7b35e98d3c58..eb7474652d27 100644
+--- a/include/uapi/linux/stat.h
++++ b/include/uapi/linux/stat.h
+@@ -4,7 +4,7 @@
+
+ #include <linux/types.h>
+
+-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
++#if defined(__KERNEL__)
+
+ #define S_IFMT 00170000
+ #define S_IFSOCK 0140000
+--
+2.16.1
+
diff --git a/5.4/00_all_0002-netfilter-pull-in-limits.h.patch b/5.4/00_all_0002-netfilter-pull-in-limits.h.patch
new file mode 100644
index 0000000..9b5b2c0
--- /dev/null
+++ b/5.4/00_all_0002-netfilter-pull-in-limits.h.patch
@@ -0,0 +1,28 @@
+From 0e43763b07e10e2c3cb517349ac2d541bcb62e5a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 9 May 2009 17:30:35 -0400
+Subject: [PATCH] netfilter: pull in limits.h
+
+A few netfilter sub-headers use INT_MAX which is in limits.h.
+
+URL: http://bugs.gentoo.org/246160
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ include/uapi/linux/netfilter.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/uapi/linux/netfilter.h b/include/uapi/linux/netfilter.h
+index cca10e767cd8..de6d76399cd7 100644
+--- a/include/uapi/linux/netfilter.h
++++ b/include/uapi/linux/netfilter.h
+@@ -6,6 +6,7 @@
+ #include <linux/compiler.h>
+ #include <linux/in.h>
+ #include <linux/in6.h>
++#include <limits.h>
+
+ /* Responses from hook functions. */
+ #define NF_DROP 0
+--
+2.16.1
+
diff --git a/5.4/00_all_0003-convert-PAGE_SIZE-usage.patch b/5.4/00_all_0003-convert-PAGE_SIZE-usage.patch
new file mode 100644
index 0000000..fbc2c45
--- /dev/null
+++ b/5.4/00_all_0003-convert-PAGE_SIZE-usage.patch
@@ -0,0 +1,54 @@
+From 25f2bcfa6c8a9e7cee2b92a823495479fe0ccc92 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 13 Feb 2010 03:09:23 -0500
+Subject: [PATCH] convert PAGE_SIZE usage
+
+The size of a page may change at runtime or based on kernel settings, so
+a static value at compile time doesn't work. More importantly, no one
+exports PAGE_SIZE to user space anymore.
+
+URL: http://bugs.gentoo.org/301431
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ include/uapi/linux/binfmts.h | 3 ++-
+ include/uapi/linux/resource.h | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h
+index 4abad03a8853..3e98cfc84d1c 100644
+--- a/include/uapi/linux/binfmts.h
++++ b/include/uapi/linux/binfmts.h
+@@ -2,6 +2,7 @@
+ #ifndef _UAPI_LINUX_BINFMTS_H
+ #define _UAPI_LINUX_BINFMTS_H
+
++#include <unistd.h>
+ #include <linux/capability.h>
+
+ struct pt_regs;
+@@ -12,7 +13,7 @@ struct pt_regs;
+ * prevent the kernel from being unduly impacted by misaddressed pointers.
+ * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
+ */
+-#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
++#define MAX_ARG_STRLEN (sysconf(_SC_PAGESIZE) * 32)
+ #define MAX_ARG_STRINGS 0x7FFFFFFF
+
+ /* sizeof(linux_binprm->buf) */
+diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h
+index cc00fd079631..6f9e76f513b5 100644
+--- a/include/uapi/linux/resource.h
++++ b/include/uapi/linux/resource.h
+@@ -69,7 +69,8 @@ struct rlimit64 {
+ * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
+ * and other sensitive information are never written to disk.
+ */
+-#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
++/* No one currently defines PAGE_SIZE bigger than 64kB */
++#define MLOCK_LIMIT (64 * 1024)
+
+ /*
+ * Due to binary compatibility, the actual resource numbers
+--
+2.16.1
+
diff --git a/5.4/00_all_0004-asm-generic-fcntl.h-namespace-kernel-file-structs.patch b/5.4/00_all_0004-asm-generic-fcntl.h-namespace-kernel-file-structs.patch
new file mode 100644
index 0000000..625fb6e
--- /dev/null
+++ b/5.4/00_all_0004-asm-generic-fcntl.h-namespace-kernel-file-structs.patch
@@ -0,0 +1,54 @@
+From 091dfce6aed898f4bc4eaca0edab942dd03b8016 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 29 Dec 2008 07:39:14 -0500
+Subject: [PATCH] asm-generic/fcntl.h: namespace kernel file structs
+
+No one should be using these structs, but just in case they are,
+keep them available in the __kernel_ namespace.
+
+Otherwise, trying to include something like:
+ #include <fcntl.h>
+ #include <linux/inotify.h>
+leads to horrible failure.
+
+URL: http://bugs.gentoo.org/244470
+URL: http://bugs.gentoo.org/388633
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ include/uapi/asm-generic/fcntl.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
+index 9dc0bf0c5a6e..dc9b2e467ad9 100644
+--- a/include/uapi/asm-generic/fcntl.h
++++ b/include/uapi/asm-generic/fcntl.h
+@@ -153,7 +153,7 @@
+ #define F_OWNER_PID 1
+ #define F_OWNER_PGRP 2
+
+-struct f_owner_ex {
++struct __kernel_f_owner_ex {
+ int type;
+ __kernel_pid_t pid;
+ };
+@@ -193,7 +193,7 @@ struct f_owner_ex {
+ #define __ARCH_FLOCK_PAD
+ #endif
+
+-struct flock {
++struct __kernel_flock {
+ short l_type;
+ short l_whence;
+ __kernel_off_t l_start;
+@@ -208,7 +208,7 @@ struct flock {
+ #define __ARCH_FLOCK64_PAD
+ #endif
+
+-struct flock64 {
++struct __kernel_flock64 {
+ short l_type;
+ short l_whence;
+ __kernel_loff_t l_start;
+--
+2.16.1
+
diff --git a/5.4/00_all_0005-unifdef-drop-unused-errno.h-include.patch b/5.4/00_all_0005-unifdef-drop-unused-errno.h-include.patch
new file mode 100644
index 0000000..617eb9a
--- /dev/null
+++ b/5.4/00_all_0005-unifdef-drop-unused-errno.h-include.patch
@@ -0,0 +1,32 @@
+From c4d1a109c5c0b1bd27d2b5448a1306a2f6005339 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 6 Dec 2011 17:22:42 -0500
+Subject: [PATCH] unifdef: drop unused errno.h include
+
+This is the only header on my system that ends up requiring kernel
+headers, so if the kernel headers aren't available, we end up being
+unable to install kernel headers :).
+
+Since this file doesn't actually use anything from errno.h, drop
+the include so it at least makes us a bit more robust on glibc.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ scripts/unifdef.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/scripts/unifdef.c b/scripts/unifdef.c
+index 7493c0ee51cc..c5dfae538b08 100644
+--- a/scripts/unifdef.c
++++ b/scripts/unifdef.c
+@@ -48,7 +48,6 @@
+
+ #include <ctype.h>
+ #include <err.h>
+-#include <errno.h>
+ #include <stdarg.h>
+ #include <stdbool.h>
+ #include <stdio.h>
+--
+2.16.1
+
--git a/5.4/00_all_0006-x86-do-not-build-relocs-tool-when-installing-headers.patch b/5.4/00_all_0006-x86-do-not-build-relocs-tool-when-installing-headers.patch
new file mode 100644
index 0000000..c4af343
--- /dev/null
+++ b/5.4/00_all_0006-x86-do-not-build-relocs-tool-when-installing-headers.patch
@@ -0,0 +1,33 @@
+From 57875de37c5375ea95e1e949ec7c741d0038d3a1 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 15 Nov 2014 03:37:38 -0500
+Subject: [PATCH] x86: do not build relocs tool when installing headers
+
+This isn't needed to install headers, so don't bother building it.
+Otherwise we run into a chicken/egg issue where we need the kernel
+headers in order to install the kernel headers. It's also a waste
+of time.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ arch/x86/Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/x86/Makefile b/arch/x86/Makefile
+index 60135cbd905c..9b15b2daa77f 100644
+--- a/arch/x86/Makefile
++++ b/arch/x86/Makefile
+@@ -249,8 +249,10 @@ ifneq ($(RETPOLINE_CFLAGS),)
+ endif
+ endif
+
++ifneq ($(filter-out headers_install,$(MAKECMDGOALS)),)
+ archscripts: scripts_basic
+ $(Q)$(MAKE) $(build)=arch/x86/tools relocs
++endif
+
+ ###
+ # Syscall table generation
+--
+2.16.1
+
diff --git a/5.4/00_all_0007-netlink-drop-int-cast-on-length-arg-in-NLMSG_OK.patch b/5.4/00_all_0007-netlink-drop-int-cast-on-length-arg-in-NLMSG_OK.patch
new file mode 100644
index 0000000..1fed99d
--- /dev/null
+++ b/5.4/00_all_0007-netlink-drop-int-cast-on-length-arg-in-NLMSG_OK.patch
@@ -0,0 +1,43 @@
+From cb87a9562cca933c97a482f09a36542b876608e8 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 5 Mar 2015 00:26:58 -0500
+Subject: [PATCH] netlink: drop (int) cast on length arg in NLMSG_OK
+
+The NLMSG_OK macro compares three things:
+ - the len arg from the user
+ - a size_t: sizeof(struct nlmsghdr)
+ - an int: sizeof(struct nlmsghdr) casted
+ - an u32: the nlmsghdr->nlmsg_len member
+
+When building with -Wsign-compare, this macro triggers a signed compare
+warning. This is because it compares len to an int, and then compares
+it to a u32. If len is signed, we get a warning due to the last test.
+If len is unsigned, we get a warning due to the first test. Like in
+strace:
+socketutils.c:145:8: warning: comparison between signed and unsigned
+ integer expressions [-Wsign-compare]
+
+Lets drop the int cast on the first sizeof. This way, once the user
+casts len to an unsigned value, everything shakes out correctly.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ include/uapi/linux/netlink.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
+index 776bc92e9118..d0c4df5fa670 100644
+--- a/include/uapi/linux/netlink.h
++++ b/include/uapi/linux/netlink.h
+@@ -94,7 +94,7 @@ struct nlmsghdr {
+ #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
+ #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
+ (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
+-#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
++#define NLMSG_OK(nlh,len) ((len) >= sizeof(struct nlmsghdr) && \
+ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
+ (nlh)->nlmsg_len <= (len))
+ #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
+--
+2.16.1
+
--git a/5.4/00_all_0008-uapi-fix-System-V-buf-header-includes.patch b/5.4/00_all_0008-uapi-fix-System-V-buf-header-includes.patch
new file mode 100644
index 0000000..fce1944
--- /dev/null
+++ b/5.4/00_all_0008-uapi-fix-System-V-buf-header-includes.patch
@@ -0,0 +1,76 @@
+From beac664726b0b5b5c833aaf6576ca583534406ba Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 2 Nov 2015 13:30:12 -0500
+Subject: [PATCH] uapi: fix System V buf header includes
+
+These headers rely on kernel types but don't include the other headers
+that define them. So when you try to include them directly, you often
+hit build failures due to unknown types.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ include/uapi/asm-generic/ipcbuf.h | 2 ++
+ include/uapi/asm-generic/msgbuf.h | 3 +++
+ include/uapi/asm-generic/sembuf.h | 2 ++
+ include/uapi/asm-generic/shmbuf.h | 2 ++
+ 4 files changed, 9 insertions(+)
+
+diff --git a/include/uapi/asm-generic/ipcbuf.h b/include/uapi/asm-generic/ipcbuf.h
+index 7d80dbd336fb..b4534bfd63e4 100644
+--- a/include/uapi/asm-generic/ipcbuf.h
++++ b/include/uapi/asm-generic/ipcbuf.h
+@@ -2,6 +2,8 @@
+ #ifndef __ASM_GENERIC_IPCBUF_H
+ #define __ASM_GENERIC_IPCBUF_H
+
++#include <linux/types.h>
++
+ /*
+ * The generic ipc64_perm structure:
+ * Note extra padding because this structure is passed back and forth
+diff --git a/include/uapi/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h
+index fb306ebdb36f..f28b8e6fe931 100644
+--- a/include/uapi/asm-generic/msgbuf.h
++++ b/include/uapi/asm-generic/msgbuf.h
+@@ -2,7 +2,10 @@
+ #ifndef __ASM_GENERIC_MSGBUF_H
+ #define __ASM_GENERIC_MSGBUF_H
+
++#include <linux/types.h>
+ #include <asm/bitsperlong.h>
++#include <asm/ipcbuf.h>
++
+ /*
+ * generic msqid64_ds structure.
+ *
+diff --git a/include/uapi/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h
+index cbf9cfe977d6..3058e1ec00b5 100644
+--- a/include/uapi/asm-generic/sembuf.h
++++ b/include/uapi/asm-generic/sembuf.h
+@@ -2,7 +2,9 @@
+ #ifndef __ASM_GENERIC_SEMBUF_H
+ #define __ASM_GENERIC_SEMBUF_H
+
++#include <linux/types.h>
+ #include <asm/bitsperlong.h>
++#include <asm/ipcbuf.h>
+
+ /*
+ * The semid64_ds structure for x86 architecture.
+diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
+index 2b6c3bb97f97..a0171147d796 100644
+--- a/include/uapi/asm-generic/shmbuf.h
++++ b/include/uapi/asm-generic/shmbuf.h
+@@ -2,7 +2,9 @@
+ #ifndef __ASM_GENERIC_SHMBUF_H
+ #define __ASM_GENERIC_SHMBUF_H
+
++#include <linux/types.h>
+ #include <asm/bitsperlong.h>
++#include <asm/ipcbuf.h>
+
+ /*
+ * The shmid64_ds structure for x86 architecture.
+--
+2.16.1
+
diff --git a/5.4/00_all_0009_glibc-specific-inclusion-of-sysinfo.h-in-kernel.h.patch b/5.4/00_all_0009_glibc-specific-inclusion-of-sysinfo.h-in-kernel.h.patch
new file mode 100644
index 0000000..df075dc
--- /dev/null
+++ b/5.4/00_all_0009_glibc-specific-inclusion-of-sysinfo.h-in-kernel.h.patch
@@ -0,0 +1,46 @@
+https://lore.kernel.org/patchwork/patch/449607/
+https://gitweb.gentoo.org/proj/musl.git/tree/sys-kernel/linux-headers/files/libc-5.1-remove-sysinfo_h-from-kernel_h.patch
+
+Date: Fri, 14 Mar 2014 17:14:10 +0100
+From: David Heidelberger <david.heidelberger@ixit.cz>
+To: linux-kernel@vger.kernel.org
+Cc: maillist-linux@barfooze.de, torvalds@linux-foundation.org
+Subject: [PATCH 1/4] glibc specific inclusion of sysinfo.h in kernel.h
+Message-ID: <130a9e0c237bae10e631a5ae52c5e2c8@ixit.cz>
+User-Agent: Roundcube Webmail/0.9.5
+Sender: linux-kernel-owner@vger.kernel.org
+List-ID: <linux-kernel.vger.kernel.org>
+X-Mailing-List: linux-kernel@vger.kernel.org
+
+including sysinfo.h from kernel.h makes no sense whatsoever,
+but removing it breaks glibc's userspace header,
+which includes kernel.h instead of sysinfo.h from their sys/sysinfo.h.
+this seems to be a historical mistake.
+on musl, including any header that uses kernel.h directly or indirectly
+plus sys/sysinfo.h will produce a compile error due to redefinition of
+struct sysinfo.h.
+so for now, only include it on glibc in order not to break their
+headers.
+
+Signed-off-by: John Spencer <maillist-linux@barfooze.de>
+Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
+---
+ include/uapi/linux/kernel.h | 2 ++
+ 1 file changed, 2 insertion(+)
+
+ */
+
+diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
+index 321e399..8c45eeb 100644
+--- a/include/uapi/linux/kernel.h
++++ b/include/uapi/linux/kernel.h
+@@ -1,7 +1,9 @@
+ #ifndef _UAPI_LINUX_KERNEL_H
+ #define _UAPI_LINUX_KERNEL_H
+
++#ifdef __GLIBC__
+ #include <linux/sysinfo.h>
++#endif
+
+ /*
+ * 'kernel.h' contains some often-used function prototypes etc
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-08 21:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-08 21:59 [gentoo-commits] proj/toolchain/linux-headers-patches:master commit in: 5.4/ Sergei Trofimovich
-- strict thread matches above, loose matches on Subject: below --
2019-12-08 11:25 Sergei Trofimovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox