mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 00/25] Update for linux v4.14 and v4.15
@ 2018-02-07  1:10 Szabolcs Nagy
  2018-02-08 18:25 ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2018-02-07  1:10 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2881 bytes --]

includes v4.14 patches from
http://www.openwall.com/lists/musl/2017/11/27/2
and cosmetic bits/termios.h fix from
http://www.openwall.com/lists/musl/2017/11/27/3
and a number of elf.h updates.

build tested on most targets.

last patch is aarch64 sve sigcontext stuff, which is a bit ugly to
copy into musl headers, but requiring linux asm/sigcontext.h for
that does not work as it conflicts with musl signal.h

Szabolcs Nagy (25):
  sys/socket.h: add PF_SMC from linux v4.11
  sys/socket.h: add SOL_TLS from linux v4.13
  sys/socket.h: add MSG_ZEROCOPY from linux v4.14
  sys/mman.h: add MADV_WIPEONFORK from linux v4.14
  aarch64: add HWCAP_DCPOP from linux v4.14
  signal.h: add missing SIGTRAP and SIGSYS si_codes
  net/if_arp.h: add ARPHRD_RAWIP from linux v4.14
  netinet/if_ether.h: add new ETH_P_ macros from linux v4.14
  sys/{mman,shm}.h: add {MAP,SHM}_HUGE_ macros from linux uapi
  netinet/tcp.h: add tcp_diag_md5sig struct from linux v4.14
  mips,powerpc: fix TIOCSER_TEMT in termios.h
  add MAP_SYNC and MAP_SHARED_VALIDATE from linux v4.15
  netinet/tcp.h: add TCP_* socket options from linux v4.15
  netinet/in.h: add new IPV6_FREEBIND from linux v4.15
  s390x: add s390_sthyi system call from v4.15
  powerpc: update hwcap.h for linux v4.15
  arm: add get_tls syscall from linux v4.15
  aarch64: update hwcap.h for linux v4.15
  sys/prctl.h: add new PR_SVE_* macros from linux v4.15
  elf.h: add AT_* auxval macros for cache geometry
  elf.h: add PPC64_OPT_LOCALENTRY
  elf.h: update NT_* coredump elf notes for linux v4.15
  elf.h: syncronize DF_1_ flags with binutils
  elf.h: add DT_SYMTAB_SHNDX
  aarch64: add sve_context struct and related defines from linux v4.15

 arch/aarch64/bits/hwcap.h     |  7 +++++++
 arch/aarch64/bits/signal.h    | 39 +++++++++++++++++++++++++++++++++++++++
 arch/arm/bits/syscall.h.in    |  1 +
 arch/mips/bits/mman.h         |  1 +
 arch/mips/bits/termios.h      |  2 +-
 arch/mips64/bits/mman.h       |  1 +
 arch/mips64/bits/termios.h    |  2 +-
 arch/mipsn32/bits/mman.h      |  1 +
 arch/mipsn32/bits/termios.h   |  2 +-
 arch/powerpc/bits/hwcap.h     |  3 +++
 arch/powerpc/bits/mman.h      |  1 +
 arch/powerpc/bits/termios.h   |  2 +-
 arch/powerpc64/bits/hwcap.h   |  3 +++
 arch/powerpc64/bits/mman.h    |  1 +
 arch/powerpc64/bits/termios.h |  2 +-
 arch/s390x/bits/syscall.h.in  |  1 +
 include/elf.h                 | 35 ++++++++++++++++++++++++++++++++++-
 include/net/if_arp.h          |  1 +
 include/netinet/if_ether.h    |  4 ++++
 include/netinet/in.h          |  1 +
 include/netinet/tcp.h         | 10 ++++++++++
 include/signal.h              |  3 +++
 include/sys/mman.h            | 17 +++++++++++++++++
 include/sys/prctl.h           |  6 ++++++
 include/sys/shm.h             | 13 +++++++++++++
 include/sys/socket.h          |  7 ++++++-
 26 files changed, 159 insertions(+), 7 deletions(-)

-- 
2.15.0


[-- Attachment #2: 0001-sys-socket.h-add-PF_SMC-from-linux-v4.11.patch --]
[-- Type: text/x-diff, Size: 1147 bytes --]

From 4a2eb90a22184af0cfea6cb1380e36d3f46c5d30 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 22:21:31 +0000
Subject: [PATCH 01/25] sys/socket.h: add PF_SMC from linux v4.11

add AF_SMC and PF_SMC for the IBM shared memory communication protocol.
new in linux commit ac7138746e14137a451f8539614cdd349153e0c0
(linux socket.h is not in uapi so this update was missed earlier)
---
 include/sys/socket.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/sys/socket.h b/include/sys/socket.h
index 051d20e0..396a47ad 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -108,7 +108,8 @@ struct linger {
 #define PF_VSOCK        40
 #define PF_KCM          41
 #define PF_QIPCRTR      42
-#define PF_MAX          43
+#define PF_SMC          43
+#define PF_MAX          44
 
 #define AF_UNSPEC       PF_UNSPEC
 #define AF_LOCAL        PF_LOCAL
@@ -156,6 +157,7 @@ struct linger {
 #define AF_VSOCK        PF_VSOCK
 #define AF_KCM          PF_KCM
 #define AF_QIPCRTR      PF_QIPCRTR
+#define AF_SMC          PF_SMC
 #define AF_MAX          PF_MAX
 
 #ifndef SO_DEBUG
-- 
2.15.0


[-- Attachment #3: 0002-sys-socket.h-add-SOL_TLS-from-linux-v4.13.patch --]
[-- Type: text/x-diff, Size: 716 bytes --]

From bc409ceb97f2c5afdcc04659820e48e1f2b57c12 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 22:34:31 +0000
Subject: [PATCH 02/25] sys/socket.h: add SOL_TLS from linux v4.13

socket option for kernel TLS support
new in linux commit 3c4d7559159bfe1e3b94df3a657b2cda3a34e218
---
 include/sys/socket.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/sys/socket.h b/include/sys/socket.h
index 396a47ad..26d16bdf 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -263,6 +263,7 @@ struct linger {
 #define SOL_ALG         279
 #define SOL_NFC         280
 #define SOL_KCM         281
+#define SOL_TLS         282
 
 #define SOMAXCONN       128
 
-- 
2.15.0


[-- Attachment #4: 0003-sys-socket.h-add-MSG_ZEROCOPY-from-linux-v4.14.patch --]
[-- Type: text/x-diff, Size: 1142 bytes --]

From d776f9981e6b849df74ea78b3eb47c9834bd4153 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 22:53:48 +0000
Subject: [PATCH 03/25] sys/socket.h: add MSG_ZEROCOPY from linux v4.14

MSG_ZEROCOPY socket send flag avoids copy in the kernel
new in linux commit 52267790ef52d7513879238ca9fac22c1733e0e3
SO_ZEROCOPY socket option enables MSG_ZEROCOPY if availale
new in linux commit 76851d1212c11365362525e1e2c0a18c97478e6b
---
 include/sys/socket.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/sys/socket.h b/include/sys/socket.h
index 26d16bdf..507da5cc 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -232,6 +232,7 @@ struct linger {
 #define SO_COOKIE               57
 #define SCM_TIMESTAMPING_PKTINFO 58
 #define SO_PEERGROUPS           59
+#define SO_ZEROCOPY             60
 
 #ifndef SOL_SOCKET
 #define SOL_SOCKET      1
@@ -285,6 +286,7 @@ struct linger {
 #define MSG_MORE      0x8000
 #define MSG_WAITFORONE 0x10000
 #define MSG_BATCH     0x40000
+#define MSG_ZEROCOPY  0x4000000
 #define MSG_FASTOPEN  0x20000000
 #define MSG_CMSG_CLOEXEC 0x40000000
 
-- 
2.15.0


[-- Attachment #5: 0004-sys-mman.h-add-MADV_WIPEONFORK-from-linux-v4.14.patch --]
[-- Type: text/x-diff, Size: 806 bytes --]

From d2aa0ec81d836a56d996c79644df47535fa17598 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 21:54:30 +0000
Subject: [PATCH 04/25] sys/mman.h: add MADV_WIPEONFORK from linux v4.14

allows zeroing anonymous private pages inherited by a child process.
new in linux commit d2cd9ede6e193dd7d88b6d27399e96229a551b19
---
 include/sys/mman.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/sys/mman.h b/include/sys/mman.h
index 8a5149c9..12318782 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -72,6 +72,8 @@ extern "C" {
 #define MADV_NOHUGEPAGE  15
 #define MADV_DONTDUMP    16
 #define MADV_DODUMP      17
+#define MADV_WIPEONFORK  18
+#define MADV_KEEPONFORK  19
 #define MADV_HWPOISON    100
 #define MADV_SOFT_OFFLINE 101
 #endif
-- 
2.15.0


[-- Attachment #6: 0005-aarch64-add-HWCAP_DCPOP-from-linux-v4.14.patch --]
[-- Type: text/x-diff, Size: 724 bytes --]

From 56156fc2525570c381ec89f3c49f7af30b340b62 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 23:05:45 +0000
Subject: [PATCH 05/25] aarch64: add HWCAP_DCPOP from linux v4.14

indicates ARMv8.2-DCPoP persistent memory support extension.
new in linux commit 7aac405ebb3224037efd56b73d82d181111cdac3
---
 arch/aarch64/bits/hwcap.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/aarch64/bits/hwcap.h b/arch/aarch64/bits/hwcap.h
index 11396d31..87f71ff3 100644
--- a/arch/aarch64/bits/hwcap.h
+++ b/arch/aarch64/bits/hwcap.h
@@ -14,3 +14,4 @@
 #define HWCAP_JSCVT		(1 << 13)
 #define HWCAP_FCMA		(1 << 14)
 #define HWCAP_LRCPC		(1 << 15)
+#define HWCAP_DCPOP		(1 << 16)
-- 
2.15.0


[-- Attachment #7: 0006-signal.h-add-missing-SIGTRAP-and-SIGSYS-si_codes.patch --]
[-- Type: text/x-diff, Size: 1042 bytes --]

From efd536020b2c739a843bd2eaa69697e4d896478b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 23:20:38 +0000
Subject: [PATCH 06/25] signal.h: add missing SIGTRAP and SIGSYS si_codes

SYS_SECCOMP new in commit a0727e8ce513fe6890416da960181ceb10fbfae6
TRAP_BRANCH and TRAP_HWBKPT new in commit
da654b74bda14c45a7d98c731bf3c1a43b6b74e2
---
 include/signal.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/signal.h b/include/signal.h
index 2c8b3d55..1db5af5f 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -231,6 +231,8 @@ int sigrelse(int);
 void (*sigset(int, void (*)(int)))(int);
 #define TRAP_BRKPT 1
 #define TRAP_TRACE 2
+#define TRAP_BRANCH 3
+#define TRAP_HWBKPT 4
 #define POLL_IN 1
 #define POLL_OUT 2
 #define POLL_MSG 3
@@ -241,6 +243,7 @@ void (*sigset(int, void (*)(int)))(int);
 #define SS_DISABLE    2
 #define SS_AUTODISARM (1U << 31)
 #define SS_FLAG_BITS SS_AUTODISARM
+#define SYS_SECCOMP 1
 #endif
 
 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
-- 
2.15.0


[-- Attachment #8: 0007-net-if_arp.h-add-ARPHRD_RAWIP-from-linux-v4.14.patch --]
[-- Type: text/x-diff, Size: 696 bytes --]

From 77bb8474331b913451b4f94e62173f2fea0d94f5 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 23:26:26 +0000
Subject: [PATCH 07/25] net/if_arp.h: add ARPHRD_RAWIP from linux v4.14

new in linux commmit cdf4969c42a6c1a376dd03a9e846cf638d3cd4b1
---
 include/net/if_arp.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/if_arp.h b/include/net/if_arp.h
index c832ff95..27becc83 100644
--- a/include/net/if_arp.h
+++ b/include/net/if_arp.h
@@ -59,6 +59,7 @@ struct arphdr {
 #define ARPHRD_LAPB	516
 #define ARPHRD_DDCMP	517
 #define	ARPHRD_RAWHDLC	518
+#define ARPHRD_RAWIP	519
 
 #define ARPHRD_TUNNEL	768
 #define ARPHRD_TUNNEL6	769
-- 
2.15.0


[-- Attachment #9: 0008-netinet-if_ether.h-add-new-ETH_P_-macros-from-linux-.patch --]
[-- Type: text/x-diff, Size: 1506 bytes --]

From e5ddeede0b2651aad59539a6f41bb08225d209ec Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 23:36:17 +0000
Subject: [PATCH 08/25] netinet/if_ether.h: add new ETH_P_ macros from linux
 v4.14

new ethertypes in linux v4.14:
ETH_P_ERSPAN new in 84e54fe0a5eaed696dee4019c396f8396f5a908b
ETH_P_IFE new in 2804fd3af6ba5ae5737705b27146455eabe2e2f8
ETH_P_NSH new in 155e6f649757c902901e599c268f8b575ddac1f8
ETH_P_MAP new in 7373ae7e8f0bf2c0718422481da986db5058b005
---
 include/netinet/if_ether.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
index d9a131aa..67d32734 100644
--- a/include/netinet/if_ether.h
+++ b/include/netinet/if_ether.h
@@ -53,6 +53,7 @@
 #define ETH_P_AOE	0x88A2
 #define ETH_P_8021AD	0x88A8
 #define ETH_P_802_EX1	0x88B5
+#define ETH_P_ERSPAN	0x88BE
 #define ETH_P_TIPC	0x88CA
 #define ETH_P_MACSEC	0x88E5
 #define ETH_P_8021AH	0x88E7
@@ -66,11 +67,13 @@
 #define ETH_P_IBOE	0x8915
 #define ETH_P_80221	0x8917
 #define ETH_P_HSR	0x892F
+#define ETH_P_NSH	0x894F
 #define ETH_P_LOOPBACK	0x9000
 #define ETH_P_QINQ1	0x9100
 #define ETH_P_QINQ2	0x9200
 #define ETH_P_QINQ3	0x9300
 #define ETH_P_EDSA	0xDADA
+#define ETH_P_IFE	0xED3E
 #define ETH_P_AF_IUCV	0xFBFB
 
 #define ETH_P_802_3_MIN	0x0600
@@ -100,6 +103,7 @@
 #define ETH_P_IEEE802154 0x00F6
 #define ETH_P_CAIF	0x00F7
 #define ETH_P_XDSA	0x00F8
+#define ETH_P_MAP	0x00F9
 
 struct ethhdr {
 	uint8_t h_dest[ETH_ALEN];
-- 
2.15.0


[-- Attachment #10: 0009-sys-mman-shm-.h-add-MAP-SHM-_HUGE_-macros-from-linux.patch --]
[-- Type: text/x-diff, Size: 2236 bytes --]

From 0bfeb4f4e717349eaf473e08bc5998958cfc0b33 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sun, 26 Nov 2017 23:58:25 +0000
Subject: [PATCH 09/25] sys/{mman,shm}.h: add {MAP,SHM}_HUGE_ macros from linux
 uapi

*_HUGE_SHIFT, *_HUGE_2MB, *_HUGE_1GB are documented in the man page,
so add all of the *_HUGE_* macros from linux uapi.

if MAP_HUGETLB is set, top bits of the mmap flags encode the page size.
see the linux commit aafd4562dfee81a40ba21b5ea3cf5e06664bc7f6

if SHM_HUGETLB is set, top bits of the shmget flags encode the page size.
see the linux commit 4da243ac1cf6aeb30b7c555d56208982d66d6d33

*_HUGE_16GB is defined unsigned to avoid signed left shift ub.
---
 include/sys/mman.h | 13 +++++++++++++
 include/sys/shm.h  | 13 +++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/include/sys/mman.h b/include/sys/mman.h
index 12318782..d13d4ca3 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -35,6 +35,19 @@ extern "C" {
 #define MAP_HUGETLB    0x40000
 #define MAP_FILE       0
 
+#define MAP_HUGE_SHIFT 26
+#define MAP_HUGE_MASK  0x3f
+#define MAP_HUGE_64KB  (16 << 26)
+#define MAP_HUGE_512KB (19 << 26)
+#define MAP_HUGE_1MB   (20 << 26)
+#define MAP_HUGE_2MB   (21 << 26)
+#define MAP_HUGE_8MB   (23 << 26)
+#define MAP_HUGE_16MB  (24 << 26)
+#define MAP_HUGE_256MB (28 << 26)
+#define MAP_HUGE_1GB   (30 << 26)
+#define MAP_HUGE_2GB   (31 << 26)
+#define MAP_HUGE_16GB  (34U << 26)
+
 #define PROT_NONE      0
 #define PROT_READ      1
 #define PROT_WRITE     2
diff --git a/include/sys/shm.h b/include/sys/shm.h
index 67be822b..e7d39ff6 100644
--- a/include/sys/shm.h
+++ b/include/sys/shm.h
@@ -40,6 +40,19 @@ extern "C" {
 #define SHM_HUGETLB 04000
 #define SHM_NORESERVE 010000
 
+#define SHM_HUGE_SHIFT 26
+#define SHM_HUGE_MASK  0x3f
+#define SHM_HUGE_64KB  (16 << 26)
+#define SHM_HUGE_512KB (19 << 26)
+#define SHM_HUGE_1MB   (20 << 26)
+#define SHM_HUGE_2MB   (21 << 26)
+#define SHM_HUGE_8MB   (23 << 26)
+#define SHM_HUGE_16MB  (24 << 26)
+#define SHM_HUGE_256MB (28 << 26)
+#define SHM_HUGE_1GB   (30 << 26)
+#define SHM_HUGE_2GB   (31 << 26)
+#define SHM_HUGE_16GB  (34U << 26)
+
 typedef unsigned long shmatt_t;
 
 void *shmat(int, const void *, int);
-- 
2.15.0


[-- Attachment #11: 0010-netinet-tcp.h-add-tcp_diag_md5sig-struct-from-linux-.patch --]
[-- Type: text/x-diff, Size: 888 bytes --]

From 0a673a1311ee93658009e89e4f72a0af3cafc72f Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Mon, 27 Nov 2017 00:22:01 +0000
Subject: [PATCH 10/25] netinet/tcp.h: add tcp_diag_md5sig struct from linux
 v4.14

for querying tcp md5 signing keys.
new in linux commit c03fa9bcacd9ac04595cc13f34f3445f0a5ecf13
---
 include/netinet/tcp.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 4d20936a..94a4f8e2 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -220,6 +220,14 @@ struct tcp_md5sig {
 	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
 };
 
+struct tcp_diag_md5sig {
+	uint8_t tcpm_family;
+	uint8_t tcpm_prefixlen;
+	uint16_t tcpm_keylen;
+	uint32_t tcpm_addr[4];
+	uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN];
+};
+
 struct tcp_repair_window {
 	uint32_t snd_wl1;
 	uint32_t snd_wnd;
-- 
2.15.0


[-- Attachment #12: 0011-mips-powerpc-fix-TIOCSER_TEMT-in-termios.h.patch --]
[-- Type: text/x-diff, Size: 2215 bytes --]

From 31fa6c64b68ade971dc87eba260b15d50329482b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Mon, 27 Nov 2017 01:16:14 +0000
Subject: [PATCH 11/25] mips,powerpc: fix TIOCSER_TEMT in termios.h

use the same token to define TIOCSER_TEMT as is used in ioctl.h
so when both headers are included there are no redefinition warnings
during musl build.
---
 arch/mips/bits/termios.h      | 2 +-
 arch/mips64/bits/termios.h    | 2 +-
 arch/mipsn32/bits/termios.h   | 2 +-
 arch/powerpc/bits/termios.h   | 2 +-
 arch/powerpc64/bits/termios.h | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/bits/termios.h b/arch/mips/bits/termios.h
index 6a1205d7..692e58be 100644
--- a/arch/mips/bits/termios.h
+++ b/arch/mips/bits/termios.h
@@ -163,5 +163,5 @@ struct termios {
 #define EXTPROC 0200000
 
 #define XTABS  0014000
-#define TIOCSER_TEMT 1
+#define TIOCSER_TEMT 0x01
 #endif
diff --git a/arch/mips64/bits/termios.h b/arch/mips64/bits/termios.h
index 6a1205d7..692e58be 100644
--- a/arch/mips64/bits/termios.h
+++ b/arch/mips64/bits/termios.h
@@ -163,5 +163,5 @@ struct termios {
 #define EXTPROC 0200000
 
 #define XTABS  0014000
-#define TIOCSER_TEMT 1
+#define TIOCSER_TEMT 0x01
 #endif
diff --git a/arch/mipsn32/bits/termios.h b/arch/mipsn32/bits/termios.h
index 6a1205d7..692e58be 100644
--- a/arch/mipsn32/bits/termios.h
+++ b/arch/mipsn32/bits/termios.h
@@ -163,5 +163,5 @@ struct termios {
 #define EXTPROC 0200000
 
 #define XTABS  0014000
-#define TIOCSER_TEMT 1
+#define TIOCSER_TEMT 0x01
 #endif
diff --git a/arch/powerpc/bits/termios.h b/arch/powerpc/bits/termios.h
index 0b09630c..5c2f6bfb 100644
--- a/arch/powerpc/bits/termios.h
+++ b/arch/powerpc/bits/termios.h
@@ -165,5 +165,5 @@ struct termios {
 #define EXTPROC 0x10000000
 
 #define XTABS   00006000
-#define TIOCSER_TEMT 1
+#define TIOCSER_TEMT 0x01
 #endif
diff --git a/arch/powerpc64/bits/termios.h b/arch/powerpc64/bits/termios.h
index 0b09630c..5c2f6bfb 100644
--- a/arch/powerpc64/bits/termios.h
+++ b/arch/powerpc64/bits/termios.h
@@ -165,5 +165,5 @@ struct termios {
 #define EXTPROC 0x10000000
 
 #define XTABS   00006000
-#define TIOCSER_TEMT 1
+#define TIOCSER_TEMT 0x01
 #endif
-- 
2.15.0


[-- Attachment #13: 0012-add-MAP_SYNC-and-MAP_SHARED_VALIDATE-from-linux-v4.1.patch --]
[-- Type: text/x-diff, Size: 3002 bytes --]

From 88d285105bfe57315d021c88abf98aba44b6b094 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:10:09 +0000
Subject: [PATCH 12/25] add MAP_SYNC and MAP_SHARED_VALIDATE from linux v4.15

for synchronous page faults, new in linux commit
1c9725974074a047f6080eecc62c50a8e840d050 and
b6fb293f2497a9841d94f6b57bd2bb2cd222da43
note that only targets that use asm-generic/mman.h have this new
flag defined, so undef it on other targets (mips*, powerpc*).
---
 arch/mips/bits/mman.h      | 1 +
 arch/mips64/bits/mman.h    | 1 +
 arch/mipsn32/bits/mman.h   | 1 +
 arch/powerpc/bits/mman.h   | 1 +
 arch/powerpc64/bits/mman.h | 1 +
 include/sys/mman.h         | 2 ++
 6 files changed, 7 insertions(+)

diff --git a/arch/mips/bits/mman.h b/arch/mips/bits/mman.h
index c68aea88..9027bb63 100644
--- a/arch/mips/bits/mman.h
+++ b/arch/mips/bits/mman.h
@@ -18,6 +18,7 @@
 #define MAP_STACK      0x40000
 #undef MAP_HUGETLB
 #define MAP_HUGETLB    0x80000
+#undef MAP_SYNC
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #undef MADV_SOFT_OFFLINE
diff --git a/arch/mips64/bits/mman.h b/arch/mips64/bits/mman.h
index c68aea88..9027bb63 100644
--- a/arch/mips64/bits/mman.h
+++ b/arch/mips64/bits/mman.h
@@ -18,6 +18,7 @@
 #define MAP_STACK      0x40000
 #undef MAP_HUGETLB
 #define MAP_HUGETLB    0x80000
+#undef MAP_SYNC
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #undef MADV_SOFT_OFFLINE
diff --git a/arch/mipsn32/bits/mman.h b/arch/mipsn32/bits/mman.h
index c68aea88..9027bb63 100644
--- a/arch/mipsn32/bits/mman.h
+++ b/arch/mipsn32/bits/mman.h
@@ -18,6 +18,7 @@
 #define MAP_STACK      0x40000
 #undef MAP_HUGETLB
 #define MAP_HUGETLB    0x80000
+#undef MAP_SYNC
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 #undef MADV_SOFT_OFFLINE
diff --git a/arch/powerpc/bits/mman.h b/arch/powerpc/bits/mman.h
index 95ec4358..b3a675a8 100644
--- a/arch/powerpc/bits/mman.h
+++ b/arch/powerpc/bits/mman.h
@@ -4,6 +4,7 @@
 #define MAP_NORESERVE   0x40
 #undef MAP_LOCKED
 #define MAP_LOCKED	0x80
+#undef MAP_SYNC
 
 #undef MCL_CURRENT
 #define MCL_CURRENT     0x2000
diff --git a/arch/powerpc64/bits/mman.h b/arch/powerpc64/bits/mman.h
index 95ec4358..b3a675a8 100644
--- a/arch/powerpc64/bits/mman.h
+++ b/arch/powerpc64/bits/mman.h
@@ -4,6 +4,7 @@
 #define MAP_NORESERVE   0x40
 #undef MAP_LOCKED
 #define MAP_LOCKED	0x80
+#undef MAP_SYNC
 
 #undef MCL_CURRENT
 #define MCL_CURRENT     0x2000
diff --git a/include/sys/mman.h b/include/sys/mman.h
index d13d4ca3..302ad134 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -20,6 +20,7 @@ extern "C" {
 
 #define MAP_SHARED     0x01
 #define MAP_PRIVATE    0x02
+#define MAP_SHARED_VALIDATE 0x03
 #define MAP_TYPE       0x0f
 #define MAP_FIXED      0x10
 #define MAP_ANON       0x20
@@ -33,6 +34,7 @@ extern "C" {
 #define MAP_NONBLOCK   0x10000
 #define MAP_STACK      0x20000
 #define MAP_HUGETLB    0x40000
+#define MAP_SYNC       0x80000
 #define MAP_FILE       0
 
 #define MAP_HUGE_SHIFT 26
-- 
2.15.0


[-- Attachment #14: 0013-netinet-tcp.h-add-TCP_-socket-options-from-linux-v4..patch --]
[-- Type: text/x-diff, Size: 827 bytes --]

From 2ca7d559c3edabe822504bc45ac075b854158c7c Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:19:46 +0000
Subject: [PATCH 13/25] netinet/tcp.h: add TCP_* socket options from linux
 v4.15

TCP_FASTOPEN_KEY is new in 1fba70e5b6bed53496ba1f1f16127f5be01b5fb6
TCP_FASTOPEN_NO_COOKIE is new in 71c02379c762cb616c00fd5c4ed253fbf6bbe11b
---
 include/netinet/tcp.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 94a4f8e2..2747f4ea 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -34,6 +34,8 @@
 #define TCP_FASTOPEN_CONNECT 30
 #define TCP_ULP          31
 #define TCP_MD5SIG_EXT   32
+#define TCP_FASTOPEN_KEY 33
+#define TCP_FASTOPEN_NO_COOKIE 34
 
 #define TCP_ESTABLISHED  1
 #define TCP_SYN_SENT     2
-- 
2.15.0


[-- Attachment #15: 0014-netinet-in.h-add-new-IPV6_FREEBIND-from-linux-v4.15.patch --]
[-- Type: text/x-diff, Size: 839 bytes --]

From ada2c154c752d7db97064bea24a29c91996eb80b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:23:04 +0000
Subject: [PATCH 14/25] netinet/in.h: add new IPV6_FREEBIND from linux v4.15

new socekt option for AF_INET6 SOL_RAW sockets, added in linux commit
84e14fe353de7624872e582887712079ba0b2d56
---
 include/netinet/in.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/netinet/in.h b/include/netinet/in.h
index f18b478d..192679a6 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -363,6 +363,7 @@ struct ip6_mtuinfo {
 #define IPV6_TRANSPARENT        75
 #define IPV6_UNICAST_IF         76
 #define IPV6_RECVFRAGSIZE       77
+#define IPV6_FREEBIND           78
 
 #define IPV6_ADD_MEMBERSHIP     IPV6_JOIN_GROUP
 #define IPV6_DROP_MEMBERSHIP    IPV6_LEAVE_GROUP
-- 
2.15.0


[-- Attachment #16: 0015-s390x-add-s390_sthyi-system-call-from-v4.15.patch --]
[-- Type: text/x-diff, Size: 772 bytes --]

From 4ee6f2a94b6510ea226c494af66ef642145b3adc Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:27:39 +0000
Subject: [PATCH 15/25] s390x: add s390_sthyi system call from v4.15

to store hypervisor information, added in linux commit
3d8757b87d7fc15a87928bc970f060bc9c6dc618
---
 arch/s390x/bits/syscall.h.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390x/bits/syscall.h.in b/arch/s390x/bits/syscall.h.in
index 4fe1a64f..c965664c 100644
--- a/arch/s390x/bits/syscall.h.in
+++ b/arch/s390x/bits/syscall.h.in
@@ -322,4 +322,5 @@
 #define __NR_pwritev2                   377
 #define __NR_s390_guarded_storage       378
 #define __NR_statx                      379
+#define __NR_s390_sthyi                 380
 
-- 
2.15.0


[-- Attachment #17: 0016-powerpc-update-hwcap.h-for-linux-v4.15.patch --]
[-- Type: text/x-diff, Size: 1418 bytes --]

From 4f0579b431a3aaf408eba6f2b8d6581129c35368 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:38:15 +0000
Subject: [PATCH 16/25] powerpc: update hwcap.h for linux v4.15

PPC_FEATURE2_HTM_NO_SUSPEND is new in linux commit
cba6ac4869e45cc93ac5497024d1d49576e82666
PPC_FEATURE2_DARN and PPC_FEATURE2_SCV were new in v4.12 in commit
a4700a26107241cc7b9ac8528b2c6714ff99983d
---
 arch/powerpc/bits/hwcap.h   | 3 +++
 arch/powerpc64/bits/hwcap.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/arch/powerpc/bits/hwcap.h b/arch/powerpc/bits/hwcap.h
index 82c92a93..803de9b5 100644
--- a/arch/powerpc/bits/hwcap.h
+++ b/arch/powerpc/bits/hwcap.h
@@ -38,3 +38,6 @@
 #define PPC_FEATURE2_HTM_NOSC		0x01000000
 #define PPC_FEATURE2_ARCH_3_00		0x00800000
 #define PPC_FEATURE2_HAS_IEEE128	0x00400000
+#define PPC_FEATURE2_DARN		0x00200000
+#define PPC_FEATURE2_SCV		0x00100000
+#define PPC_FEATURE2_HTM_NO_SUSPEND	0x00080000
diff --git a/arch/powerpc64/bits/hwcap.h b/arch/powerpc64/bits/hwcap.h
index 82c92a93..803de9b5 100644
--- a/arch/powerpc64/bits/hwcap.h
+++ b/arch/powerpc64/bits/hwcap.h
@@ -38,3 +38,6 @@
 #define PPC_FEATURE2_HTM_NOSC		0x01000000
 #define PPC_FEATURE2_ARCH_3_00		0x00800000
 #define PPC_FEATURE2_HAS_IEEE128	0x00400000
+#define PPC_FEATURE2_DARN		0x00200000
+#define PPC_FEATURE2_SCV		0x00100000
+#define PPC_FEATURE2_HTM_NO_SUSPEND	0x00080000
-- 
2.15.0


[-- Attachment #18: 0017-arm-add-get_tls-syscall-from-linux-v4.15.patch --]
[-- Type: text/x-diff, Size: 731 bytes --]

From aab0e7abff69b2a1183320f47828a4be7c82853a Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:42:27 +0000
Subject: [PATCH 17/25] arm: add get_tls syscall from linux v4.15

for systems without tp register or kuser helper, new in linux commit
8fcd6c45f5a65621ec809b7866a3623e9a01d4ed
---
 arch/arm/bits/syscall.h.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/bits/syscall.h.in b/arch/arm/bits/syscall.h.in
index c594152e..1920516a 100644
--- a/arch/arm/bits/syscall.h.in
+++ b/arch/arm/bits/syscall.h.in
@@ -359,4 +359,5 @@
 #define __ARM_NR_usr26		0x0f0003
 #define __ARM_NR_usr32		0x0f0004
 #define __ARM_NR_set_tls	0x0f0005
+#define __ARM_NR_get_tls	0x0f0006
 
-- 
2.15.0


[-- Attachment #19: 0018-aarch64-update-hwcap.h-for-linux-v4.15.patch --]
[-- Type: text/x-diff, Size: 952 bytes --]

From b764b52eb5482273c8ec3ce6d70a70c783861e83 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:46:45 +0000
Subject: [PATCH 18/25] aarch64: update hwcap.h for linux v4.15

HWCAP_SVE is new in linux commit 43994d824e8443263dc98b151e6326bf677be52e
HWCAP_SHA3, HWCAP_SM3, HWCAP_SM4, HWCAP_ASIMDDP and HWCAP_SHA512 are new in
f5e035f8694c3bdddc66ea46ecda965ee6853718
---
 arch/aarch64/bits/hwcap.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/aarch64/bits/hwcap.h b/arch/aarch64/bits/hwcap.h
index 87f71ff3..1727a387 100644
--- a/arch/aarch64/bits/hwcap.h
+++ b/arch/aarch64/bits/hwcap.h
@@ -15,3 +15,9 @@
 #define HWCAP_FCMA		(1 << 14)
 #define HWCAP_LRCPC		(1 << 15)
 #define HWCAP_DCPOP		(1 << 16)
+#define HWCAP_SHA3		(1 << 17)
+#define HWCAP_SM3		(1 << 18)
+#define HWCAP_SM4		(1 << 19)
+#define HWCAP_ASIMDDP		(1 << 20)
+#define HWCAP_SHA512		(1 << 21)
+#define HWCAP_SVE		(1 << 22)
-- 
2.15.0


[-- Attachment #20: 0019-sys-prctl.h-add-new-PR_SVE_-macros-from-linux-v4.15.patch --]
[-- Type: text/x-diff, Size: 976 bytes --]

From 782ba478a213175a2d5be7a56784392e2c40d395 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 21:04:51 +0000
Subject: [PATCH 19/25] sys/prctl.h: add new PR_SVE_* macros from linux v4.15

PR_SVE_SET_VL and PR_SVE_GET_VL controls are new in linux commit
2d2123bc7c7f843aa9db87720de159a049839862
related PR_SVE_* macros were added in
7582e22038a266444eb87bc07c372592ad647439
---
 include/sys/prctl.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/sys/prctl.h b/include/sys/prctl.h
index 24f4f8bd..aa0c7a88 100644
--- a/include/sys/prctl.h
+++ b/include/sys/prctl.h
@@ -130,6 +130,12 @@ struct prctl_mm_map {
 #define PR_CAP_AMBIENT_LOWER    3
 #define PR_CAP_AMBIENT_CLEAR_ALL 4
 
+#define PR_SVE_SET_VL           50
+#define PR_SVE_SET_VL_ONEXEC (1 << 18)
+#define PR_SVE_GET_VL           51
+#define PR_SVE_VL_LEN_MASK 0xffff
+#define PR_SVE_VL_INHERIT (1 << 17)
+
 int prctl (int, ...);
 
 #ifdef __cplusplus
-- 
2.15.0


[-- Attachment #21: 0020-elf.h-add-AT_-auxval-macros-for-cache-geometry.patch --]
[-- Type: text/x-diff, Size: 893 bytes --]

From a20be7ff5518f6dfd1468ac8e1ace7ba1ca6715d Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 21:13:06 +0000
Subject: [PATCH 20/25] elf.h: add AT_* auxval macros for cache geometry

AT_L1I_*, AT_L1D_*, AT_L2_* and AT_L3_* were added in linux v4.11 for
powerpc in commit 98a5f361b8625c6f4841d6ba013bbf0e80d08147.
---
 include/elf.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/elf.h b/include/elf.h
index e79915fe..3cebbe4a 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -1002,6 +1002,14 @@ typedef struct {
 #define AT_L2_CACHESHAPE	36
 #define AT_L3_CACHESHAPE	37
 
+#define AT_L1I_CACHESIZE	40
+#define AT_L1I_CACHEGEOMETRY	41
+#define AT_L1D_CACHESIZE	42
+#define AT_L1D_CACHEGEOMETRY	43
+#define AT_L2_CACHESIZE		44
+#define AT_L2_CACHEGEOMETRY	45
+#define AT_L3_CACHESIZE		46
+#define AT_L3_CACHEGEOMETRY	47
 
 
 
-- 
2.15.0


[-- Attachment #22: 0021-elf.h-add-PPC64_OPT_LOCALENTRY.patch --]
[-- Type: text/x-diff, Size: 693 bytes --]

From edf1ef9a2db5f03d0e89dfe8d5128c4acf17bf12 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 21:18:26 +0000
Subject: [PATCH 21/25] elf.h: add PPC64_OPT_LOCALENTRY

allows calling extern functions without saving r2, for details see
glibc commit 0572433b5beb636de1a49ec6b4fdab830c38cdc5
---
 include/elf.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/elf.h b/include/elf.h
index 3cebbe4a..171805a1 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -2241,6 +2241,7 @@ enum
 
 #define PPC64_OPT_TLS		1
 #define PPC64_OPT_MULTI_TOC	2
+#define PPC64_OPT_LOCALENTRY	4
 
 #define STO_PPC64_LOCAL_BIT	5
 #define STO_PPC64_LOCAL_MASK	0xe0
-- 
2.15.0


[-- Attachment #23: 0022-elf.h-update-NT_-coredump-elf-notes-for-linux-v4.15.patch --]
[-- Type: text/x-diff, Size: 2026 bytes --]

From a479c8c80c46c8044fcd1a8b402f0f1658a26209 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 21:22:38 +0000
Subject: [PATCH 22/25] elf.h: update NT_* coredump elf notes for linux v4.15

NT_ARM_SVE and NT_S390_RI_CB are new in linux commits
43d4da2c45b2f5d62f8a79ff7c6f95089bb24656 and
262832bc5acda76fd8f901d39f4da1121d951222
the rest are older.
musl missed NT_PRFPREG because it followed the glibc api:
https://sourceware.org/bugzilla/show_bug.cgi?id=14890
---
 include/elf.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/elf.h b/include/elf.h
index 171805a1..43f614a1 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -623,6 +623,7 @@ typedef struct {
 
 
 #define NT_PRSTATUS	1
+#define NT_PRFPREG	2
 #define NT_FPREGSET	2
 #define NT_PRPSINFO	3
 #define NT_PRXREG	4
@@ -644,6 +645,19 @@ typedef struct {
 #define NT_PPC_VMX	0x100
 #define NT_PPC_SPE	0x101
 #define NT_PPC_VSX	0x102
+#define NT_PPC_TAR	0x103
+#define NT_PPC_PPR	0x104
+#define NT_PPC_DSCR	0x105
+#define NT_PPC_EBB	0x106
+#define NT_PPC_PMU	0x107
+#define NT_PPC_TM_CGPR	0x108
+#define NT_PPC_TM_CFPR	0x109
+#define NT_PPC_TM_CVMX	0x10a
+#define NT_PPC_TM_CVSX	0x10b
+#define NT_PPC_TM_SPR	0x10c
+#define NT_PPC_TM_CTAR	0x10d
+#define NT_PPC_TM_CPPR	0x10e
+#define NT_PPC_TM_CDSCR	0x10f
 #define NT_386_TLS	0x200
 #define NT_386_IOPERM	0x201
 #define NT_X86_XSTATE	0x202
@@ -656,14 +670,21 @@ typedef struct {
 #define NT_S390_LAST_BREAK	0x306
 #define NT_S390_SYSTEM_CALL	0x307
 #define NT_S390_TDB	0x308
+#define NT_S390_VXRS_LOW	0x309
+#define NT_S390_VXRS_HIGH	0x30a
+#define NT_S390_GS_CB	0x30b
+#define NT_S390_GS_BC	0x30c
+#define NT_S390_RI_CB	0x30d
 #define NT_ARM_VFP	0x400
 #define NT_ARM_TLS	0x401
 #define NT_ARM_HW_BREAK	0x402
 #define NT_ARM_HW_WATCH	0x403
 #define NT_ARM_SYSTEM_CALL	0x404
+#define NT_ARM_SVE	0x405
 #define NT_METAG_CBUF	0x500
 #define NT_METAG_RPIPE	0x501
 #define NT_METAG_TLS	0x502
+#define NT_ARC_V2	0x600
 #define NT_VERSION	1
 
 
-- 
2.15.0


[-- Attachment #24: 0023-elf.h-syncronize-DF_1_-flags-with-binutils.patch --]
[-- Type: text/x-diff, Size: 770 bytes --]

From 17615e37f7d69275a18a6c1fbf4c2053d4c5f4cb Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 21:31:39 +0000
Subject: [PATCH 23/25] elf.h: syncronize DF_1_ flags with binutils

DF_1_STUB and DF_1_PIE were added in binutils-gdb commit
5c383f026242d25a3c21fdfda42e5ca218b346c8
---
 include/elf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/elf.h b/include/elf.h
index 43f614a1..dab750de 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -842,6 +842,8 @@ typedef struct {
 #define	DF_1_SYMINTPOSE	0x00800000
 #define	DF_1_GLOBAUDIT	0x01000000
 #define	DF_1_SINGLETON	0x02000000
+#define	DF_1_STUB	0x04000000
+#define	DF_1_PIE	0x08000000
 
 #define DTF_1_PARINIT	0x00000001
 #define DTF_1_CONFEXP	0x00000002
-- 
2.15.0


[-- Attachment #25: 0024-elf.h-add-DT_SYMTAB_SHNDX.patch --]
[-- Type: text/x-diff, Size: 842 bytes --]

From 7fadbb703a08a5cf6df486e86db2cfc5ccdf53ab Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Tue, 6 Feb 2018 22:33:38 +0000
Subject: [PATCH 24/25] elf.h: add DT_SYMTAB_SHNDX

it's a recent addition to elf gabi:
http://sco.com/developers/gabi/latest/revision.html
based on discussions at
https://sourceware.org/bugzilla/show_bug.cgi?id=15835
---
 include/elf.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/elf.h b/include/elf.h
index dab750de..78906f15 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -742,7 +742,8 @@ typedef struct {
 #define DT_ENCODING	32
 #define DT_PREINIT_ARRAY 32
 #define DT_PREINIT_ARRAYSZ 33
-#define	DT_NUM		34
+#define DT_SYMTAB_SHNDX	34
+#define	DT_NUM		35
 #define DT_LOOS		0x6000000d
 #define DT_HIOS		0x6ffff000
 #define DT_LOPROC	0x70000000
-- 
2.15.0


[-- Attachment #26: 0025-aarch64-add-sve_context-struct-and-related-defines-f.patch --]
[-- Type: text/x-diff, Size: 2676 bytes --]

From a1d324429af0330e43d6d9f5d6b64b7eb93bddbc Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 2 Feb 2018 20:58:20 +0000
Subject: [PATCH 25/25] aarch64: add sve_context struct and related defines
 from linux v4.15

signal context definitions for scalable vector extension new in commit
d0b8cd3187889476144bd9b13bf36a932c3e7952
---
 arch/aarch64/bits/signal.h | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/aarch64/bits/signal.h b/arch/aarch64/bits/signal.h
index 5eb3d91f..56e4ff83 100644
--- a/arch/aarch64/bits/signal.h
+++ b/arch/aarch64/bits/signal.h
@@ -25,6 +25,7 @@ typedef struct sigcontext {
 #define FPSIMD_MAGIC 0x46508001
 #define ESR_MAGIC 0x45535201
 #define EXTRA_MAGIC 0x45585401
+#define SVE_MAGIC 0x53564501
 struct _aarch64_ctx {
 	unsigned int magic;
 	unsigned int size;
@@ -45,6 +46,44 @@ struct extra_context {
 	unsigned int size;
 	unsigned int __reserved[3];
 };
+struct sve_context {
+	struct _aarch64_ctx head;
+	unsigned short vl;
+	unsigned short __reserved[3];
+};
+#define SVE_VQ_BYTES		16
+#define SVE_VQ_MIN		1
+#define SVE_VQ_MAX		512
+#define SVE_VL_MIN		(SVE_VQ_MIN * SVE_VQ_BYTES)
+#define SVE_VL_MAX		(SVE_VQ_MAX * SVE_VQ_BYTES)
+#define SVE_NUM_ZREGS		32
+#define SVE_NUM_PREGS		16
+#define sve_vl_valid(vl) \
+	((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
+#define sve_vq_from_vl(vl)	((vl) / SVE_VQ_BYTES)
+#define sve_vl_from_vq(vq)	((vq) * SVE_VQ_BYTES)
+#define SVE_SIG_ZREG_SIZE(vq)	((unsigned)(vq) * SVE_VQ_BYTES)
+#define SVE_SIG_PREG_SIZE(vq)	((unsigned)(vq) * (SVE_VQ_BYTES / 8))
+#define SVE_SIG_FFR_SIZE(vq)	SVE_SIG_PREG_SIZE(vq)
+#define SVE_SIG_REGS_OFFSET					\
+	((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1))	\
+		/ SVE_VQ_BYTES * SVE_VQ_BYTES)
+#define SVE_SIG_ZREGS_OFFSET	SVE_SIG_REGS_OFFSET
+#define SVE_SIG_ZREG_OFFSET(vq, n) \
+	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
+#define SVE_SIG_ZREGS_SIZE(vq) \
+	(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
+#define SVE_SIG_PREGS_OFFSET(vq) \
+	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
+#define SVE_SIG_PREG_OFFSET(vq, n) \
+	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
+#define SVE_SIG_PREGS_SIZE(vq) \
+	(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
+#define SVE_SIG_FFR_OFFSET(vq) \
+	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
+#define SVE_SIG_REGS_SIZE(vq) \
+	(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
+#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
 #else
 typedef struct {
 	long double __regs[18+256];
-- 
2.15.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 00/25] Update for linux v4.14 and v4.15
  2018-02-07  1:10 [PATCH 00/25] Update for linux v4.14 and v4.15 Szabolcs Nagy
@ 2018-02-08 18:25 ` Rich Felker
  2018-02-08 20:51   ` Szabolcs Nagy
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2018-02-08 18:25 UTC (permalink / raw)
  To: musl

On Wed, Feb 07, 2018 at 02:10:15AM +0100, Szabolcs Nagy wrote:
> includes v4.14 patches from
> http://www.openwall.com/lists/musl/2017/11/27/2
> and cosmetic bits/termios.h fix from
> http://www.openwall.com/lists/musl/2017/11/27/3
> and a number of elf.h updates.
> 
> build tested on most targets.
> 
> last patch is aarch64 sve sigcontext stuff, which is a bit ugly to
> copy into musl headers, but requiring linux asm/sigcontext.h for
> that does not work as it conflicts with musl signal.h
> 
> [...]
> 
> >From efd536020b2c739a843bd2eaa69697e4d896478b Mon Sep 17 00:00:00 2001
> From: Szabolcs Nagy <nsz@port70.net>
> Date: Sun, 26 Nov 2017 23:20:38 +0000
> Subject: [PATCH 06/25] signal.h: add missing SIGTRAP and SIGSYS si_codes
> 
> SYS_SECCOMP new in commit a0727e8ce513fe6890416da960181ceb10fbfae6
> TRAP_BRANCH and TRAP_HWBKPT new in commit
> da654b74bda14c45a7d98c731bf3c1a43b6b74e2
> ---
>  include/signal.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/signal.h b/include/signal.h
> index 2c8b3d55..1db5af5f 100644
> --- a/include/signal.h
> +++ b/include/signal.h
> @@ -231,6 +231,8 @@ int sigrelse(int);
>  void (*sigset(int, void (*)(int)))(int);
>  #define TRAP_BRKPT 1
>  #define TRAP_TRACE 2
> +#define TRAP_BRANCH 3
> +#define TRAP_HWBKPT 4
>  #define POLL_IN 1
>  #define POLL_OUT 2
>  #define POLL_MSG 3
> @@ -241,6 +243,7 @@ void (*sigset(int, void (*)(int)))(int);
>  #define SS_DISABLE    2
>  #define SS_AUTODISARM (1U << 31)
>  #define SS_FLAG_BITS SS_AUTODISARM
> +#define SYS_SECCOMP 1
>  #endif

SYS_ is not reserved namespace. This needs to go in the next
conditional block I think. Unless other changes are needed I can just
amend this when merging.

> >From 0bfeb4f4e717349eaf473e08bc5998958cfc0b33 Mon Sep 17 00:00:00 2001
> From: Szabolcs Nagy <nsz@port70.net>
> Date: Sun, 26 Nov 2017 23:58:25 +0000
> Subject: [PATCH 09/25] sys/{mman,shm}.h: add {MAP,SHM}_HUGE_ macros from linux
>  uapi
> 
> *_HUGE_SHIFT, *_HUGE_2MB, *_HUGE_1GB are documented in the man page,
> so add all of the *_HUGE_* macros from linux uapi.
> 
> if MAP_HUGETLB is set, top bits of the mmap flags encode the page size.
> see the linux commit aafd4562dfee81a40ba21b5ea3cf5e06664bc7f6
> 
> if SHM_HUGETLB is set, top bits of the shmget flags encode the page size.
> see the linux commit 4da243ac1cf6aeb30b7c555d56208982d66d6d33
> 
> *_HUGE_16GB is defined unsigned to avoid signed left shift ub.
> ---
>  include/sys/mman.h | 13 +++++++++++++
>  include/sys/shm.h  | 13 +++++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/include/sys/mman.h b/include/sys/mman.h
> index 12318782..d13d4ca3 100644
> --- a/include/sys/mman.h
> +++ b/include/sys/mman.h
> @@ -35,6 +35,19 @@ extern "C" {
>  #define MAP_HUGETLB    0x40000
>  #define MAP_FILE       0
>  
> +#define MAP_HUGE_SHIFT 26
> +#define MAP_HUGE_MASK  0x3f
> +#define MAP_HUGE_64KB  (16 << 26)
> +#define MAP_HUGE_512KB (19 << 26)
> +#define MAP_HUGE_1MB   (20 << 26)
> +#define MAP_HUGE_2MB   (21 << 26)
> +#define MAP_HUGE_8MB   (23 << 26)
> +#define MAP_HUGE_16MB  (24 << 26)
> +#define MAP_HUGE_256MB (28 << 26)
> +#define MAP_HUGE_1GB   (30 << 26)
> +#define MAP_HUGE_2GB   (31 << 26)
> +#define MAP_HUGE_16GB  (34U << 26)

This is a huge shame and waste of precious flag bits, but nothing we
can change. :( :( :(

> >From 88d285105bfe57315d021c88abf98aba44b6b094 Mon Sep 17 00:00:00 2001
> From: Szabolcs Nagy <nsz@port70.net>
> Date: Fri, 2 Feb 2018 20:10:09 +0000
> Subject: [PATCH 12/25] add MAP_SYNC and MAP_SHARED_VALIDATE from linux v4.15
> 
> for synchronous page faults, new in linux commit
> 1c9725974074a047f6080eecc62c50a8e840d050 and
> b6fb293f2497a9841d94f6b57bd2bb2cd222da43
> note that only targets that use asm-generic/mman.h have this new
> flag defined, so undef it on other targets (mips*, powerpc*).
> ---
>  arch/mips/bits/mman.h      | 1 +
>  arch/mips64/bits/mman.h    | 1 +
>  arch/mipsn32/bits/mman.h   | 1 +
>  arch/powerpc/bits/mman.h   | 1 +
>  arch/powerpc64/bits/mman.h | 1 +
>  include/sys/mman.h         | 2 ++
>  6 files changed, 7 insertions(+)
> 
> diff --git a/arch/mips/bits/mman.h b/arch/mips/bits/mman.h
> index c68aea88..9027bb63 100644
> --- a/arch/mips/bits/mman.h
> +++ b/arch/mips/bits/mman.h
> @@ -18,6 +18,7 @@
>  #define MAP_STACK      0x40000
>  #undef MAP_HUGETLB
>  #define MAP_HUGETLB    0x80000
> +#undef MAP_SYNC

This might have been less ugly only defining it in the archs that have
it for now, but your way will probably be less ugly going forward. I
don't think it needs to be changed.

> diff --git a/arch/aarch64/bits/signal.h b/arch/aarch64/bits/signal.h
> index 5eb3d91f..56e4ff83 100644
> --- a/arch/aarch64/bits/signal.h
> +++ b/arch/aarch64/bits/signal.h
> @@ -25,6 +25,7 @@ typedef struct sigcontext {
>  #define FPSIMD_MAGIC 0x46508001
>  #define ESR_MAGIC 0x45535201
>  #define EXTRA_MAGIC 0x45585401
> +#define SVE_MAGIC 0x53564501
>  struct _aarch64_ctx {
>  	unsigned int magic;
>  	unsigned int size;
> @@ -45,6 +46,44 @@ struct extra_context {
>  	unsigned int size;
>  	unsigned int __reserved[3];
>  };
> +struct sve_context {
> +	struct _aarch64_ctx head;
> +	unsigned short vl;
> +	unsigned short __reserved[3];
> +};
> +#define SVE_VQ_BYTES		16
> +#define SVE_VQ_MIN		1
> +#define SVE_VQ_MAX		512
> +#define SVE_VL_MIN		(SVE_VQ_MIN * SVE_VQ_BYTES)
> +#define SVE_VL_MAX		(SVE_VQ_MAX * SVE_VQ_BYTES)
> +#define SVE_NUM_ZREGS		32
> +#define SVE_NUM_PREGS		16
> +#define sve_vl_valid(vl) \
> +	((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
> +#define sve_vq_from_vl(vl)	((vl) / SVE_VQ_BYTES)
> +#define sve_vl_from_vq(vq)	((vq) * SVE_VQ_BYTES)
> +#define SVE_SIG_ZREG_SIZE(vq)	((unsigned)(vq) * SVE_VQ_BYTES)
> +#define SVE_SIG_PREG_SIZE(vq)	((unsigned)(vq) * (SVE_VQ_BYTES / 8))
> +#define SVE_SIG_FFR_SIZE(vq)	SVE_SIG_PREG_SIZE(vq)
> +#define SVE_SIG_REGS_OFFSET					\
> +	((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1))	\
> +		/ SVE_VQ_BYTES * SVE_VQ_BYTES)
> +#define SVE_SIG_ZREGS_OFFSET	SVE_SIG_REGS_OFFSET
> +#define SVE_SIG_ZREG_OFFSET(vq, n) \
> +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
> +#define SVE_SIG_ZREGS_SIZE(vq) \
> +	(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
> +#define SVE_SIG_PREGS_OFFSET(vq) \
> +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
> +#define SVE_SIG_PREG_OFFSET(vq, n) \
> +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
> +#define SVE_SIG_PREGS_SIZE(vq) \
> +	(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
> +#define SVE_SIG_FFR_OFFSET(vq) \
> +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
> +#define SVE_SIG_REGS_SIZE(vq) \
> +	(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
> +#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
>  #else
>  typedef struct {
>  	long double __regs[18+256];

This is a lot of messy code-like machinery to be adding to a header,
but maybe it's also needed? :(

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 00/25] Update for linux v4.14 and v4.15
  2018-02-08 18:25 ` Rich Felker
@ 2018-02-08 20:51   ` Szabolcs Nagy
  2018-02-22 23:53     ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2018-02-08 20:51 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@libc.org> [2018-02-08 13:25:28 -0500]:
> On Wed, Feb 07, 2018 at 02:10:15AM +0100, Szabolcs Nagy wrote:
> > >From efd536020b2c739a843bd2eaa69697e4d896478b Mon Sep 17 00:00:00 2001
> > From: Szabolcs Nagy <nsz@port70.net>
> > Date: Sun, 26 Nov 2017 23:20:38 +0000
> > Subject: [PATCH 06/25] signal.h: add missing SIGTRAP and SIGSYS si_codes
> > 
> > SYS_SECCOMP new in commit a0727e8ce513fe6890416da960181ceb10fbfae6
> > TRAP_BRANCH and TRAP_HWBKPT new in commit
> > da654b74bda14c45a7d98c731bf3c1a43b6b74e2
> > ---
> >  include/signal.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/include/signal.h b/include/signal.h
> > index 2c8b3d55..1db5af5f 100644
> > --- a/include/signal.h
> > +++ b/include/signal.h
> > @@ -231,6 +231,8 @@ int sigrelse(int);
> >  void (*sigset(int, void (*)(int)))(int);
> >  #define TRAP_BRKPT 1
> >  #define TRAP_TRACE 2
> > +#define TRAP_BRANCH 3
> > +#define TRAP_HWBKPT 4
> >  #define POLL_IN 1
> >  #define POLL_OUT 2
> >  #define POLL_MSG 3
> > @@ -241,6 +243,7 @@ void (*sigset(int, void (*)(int)))(int);
> >  #define SS_DISABLE    2
> >  #define SS_AUTODISARM (1U << 31)
> >  #define SS_FLAG_BITS SS_AUTODISARM
> > +#define SYS_SECCOMP 1
> >  #endif
> 
> SYS_ is not reserved namespace. This needs to go in the next
> conditional block I think. Unless other changes are needed I can just
> amend this when merging.
> 

yes this is a mistake, should be under _GNU_SOURCE or removed
(glibc does not seem to expose this macro yet nor include
asm/siginfo.h directly)

> > diff --git a/arch/aarch64/bits/signal.h b/arch/aarch64/bits/signal.h
> > index 5eb3d91f..56e4ff83 100644
> > --- a/arch/aarch64/bits/signal.h
> > +++ b/arch/aarch64/bits/signal.h
> > @@ -25,6 +25,7 @@ typedef struct sigcontext {
> >  #define FPSIMD_MAGIC 0x46508001
> >  #define ESR_MAGIC 0x45535201
> >  #define EXTRA_MAGIC 0x45585401
> > +#define SVE_MAGIC 0x53564501
> >  struct _aarch64_ctx {
> >  	unsigned int magic;
> >  	unsigned int size;
> > @@ -45,6 +46,44 @@ struct extra_context {
> >  	unsigned int size;
> >  	unsigned int __reserved[3];
> >  };
> > +struct sve_context {
> > +	struct _aarch64_ctx head;
> > +	unsigned short vl;
> > +	unsigned short __reserved[3];
> > +};
> > +#define SVE_VQ_BYTES		16
> > +#define SVE_VQ_MIN		1
> > +#define SVE_VQ_MAX		512
> > +#define SVE_VL_MIN		(SVE_VQ_MIN * SVE_VQ_BYTES)
> > +#define SVE_VL_MAX		(SVE_VQ_MAX * SVE_VQ_BYTES)
> > +#define SVE_NUM_ZREGS		32
> > +#define SVE_NUM_PREGS		16
> > +#define sve_vl_valid(vl) \
> > +	((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
> > +#define sve_vq_from_vl(vl)	((vl) / SVE_VQ_BYTES)
> > +#define sve_vl_from_vq(vq)	((vq) * SVE_VQ_BYTES)
> > +#define SVE_SIG_ZREG_SIZE(vq)	((unsigned)(vq) * SVE_VQ_BYTES)
> > +#define SVE_SIG_PREG_SIZE(vq)	((unsigned)(vq) * (SVE_VQ_BYTES / 8))
> > +#define SVE_SIG_FFR_SIZE(vq)	SVE_SIG_PREG_SIZE(vq)
> > +#define SVE_SIG_REGS_OFFSET					\
> > +	((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1))	\
> > +		/ SVE_VQ_BYTES * SVE_VQ_BYTES)
> > +#define SVE_SIG_ZREGS_OFFSET	SVE_SIG_REGS_OFFSET
> > +#define SVE_SIG_ZREG_OFFSET(vq, n) \
> > +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
> > +#define SVE_SIG_ZREGS_SIZE(vq) \
> > +	(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
> > +#define SVE_SIG_PREGS_OFFSET(vq) \
> > +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
> > +#define SVE_SIG_PREG_OFFSET(vq, n) \
> > +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
> > +#define SVE_SIG_PREGS_SIZE(vq) \
> > +	(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
> > +#define SVE_SIG_FFR_OFFSET(vq) \
> > +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
> > +#define SVE_SIG_REGS_SIZE(vq) \
> > +	(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
> > +#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
> >  #else
> >  typedef struct {
> >  	long double __regs[18+256];
> 
> This is a lot of messy code-like machinery to be adding to a header,
> but maybe it's also needed? :(
> 

glibc includes asm/sigcontext.h under _GNU_SOURCE
and all this got added to the uapi header to handle
the variable length sve registers..



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 00/25] Update for linux v4.14 and v4.15
  2018-02-08 20:51   ` Szabolcs Nagy
@ 2018-02-22 23:53     ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2018-02-22 23:53 UTC (permalink / raw)
  To: musl

On Thu, Feb 08, 2018 at 09:51:47PM +0100, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2018-02-08 13:25:28 -0500]:
> > On Wed, Feb 07, 2018 at 02:10:15AM +0100, Szabolcs Nagy wrote:
> > > >From efd536020b2c739a843bd2eaa69697e4d896478b Mon Sep 17 00:00:00 2001
> > > From: Szabolcs Nagy <nsz@port70.net>
> > > Date: Sun, 26 Nov 2017 23:20:38 +0000
> > > Subject: [PATCH 06/25] signal.h: add missing SIGTRAP and SIGSYS si_codes
> > > 
> > > SYS_SECCOMP new in commit a0727e8ce513fe6890416da960181ceb10fbfae6
> > > TRAP_BRANCH and TRAP_HWBKPT new in commit
> > > da654b74bda14c45a7d98c731bf3c1a43b6b74e2
> > > ---
> > >  include/signal.h | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/include/signal.h b/include/signal.h
> > > index 2c8b3d55..1db5af5f 100644
> > > --- a/include/signal.h
> > > +++ b/include/signal.h
> > > @@ -231,6 +231,8 @@ int sigrelse(int);
> > >  void (*sigset(int, void (*)(int)))(int);
> > >  #define TRAP_BRKPT 1
> > >  #define TRAP_TRACE 2
> > > +#define TRAP_BRANCH 3
> > > +#define TRAP_HWBKPT 4
> > >  #define POLL_IN 1
> > >  #define POLL_OUT 2
> > >  #define POLL_MSG 3
> > > @@ -241,6 +243,7 @@ void (*sigset(int, void (*)(int)))(int);
> > >  #define SS_DISABLE    2
> > >  #define SS_AUTODISARM (1U << 31)
> > >  #define SS_FLAG_BITS SS_AUTODISARM
> > > +#define SYS_SECCOMP 1
> > >  #endif
> > 
> > SYS_ is not reserved namespace. This needs to go in the next
> > conditional block I think. Unless other changes are needed I can just
> > amend this when merging.
> > 
> 
> yes this is a mistake, should be under _GNU_SOURCE or removed
> (glibc does not seem to expose this macro yet nor include
> asm/siginfo.h directly)
> 
> > > diff --git a/arch/aarch64/bits/signal.h b/arch/aarch64/bits/signal.h
> > > index 5eb3d91f..56e4ff83 100644
> > > --- a/arch/aarch64/bits/signal.h
> > > +++ b/arch/aarch64/bits/signal.h
> > > @@ -25,6 +25,7 @@ typedef struct sigcontext {
> > >  #define FPSIMD_MAGIC 0x46508001
> > >  #define ESR_MAGIC 0x45535201
> > >  #define EXTRA_MAGIC 0x45585401
> > > +#define SVE_MAGIC 0x53564501
> > >  struct _aarch64_ctx {
> > >  	unsigned int magic;
> > >  	unsigned int size;
> > > @@ -45,6 +46,44 @@ struct extra_context {
> > >  	unsigned int size;
> > >  	unsigned int __reserved[3];
> > >  };
> > > +struct sve_context {
> > > +	struct _aarch64_ctx head;
> > > +	unsigned short vl;
> > > +	unsigned short __reserved[3];
> > > +};
> > > +#define SVE_VQ_BYTES		16
> > > +#define SVE_VQ_MIN		1
> > > +#define SVE_VQ_MAX		512
> > > +#define SVE_VL_MIN		(SVE_VQ_MIN * SVE_VQ_BYTES)
> > > +#define SVE_VL_MAX		(SVE_VQ_MAX * SVE_VQ_BYTES)
> > > +#define SVE_NUM_ZREGS		32
> > > +#define SVE_NUM_PREGS		16
> > > +#define sve_vl_valid(vl) \
> > > +	((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
> > > +#define sve_vq_from_vl(vl)	((vl) / SVE_VQ_BYTES)
> > > +#define sve_vl_from_vq(vq)	((vq) * SVE_VQ_BYTES)
> > > +#define SVE_SIG_ZREG_SIZE(vq)	((unsigned)(vq) * SVE_VQ_BYTES)
> > > +#define SVE_SIG_PREG_SIZE(vq)	((unsigned)(vq) * (SVE_VQ_BYTES / 8))
> > > +#define SVE_SIG_FFR_SIZE(vq)	SVE_SIG_PREG_SIZE(vq)
> > > +#define SVE_SIG_REGS_OFFSET					\
> > > +	((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1))	\
> > > +		/ SVE_VQ_BYTES * SVE_VQ_BYTES)
> > > +#define SVE_SIG_ZREGS_OFFSET	SVE_SIG_REGS_OFFSET
> > > +#define SVE_SIG_ZREG_OFFSET(vq, n) \
> > > +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
> > > +#define SVE_SIG_ZREGS_SIZE(vq) \
> > > +	(SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
> > > +#define SVE_SIG_PREGS_OFFSET(vq) \
> > > +	(SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
> > > +#define SVE_SIG_PREG_OFFSET(vq, n) \
> > > +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
> > > +#define SVE_SIG_PREGS_SIZE(vq) \
> > > +	(SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
> > > +#define SVE_SIG_FFR_OFFSET(vq) \
> > > +	(SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
> > > +#define SVE_SIG_REGS_SIZE(vq) \
> > > +	(SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
> > > +#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
> > >  #else
> > >  typedef struct {
> > >  	long double __regs[18+256];
> > 
> > This is a lot of messy code-like machinery to be adding to a header,
> > but maybe it's also needed? :(
> > 
> 
> glibc includes asm/sigcontext.h under _GNU_SOURCE
> and all this got added to the uapi header to handle
> the variable length sve registers..

OK. Committing with only the change of removing SYS_SECCOMP and
updating the commit message to match.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-22 23:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07  1:10 [PATCH 00/25] Update for linux v4.14 and v4.15 Szabolcs Nagy
2018-02-08 18:25 ` Rich Felker
2018-02-08 20:51   ` Szabolcs Nagy
2018-02-22 23:53     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).