mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 00/16] Linux v4.16 and v4.17 updates
@ 2018-06-14 23:03 Szabolcs Nagy
  2018-06-19 17:33 ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2018-06-14 23:03 UTC (permalink / raw)
  To: musl

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

respin of the v4.16 patches
http://www.openwall.com/lists/musl/2018/04/28/1
without the siginfo changes and with v4.17 additions.

the last patch is adding missing memory mapping related
syscall wrappers, the pkey* support is incomplete.

Szabolcs Nagy (16):
  sys/epoll.h: add EPOLLNVAL from linux v4.16
  netinet/if_ether.h: add ETH_P_ERSPAN2 from linux v4.16
  netinet/if_ether.h: add ETH_TLEN from linux v4.16
  sys/ptrace.h: add PTRACE_SECCOMP_GET_METADATA from linux v4.16
  aarch64: add HWCAP_ASIMDFHM from linux v4.16
  powerpc: add pkey syscall numbers from linux v4.16
  add MAP_FIXED_NOREPLACE from linux v4.17
  add {MSG,SEM,SHM}_STAT_ANY from linux v4.17
  add TCP_NLA_* from linux v4.17
  add ETH_P_PREAUTH ethertype from linux v4.17
  add speculation control prctls from linux v4.17
  aarch64: add HWCAP_ flags from linux v4.17
  mips: add HWCAP_ flags from linux v4.17
  s390x: add kexec_file_load syscall number from linux v4.17
  add si_codes from linux v4.17
  Add memfd_create, mlock2 and pkey_* apis

 arch/aarch64/bits/hwcap.h        |  5 +++++
 arch/mips/bits/hwcap.h           |  1 +
 arch/mips64/bits/hwcap.h         |  1 +
 arch/mipsn32/bits/hwcap.h        |  1 +
 arch/powerpc/bits/mman.h         |  4 ++++
 arch/powerpc/bits/syscall.h.in   |  3 +++
 arch/powerpc64/bits/mman.h       |  4 ++++
 arch/powerpc64/bits/syscall.h.in |  3 +++
 arch/s390x/bits/syscall.h.in     |  1 +
 include/netinet/if_ether.h       |  3 +++
 include/netinet/tcp.h            | 10 ++++++++++
 include/signal.h                 | 13 +++++++++++++
 include/sys/epoll.h              |  1 +
 include/sys/mman.h               | 25 ++++++++++++++++++++++---
 include/sys/msg.h                |  1 +
 include/sys/prctl.h              |  9 +++++++++
 include/sys/ptrace.h             |  8 +++++++-
 include/sys/sem.h                |  1 +
 include/sys/shm.h                |  1 +
 src/linux/memfd_create.c         |  8 ++++++++
 src/linux/mlock2.c               | 11 +++++++++++
 src/linux/pkey_alloc.c           | 22 ++++++++++++++++++++++
 src/linux/pkey_get.c             |  9 +++++++++
 src/linux/pkey_mprotect.c        | 15 +++++++++++++++
 src/linux/pkey_set.c             |  9 +++++++++
 25 files changed, 165 insertions(+), 4 deletions(-)
 create mode 100644 src/linux/memfd_create.c
 create mode 100644 src/linux/mlock2.c
 create mode 100644 src/linux/pkey_alloc.c
 create mode 100644 src/linux/pkey_get.c
 create mode 100644 src/linux/pkey_mprotect.c
 create mode 100644 src/linux/pkey_set.c

-- 
2.16.3


[-- Attachment #2: 0001-sys-epoll.h-add-EPOLLNVAL-from-linux-v4.16.patch --]
[-- Type: text/x-diff, Size: 835 bytes --]

From c84b49a06766f54479ab3cdb1f722d1a33802ae4 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 28 Apr 2018 15:52:06 +0000
Subject: [PATCH 01/16] sys/epoll.h: add EPOLLNVAL from linux v4.16

added to uapi in commit 65aaf87b3aa2d049c6b9fd85221858a895df3393
used since commit a9a08845e9acbd224e4ee466f5c1275ed50054e8,
which renamed POLL* to EPOLL* in the kernel.
---
 include/sys/epoll.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/sys/epoll.h b/include/sys/epoll.h
index ffe2311f..ac81a841 100644
--- a/include/sys/epoll.h
+++ b/include/sys/epoll.h
@@ -21,6 +21,7 @@ enum EPOLL_EVENTS { __EPOLL_DUMMY };
 #define EPOLLPRI 0x002
 #define EPOLLOUT 0x004
 #define EPOLLRDNORM 0x040
+#define EPOLLNVAL 0x020
 #define EPOLLRDBAND 0x080
 #define EPOLLWRNORM 0x100
 #define EPOLLWRBAND 0x200
-- 
2.16.3


[-- Attachment #3: 0002-netinet-if_ether.h-add-ETH_P_ERSPAN2-from-linux-v4.1.patch --]
[-- Type: text/x-diff, Size: 781 bytes --]

From 6126049d9b5fe953cc2257bdcfbaa98bf07c1eab Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 28 Apr 2018 16:10:53 +0000
Subject: [PATCH 02/16] netinet/if_ether.h: add ETH_P_ERSPAN2 from linux v4.16

protocol number for erspan v2 support
added in linux commit f551c91de262ba36b20c3ac19538afb4f4507441
---
 include/netinet/if_ether.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
index 9007d609..33f08a31 100644
--- a/include/netinet/if_ether.h
+++ b/include/netinet/if_ether.h
@@ -17,6 +17,7 @@
 #define ETH_P_PUP	0x0200
 #define ETH_P_PUPAT	0x0201
 #define ETH_P_TSN	0x22F0
+#define ETH_P_ERSPAN2	0x22EB
 #define ETH_P_IP	0x0800
 #define ETH_P_X25	0x0805
 #define ETH_P_ARP	0x0806
-- 
2.16.3


[-- Attachment #4: 0003-netinet-if_ether.h-add-ETH_TLEN-from-linux-v4.16.patch --]
[-- Type: text/x-diff, Size: 714 bytes --]

From 6ac05ef841566b216140565d44d00fbdb30f7bb1 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 28 Apr 2018 16:16:12 +0000
Subject: [PATCH 03/16] netinet/if_ether.h: add ETH_TLEN from linux v4.16

octets in ethernet type field
added in linux commit 4bbb3e0e8239f9079bf1fe20b3c0cb598714ae61
---
 include/netinet/if_ether.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
index 33f08a31..f7df5f7f 100644
--- a/include/netinet/if_ether.h
+++ b/include/netinet/if_ether.h
@@ -5,6 +5,7 @@
 #include <sys/types.h>
 
 #define ETH_ALEN	6
+#define ETH_TLEN	2
 #define ETH_HLEN	14
 #define ETH_ZLEN	60
 #define ETH_DATA_LEN	1500
-- 
2.16.3


[-- Attachment #5: 0004-sys-ptrace.h-add-PTRACE_SECCOMP_GET_METADATA-from-li.patch --]
[-- Type: text/x-diff, Size: 1260 bytes --]

From 9ef3ded8d43cc60b3c79ac3c6667145ac54c0e8e Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 28 Apr 2018 16:23:23 +0000
Subject: [PATCH 04/16] sys/ptrace.h: add PTRACE_SECCOMP_GET_METADATA from
 linux v4.16

to get seccomp state for checkpoint restore.
added in linux commit 26500475ac1b499d8636ff281311d633909f5d20

struct tag follows the glibc api and ptrace_peeksiginfo_args
got changed too accordingly.
---
 include/sys/ptrace.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sys/ptrace.h b/include/sys/ptrace.h
index d9d45408..f501ff08 100644
--- a/include/sys/ptrace.h
+++ b/include/sys/ptrace.h
@@ -40,6 +40,7 @@ extern "C" {
 #define PTRACE_GETSIGMASK 0x420a
 #define PTRACE_SETSIGMASK 0x420b
 #define PTRACE_SECCOMP_GET_FILTER 0x420c
+#define PTRACE_SECCOMP_GET_METADATA 0x420d
 
 #define PT_READ_I PTRACE_PEEKTEXT
 #define PT_READ_D PTRACE_PEEKDATA
@@ -86,12 +87,17 @@ extern "C" {
 
 #define PTRACE_PEEKSIGINFO_SHARED 1
 
-struct ptrace_peeksiginfo_args {
+struct __ptrace_peeksiginfo_args {
 	uint64_t off;
 	uint32_t flags;
 	int32_t nr;
 };
 
+struct __ptrace_seccomp_metadata {
+	uint64_t filter_off;
+	uint64_t flags;
+};
+
 long ptrace(int, ...);
 
 #ifdef __cplusplus
-- 
2.16.3


[-- Attachment #6: 0005-aarch64-add-HWCAP_ASIMDFHM-from-linux-v4.16.patch --]
[-- Type: text/x-diff, Size: 696 bytes --]

From 9c6af71cdecdd6613f94d64bc13136555c6e9ba2 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 28 Apr 2018 16:29:55 +0000
Subject: [PATCH 05/16] aarch64: add HWCAP_ASIMDFHM from linux v4.16

armv8.4 fp mul instructions.
added in commit 3b3b681097fae73b7f5dcdd42db6cfdf32943d4c
---
 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 1727a387..6fa64e8c 100644
--- a/arch/aarch64/bits/hwcap.h
+++ b/arch/aarch64/bits/hwcap.h
@@ -21,3 +21,4 @@
 #define HWCAP_ASIMDDP		(1 << 20)
 #define HWCAP_SHA512		(1 << 21)
 #define HWCAP_SVE		(1 << 22)
+#define HWCAP_ASIMDFHM		(1 << 23)
-- 
2.16.3


[-- Attachment #7: 0006-powerpc-add-pkey-syscall-numbers-from-linux-v4.16.patch --]
[-- Type: text/x-diff, Size: 1425 bytes --]

From f34d84b5ca2f01047c1569c9c9187f66f139c11a Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 28 Apr 2018 16:36:40 +0000
Subject: [PATCH 06/16] powerpc: add pkey syscall numbers from linux v4.16

add pkey_mprotect, pkey_alloc, pkey_free syscall numbers,
new in linux commits 3350eb2ea127978319ced883523d828046af4045
and 9499ec1b5e82321829e1c1510bcc37edc20b6f38
---
 arch/powerpc/bits/syscall.h.in   | 3 +++
 arch/powerpc64/bits/syscall.h.in | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/arch/powerpc/bits/syscall.h.in b/arch/powerpc/bits/syscall.h.in
index 20833915..7ce94bbd 100644
--- a/arch/powerpc/bits/syscall.h.in
+++ b/arch/powerpc/bits/syscall.h.in
@@ -368,4 +368,7 @@
 #define __NR_pwritev2              381
 #define __NR_kexec_file_load       382
 #define __NR_statx                 383
+#define __NR_pkey_alloc            384
+#define __NR_pkey_free             385
+#define __NR_pkey_mprotect         386
 
diff --git a/arch/powerpc64/bits/syscall.h.in b/arch/powerpc64/bits/syscall.h.in
index 936f43c0..1da1ecc0 100644
--- a/arch/powerpc64/bits/syscall.h.in
+++ b/arch/powerpc64/bits/syscall.h.in
@@ -359,4 +359,7 @@
 #define __NR_pwritev2               381
 #define __NR_kexec_file_load        382
 #define __NR_statx                  383
+#define __NR_pkey_alloc             384
+#define __NR_pkey_free              385
+#define __NR_pkey_mprotect          386
 
-- 
2.16.3


[-- Attachment #8: 0007-add-MAP_FIXED_NOREPLACE-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 850 bytes --]

From 62d05aadd830e0064570501be2478052d3b3c4d9 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 20:39:35 +0000
Subject: [PATCH 07/16] add MAP_FIXED_NOREPLACE from linux v4.17

to map at a fixed address without unmapping underlying mappings
(fails with EEXIST unlike MAP_FIXED), new in linux commits
4ed28639519c7bad5f518e70b3284c6e0763e650 and
a4ff8e8620d3f4f50ac4b41e8067b7d395056843.
---
 include/sys/mman.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/sys/mman.h b/include/sys/mman.h
index 302ad134..19dd844e 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -35,6 +35,7 @@ extern "C" {
 #define MAP_STACK      0x20000
 #define MAP_HUGETLB    0x40000
 #define MAP_SYNC       0x80000
+#define MAP_FIXED_NOREPLACE 0x100000
 #define MAP_FILE       0
 
 #define MAP_HUGE_SHIFT 26
-- 
2.16.3


[-- Attachment #9: 0008-add-MSG-SEM-SHM-_STAT_ANY-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 1521 bytes --]

From 38dfca580d7544a98e7e4985a4846f45a17f5331 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 21:06:58 +0000
Subject: [PATCH 08/16] add {MSG,SEM,SHM}_STAT_ANY from linux v4.17

introduced to stat ipc objects without permission checks since the
info is available in /proc/sysvipc anyway, new in linux commits
23c8cec8cf679b10997a512abb1e86f0cedc42ba
a280d6dc77eb6002f269d58cd47c7c7e69b617b6
c21a6970ae727839a2f300cd8dd957de0d0238c3
---
 include/sys/msg.h | 1 +
 include/sys/sem.h | 1 +
 include/sys/shm.h | 1 +
 3 files changed, 3 insertions(+)

diff --git a/include/sys/msg.h b/include/sys/msg.h
index 139f22b7..be6afc34 100644
--- a/include/sys/msg.h
+++ b/include/sys/msg.h
@@ -27,6 +27,7 @@ typedef unsigned long msglen_t;
 
 #define MSG_STAT 11
 #define MSG_INFO 12
+#define MSG_STAT_ANY 13
 
 struct msginfo {
 	int msgpool, msgmap, msgmax, msgmnb, msgmni, msgssz, msgtql;
diff --git a/include/sys/sem.h b/include/sys/sem.h
index e7c36980..61cdb83d 100644
--- a/include/sys/sem.h
+++ b/include/sys/sem.h
@@ -33,6 +33,7 @@ extern "C" {
 
 #define SEM_STAT 18
 #define SEM_INFO 19
+#define SEM_STAT_ANY 20
 
 struct  seminfo {
 	int semmap;
diff --git a/include/sys/shm.h b/include/sys/shm.h
index e7d39ff6..662fde59 100644
--- a/include/sys/shm.h
+++ b/include/sys/shm.h
@@ -35,6 +35,7 @@ extern "C" {
 #define SHM_UNLOCK 12
 #define SHM_STAT 13
 #define SHM_INFO 14
+#define SHM_STAT_ANY 15
 #define SHM_DEST 01000
 #define SHM_LOCKED 02000
 #define SHM_HUGETLB 04000
-- 
2.16.3


[-- Attachment #10: 0009-add-TCP_NLA_-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 1054 bytes --]

From e6fab15c01c9ef47cefd7b79a68433748fcde90b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 21:15:13 +0000
Subject: [PATCH 09/16] add TCP_NLA_* from linux v4.17

new and missing netlink attributes types for SCM_TIMESTAMPING_OPT_STATS,
new ones were added in commits
7156d194a0772f733865267e7207e0b08f81b02b
be631892948060f44b1ceee3132be1266932071e
87ecc95d81d951b0984f2eb9c5c118cb68d0dce8
---
 include/netinet/tcp.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 2747f4ea..1e2acfbf 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -56,6 +56,16 @@ enum {
 	TCP_NLA_SNDBUF_LIMITED,
 	TCP_NLA_DATA_SEGS_OUT,
 	TCP_NLA_TOTAL_RETRANS,
+	TCP_NLA_PACING_RATE,
+	TCP_NLA_DELIVERY_RATE,
+	TCP_NLA_SND_CWND,
+	TCP_NLA_REORDERING,
+	TCP_NLA_MIN_RTT,
+	TCP_NLA_RECUR_RETRANS,
+	TCP_NLA_DELIVERY_RATE_APP_LMT,
+	TCP_NLA_SNDQ_SIZE,
+	TCP_NLA_CA_STATE,
+	TCP_NLA_SND_SSTHRESH,
 };
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-- 
2.16.3


[-- Attachment #11: 0010-add-ETH_P_PREAUTH-ethertype-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 748 bytes --]

From 6bd4c418aec4a11bcec814dec11f567e0fbbe134 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 21:20:45 +0000
Subject: [PATCH 10/16] add ETH_P_PREAUTH ethertype from linux v4.17

added in linux commit 4fe0de5b143762d327bfaf1d7be7c5b58041a18c
---
 include/netinet/if_ether.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
index f7df5f7f..ecd6c73c 100644
--- a/include/netinet/if_ether.h
+++ b/include/netinet/if_ether.h
@@ -56,6 +56,7 @@
 #define ETH_P_8021AD	0x88A8
 #define ETH_P_802_EX1	0x88B5
 #define ETH_P_ERSPAN	0x88BE
+#define ETH_P_PREAUTH	0x88C7
 #define ETH_P_TIPC	0x88CA
 #define ETH_P_MACSEC	0x88E5
 #define ETH_P_8021AH	0x88E7
-- 
2.16.3


[-- Attachment #12: 0011-add-speculation-control-prctls-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 1071 bytes --]

From e5096769c07b8a8128ff8f65685d87751308eb6b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 21:23:54 +0000
Subject: [PATCH 11/16] add speculation control prctls from linux v4.17

PR_{SET,GET}_SPECULATION_CTRL controls speculation related vulnerability
mitigations, new in commits
b617cfc858161140d69cc0b5cc211996b557a1c7
356e4bfff2c5489e016fdb925adbf12a1e3950ee
---
 include/sys/prctl.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/sys/prctl.h b/include/sys/prctl.h
index aa0c7a88..af76408c 100644
--- a/include/sys/prctl.h
+++ b/include/sys/prctl.h
@@ -136,6 +136,15 @@ struct prctl_mm_map {
 #define PR_SVE_VL_LEN_MASK 0xffff
 #define PR_SVE_VL_INHERIT (1 << 17)
 
+#define PR_GET_SPECULATION_CTRL 52
+#define PR_SET_SPECULATION_CTRL 53
+#define PR_SPEC_STORE_BYPASS 0
+#define PR_SPEC_NOT_AFFECTED 0
+#define PR_SPEC_PRCTL (1UL << 0)
+#define PR_SPEC_ENABLE (1UL << 1)
+#define PR_SPEC_DISABLE (1UL << 2)
+#define PR_SPEC_FORCE_DISABLE (1UL << 3)
+
 int prctl (int, ...);
 
 #ifdef __cplusplus
-- 
2.16.3


[-- Attachment #13: 0012-aarch64-add-HWCAP_-flags-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 785 bytes --]

From f646e8a04e76b33c7edbd8ab87279b24c660039d Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 22:51:08 +0000
Subject: [PATCH 12/16] aarch64: add HWCAP_ flags from linux v4.17

hwcaps for armv8.4, new in linux commit
7206dc93a58fb76421c4411eefa3c003337bcb2d
---
 arch/aarch64/bits/hwcap.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/aarch64/bits/hwcap.h b/arch/aarch64/bits/hwcap.h
index 6fa64e8c..8541e329 100644
--- a/arch/aarch64/bits/hwcap.h
+++ b/arch/aarch64/bits/hwcap.h
@@ -22,3 +22,7 @@
 #define HWCAP_SHA512		(1 << 21)
 #define HWCAP_SVE		(1 << 22)
 #define HWCAP_ASIMDFHM		(1 << 23)
+#define HWCAP_DIT		(1 << 24)
+#define HWCAP_USCAT		(1 << 25)
+#define HWCAP_ILRCPC		(1 << 26)
+#define HWCAP_FLAGM		(1 << 27)
-- 
2.16.3


[-- Attachment #14: 0013-mips-add-HWCAP_-flags-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 1247 bytes --]

From dd576cc5bd1118f01efdac52f2b234cee780016f Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 22:58:19 +0000
Subject: [PATCH 13/16] mips: add HWCAP_ flags from linux v4.17

new in linux commit 256211f2b0b251e532d1899b115e374feb16fa7a
---
 arch/mips/bits/hwcap.h    | 1 +
 arch/mips64/bits/hwcap.h  | 1 +
 arch/mipsn32/bits/hwcap.h | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/mips/bits/hwcap.h b/arch/mips/bits/hwcap.h
index 05cffba4..13e86fe7 100644
--- a/arch/mips/bits/hwcap.h
+++ b/arch/mips/bits/hwcap.h
@@ -1,2 +1,3 @@
 #define HWCAP_MIPS_R6		(1 << 0)
 #define HWCAP_MIPS_MSA		(1 << 1)
+#define HWCAP_MIPS_CRC32	(1 << 2)
diff --git a/arch/mips64/bits/hwcap.h b/arch/mips64/bits/hwcap.h
index 05cffba4..13e86fe7 100644
--- a/arch/mips64/bits/hwcap.h
+++ b/arch/mips64/bits/hwcap.h
@@ -1,2 +1,3 @@
 #define HWCAP_MIPS_R6		(1 << 0)
 #define HWCAP_MIPS_MSA		(1 << 1)
+#define HWCAP_MIPS_CRC32	(1 << 2)
diff --git a/arch/mipsn32/bits/hwcap.h b/arch/mipsn32/bits/hwcap.h
index 05cffba4..13e86fe7 100644
--- a/arch/mipsn32/bits/hwcap.h
+++ b/arch/mipsn32/bits/hwcap.h
@@ -1,2 +1,3 @@
 #define HWCAP_MIPS_R6		(1 << 0)
 #define HWCAP_MIPS_MSA		(1 << 1)
+#define HWCAP_MIPS_CRC32	(1 << 2)
-- 
2.16.3


[-- Attachment #15: 0014-s390x-add-kexec_file_load-syscall-number-from-linux-.patch --]
[-- Type: text/x-diff, Size: 752 bytes --]

From 3e0e6257fa4fff41f816d8c97a2039180316158d Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 23:03:48 +0000
Subject: [PATCH 14/16] s390x: add kexec_file_load syscall number from linux
 v4.17

new in linux commit 71406883fd35794d573b3085433c41d0a3bf6c21
---
 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 c965664c..409e9155 100644
--- a/arch/s390x/bits/syscall.h.in
+++ b/arch/s390x/bits/syscall.h.in
@@ -323,4 +323,5 @@
 #define __NR_s390_guarded_storage       378
 #define __NR_statx                      379
 #define __NR_s390_sthyi                 380
+#define __NR_kexec_file_load            381
 
-- 
2.16.3


[-- Attachment #16: 0015-add-si_codes-from-linux-v4.17.patch --]
[-- Type: text/x-diff, Size: 1321 bytes --]

From 45493abeb3918e3722ef8d75bf231ef155a2b755 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 9 Jun 2018 23:22:51 +0000
Subject: [PATCH 15/16] add si_codes from linux v4.17

target specific si_codes were made generic in linux commits
a402ab8cc7b0578c445f348c9010e62ab390bee8 (ia64) and
75abf64287cab73546382a4fa7fa2f4e3516efeb (parisc)
---
 include/signal.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/signal.h b/include/signal.h
index a4f85cca..69395468 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -61,6 +61,13 @@ typedef struct sigaltstack stack_t;
 #define FPE_FLTRES 6
 #define FPE_FLTINV 7
 #define FPE_FLTSUB 8
+#define __FPE_DECOVF 9
+#define __FPE_DECDIV 10
+#define __FPE_DECERR 11
+#define __FPE_INVASC 12
+#define __FPE_INVDEC 13
+#define FPE_FLTUNK 14
+#define FPE_CONDTRAP 15
 
 #define ILL_ILLOPC 1
 #define ILL_ILLOPN 2
@@ -70,11 +77,17 @@ typedef struct sigaltstack stack_t;
 #define ILL_PRVREG 6
 #define ILL_COPROC 7
 #define ILL_BADSTK 8
+#define ILL_BADIADDR 9
+#define __ILL_BREAK 10
+#define __ILL_BNDMOD 11
 
 #define SEGV_MAPERR 1
 #define SEGV_ACCERR 2
 #define SEGV_BNDERR 3
 #define SEGV_PKUERR 4
+#define SEGV_ACCADI 5
+#define SEGV_ADIDERR 6
+#define SEGV_ADIPERR 7
 
 #define BUS_ADRALN 1
 #define BUS_ADRERR 2
-- 
2.16.3


[-- Attachment #17: 0016-Add-memfd_create-mlock2-and-pkey_-apis.patch --]
[-- Type: text/x-diff, Size: 5984 bytes --]

From 9e18e6e7854d17aa1639d6145584df27f4b4f856 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 28 Apr 2018 17:25:41 +0000
Subject: [PATCH 16/16] Add memfd_create, mlock2 and pkey_* apis

This patch adds support for the following linux syscalls and related
interfaces following glibc:

memfd_create (linux v3.17)
mlock2 (linux v4.4)
pkey_alloc (linux v4.9)
pkey_free (linux v4.9)
pkey_mprotect (linux v4.9)
pkey_get (glibc 2.27)
pkey_set (glibc 2.27)

pkey_get / pkey_set are glibc apis, not syscalls, only an always
failing generic implementation is provided in this patch, for pkey_
apis to be useful these will need target specific implementations.

MLOCK_ONFAULT is moved under _GNU_SOURCE following glibc.

Similar to glibc, mlock2 and pkey_mprotect have fallbacks to mlock and
mprotect respectively in case of special arguments.
---
 arch/powerpc/bits/mman.h   |  4 ++++
 arch/powerpc64/bits/mman.h |  4 ++++
 include/sys/mman.h         | 24 +++++++++++++++++++++---
 src/linux/memfd_create.c   |  8 ++++++++
 src/linux/mlock2.c         | 11 +++++++++++
 src/linux/pkey_alloc.c     | 22 ++++++++++++++++++++++
 src/linux/pkey_get.c       |  9 +++++++++
 src/linux/pkey_mprotect.c  | 15 +++++++++++++++
 src/linux/pkey_set.c       |  9 +++++++++
 9 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 src/linux/memfd_create.c
 create mode 100644 src/linux/mlock2.c
 create mode 100644 src/linux/pkey_alloc.c
 create mode 100644 src/linux/pkey_get.c
 create mode 100644 src/linux/pkey_mprotect.c
 create mode 100644 src/linux/pkey_set.c

diff --git a/arch/powerpc/bits/mman.h b/arch/powerpc/bits/mman.h
index b3a675a8..23e18eb1 100644
--- a/arch/powerpc/bits/mman.h
+++ b/arch/powerpc/bits/mman.h
@@ -12,3 +12,7 @@
 #define MCL_FUTURE      0x4000
 #undef MCL_ONFAULT
 #define MCL_ONFAULT     0x8000
+
+#ifdef _GNU_SOURCE
+#define PKEY_DISABLE_EXECUTE   0x4
+#endif
diff --git a/arch/powerpc64/bits/mman.h b/arch/powerpc64/bits/mman.h
index b3a675a8..23e18eb1 100644
--- a/arch/powerpc64/bits/mman.h
+++ b/arch/powerpc64/bits/mman.h
@@ -12,3 +12,7 @@
 #define MCL_FUTURE      0x4000
 #undef MCL_ONFAULT
 #define MCL_ONFAULT     0x8000
+
+#ifdef _GNU_SOURCE
+#define PKEY_DISABLE_EXECUTE   0x4
+#endif
diff --git a/include/sys/mman.h b/include/sys/mman.h
index 19dd844e..643f882d 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -94,6 +94,20 @@ extern "C" {
 #define MADV_SOFT_OFFLINE 101
 #endif
 
+#ifdef _GNU_SOURCE
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+
+#define PKEY_DISABLE_ACCESS 0x1
+#define PKEY_DISABLE_WRITE 0x2
+
+#define MLOCK_ONFAULT 0x01
+
+#define MFD_CLOEXEC 0x0001U
+#define MFD_ALLOW_SEALING 0x0002U
+#define MFD_HUGETLB 0x0004U
+#endif
+
 #include <bits/mman.h>
 
 void *mmap (void *, size_t, int, int, int, off_t);
@@ -110,14 +124,18 @@ int mlockall (int);
 int munlockall (void);
 
 #ifdef _GNU_SOURCE
-#define MREMAP_MAYMOVE 1
-#define MREMAP_FIXED 2
 void *mremap (void *, size_t, size_t, int, ...);
 int remap_file_pages (void *, size_t, int, size_t, int);
+int memfd_create (const char *, unsigned);
+int mlock2 (const void *, size_t, unsigned);
+int pkey_alloc (unsigned, unsigned);
+int pkey_free (int);
+int pkey_mprotect (void *, size_t, int, int);
+int pkey_get (int);
+int pkey_set (int, unsigned);
 #endif
 
 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-#define MLOCK_ONFAULT   0x01
 int madvise (void *, size_t, int);
 int mincore (void *, size_t, unsigned char *);
 #endif
diff --git a/src/linux/memfd_create.c b/src/linux/memfd_create.c
new file mode 100644
index 00000000..1649fe55
--- /dev/null
+++ b/src/linux/memfd_create.c
@@ -0,0 +1,8 @@
+#define _GNU_SOURCE 1
+#include <sys/mman.h>
+#include "syscall.h"
+
+int memfd_create(const char *name, unsigned flags)
+{
+	return syscall(SYS_memfd_create, name, flags);
+}
diff --git a/src/linux/mlock2.c b/src/linux/mlock2.c
new file mode 100644
index 00000000..e1235c46
--- /dev/null
+++ b/src/linux/mlock2.c
@@ -0,0 +1,11 @@
+#define _GNU_SOURCE 1
+#include <sys/mman.h>
+#include <errno.h>
+#include "syscall.h"
+
+int mlock2(const void *addr, size_t len, unsigned flags)
+{
+	if (flags == 0)
+		return mlock(addr, len);
+	return syscall(SYS_mlock2, addr, len, flags);
+}
diff --git a/src/linux/pkey_alloc.c b/src/linux/pkey_alloc.c
new file mode 100644
index 00000000..8027cd12
--- /dev/null
+++ b/src/linux/pkey_alloc.c
@@ -0,0 +1,22 @@
+#define _GNU_SOURCE 1
+#include <sys/mman.h>
+#include <errno.h>
+#include "syscall.h"
+
+int pkey_alloc(unsigned flags, unsigned access)
+{
+#ifdef SYS_pkey_alloc
+	return syscall(SYS_pkey_alloc, flags, access);
+#else
+	return __syscall_ret(-ENOSYS);
+#endif
+}
+
+int pkey_free(int pkey)
+{
+#ifdef SYS_pkey_free
+	return syscall(SYS_pkey_free, pkey);
+#else
+	return __syscall_ret(-ENOSYS);
+#endif
+}
diff --git a/src/linux/pkey_get.c b/src/linux/pkey_get.c
new file mode 100644
index 00000000..d583fa9c
--- /dev/null
+++ b/src/linux/pkey_get.c
@@ -0,0 +1,9 @@
+#define _GNU_SOURCE 1
+#include <sys/mman.h>
+#include <errno.h>
+#include "syscall.h"
+
+int pkey_get(int pkey)
+{
+	return __syscall_ret(-ENOSYS);
+}
diff --git a/src/linux/pkey_mprotect.c b/src/linux/pkey_mprotect.c
new file mode 100644
index 00000000..0a1f97ad
--- /dev/null
+++ b/src/linux/pkey_mprotect.c
@@ -0,0 +1,15 @@
+#define _GNU_SOURCE 1
+#include <sys/mman.h>
+#include <errno.h>
+#include "syscall.h"
+
+int pkey_mprotect(void *addr, size_t len, int prot, int pkey)
+{
+	if (pkey == -1)
+		return mprotect(addr, len, prot);
+#ifdef SYS_pkey_mprotect
+	return syscall(SYS_pkey_mprotect, addr, len, prot, pkey);
+#else
+	return __syscall_ret(-ENOSYS);
+#endif
+}
diff --git a/src/linux/pkey_set.c b/src/linux/pkey_set.c
new file mode 100644
index 00000000..addf8da5
--- /dev/null
+++ b/src/linux/pkey_set.c
@@ -0,0 +1,9 @@
+#define _GNU_SOURCE 1
+#include <sys/mman.h>
+#include <errno.h>
+#include "syscall.h"
+
+int pkey_set(int pkey, unsigned access)
+{
+	return __syscall_ret(-ENOSYS);
+}
-- 
2.16.3


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

* Re: [PATCH 00/16] Linux v4.16 and v4.17 updates
  2018-06-14 23:03 [PATCH 00/16] Linux v4.16 and v4.17 updates Szabolcs Nagy
@ 2018-06-19 17:33 ` Rich Felker
  2018-06-19 19:55   ` Szabolcs Nagy
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2018-06-19 17:33 UTC (permalink / raw)
  To: musl

On Fri, Jun 15, 2018 at 01:03:38AM +0200, Szabolcs Nagy wrote:
> respin of the v4.16 patches
> http://www.openwall.com/lists/musl/2018/04/28/1
> without the siginfo changes and with v4.17 additions.
> 
> the last patch is adding missing memory mapping related
> syscall wrappers, the pkey* support is incomplete.
> 
> Szabolcs Nagy (16):
>   sys/epoll.h: add EPOLLNVAL from linux v4.16
>   netinet/if_ether.h: add ETH_P_ERSPAN2 from linux v4.16
>   netinet/if_ether.h: add ETH_TLEN from linux v4.16
>   sys/ptrace.h: add PTRACE_SECCOMP_GET_METADATA from linux v4.16
>   aarch64: add HWCAP_ASIMDFHM from linux v4.16
>   powerpc: add pkey syscall numbers from linux v4.16
>   add MAP_FIXED_NOREPLACE from linux v4.17
>   add {MSG,SEM,SHM}_STAT_ANY from linux v4.17
>   add TCP_NLA_* from linux v4.17
>   add ETH_P_PREAUTH ethertype from linux v4.17
>   add speculation control prctls from linux v4.17
>   aarch64: add HWCAP_ flags from linux v4.17
>   mips: add HWCAP_ flags from linux v4.17
>   s390x: add kexec_file_load syscall number from linux v4.17

All of these look fine, committing as-is.

>   add si_codes from linux v4.17
>   Add memfd_create, mlock2 and pkey_* apis

See below:

> From 45493abeb3918e3722ef8d75bf231ef155a2b755 Mon Sep 17 00:00:00 2001
> From: Szabolcs Nagy <nsz@port70.net>
> Date: Sat, 9 Jun 2018 23:22:51 +0000
> Subject: [PATCH 15/16] add si_codes from linux v4.17
> 
> target specific si_codes were made generic in linux commits
> a402ab8cc7b0578c445f348c9010e62ab390bee8 (ia64) and
> 75abf64287cab73546382a4fa7fa2f4e3516efeb (parisc)
> ---
>  include/signal.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/include/signal.h b/include/signal.h
> index a4f85cca..69395468 100644
> --- a/include/signal.h
> +++ b/include/signal.h
> @@ -61,6 +61,13 @@ typedef struct sigaltstack stack_t;
>  #define FPE_FLTRES 6
>  #define FPE_FLTINV 7
>  #define FPE_FLTSUB 8
> +#define __FPE_DECOVF 9
> +#define __FPE_DECDIV 10
> +#define __FPE_DECERR 11
> +#define __FPE_INVASC 12
> +#define __FPE_INVDEC 13
> +#define FPE_FLTUNK 14
> +#define FPE_CONDTRAP 15
>  
>  #define ILL_ILLOPC 1
>  #define ILL_ILLOPN 2
> @@ -70,11 +77,17 @@ typedef struct sigaltstack stack_t;
>  #define ILL_PRVREG 6
>  #define ILL_COPROC 7
>  #define ILL_BADSTK 8
> +#define ILL_BADIADDR 9
> +#define __ILL_BREAK 10
> +#define __ILL_BNDMOD 11

Is there a reason some of these are __-prefixed? They don't need too
be (FPE_* and ILL_* are reserved for signal.h) and it seems wrong that
macros intended to be used by the application are in the
reserved-for-implementation-use namespace rather than the public one
for the interface.

> From 9e18e6e7854d17aa1639d6145584df27f4b4f856 Mon Sep 17 00:00:00 2001
> From: Szabolcs Nagy <nsz@port70.net>
> Date: Sat, 28 Apr 2018 17:25:41 +0000
> Subject: [PATCH 16/16] Add memfd_create, mlock2 and pkey_* apis
> 
> This patch adds support for the following linux syscalls and related
> interfaces following glibc:
> 
> memfd_create (linux v3.17)
> mlock2 (linux v4.4)
> pkey_alloc (linux v4.9)
> pkey_free (linux v4.9)
> pkey_mprotect (linux v4.9)
> pkey_get (glibc 2.27)
> pkey_set (glibc 2.27)
> 
> pkey_get / pkey_set are glibc apis, not syscalls, only an always
> failing generic implementation is provided in this patch, for pkey_
> apis to be useful these will need target specific implementations.
> 
> MLOCK_ONFAULT is moved under _GNU_SOURCE following glibc.
> 
> Similar to glibc, mlock2 and pkey_mprotect have fallbacks to mlock and
> mprotect respectively in case of special arguments.

I'm holding off on this one just because I don't understand the pkey
stuff, and it looks like it's not actually functional without
additional arch-specific code.

It might also make sense to split this into 2 or 3 patches, since
memfd_create and mlock2 seem like separate, simple functionality
unrelated to the pkey stuff.

Rich


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

* Re: [PATCH 00/16] Linux v4.16 and v4.17 updates
  2018-06-19 17:33 ` Rich Felker
@ 2018-06-19 19:55   ` Szabolcs Nagy
  2018-06-20  1:11     ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2018-06-19 19:55 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@libc.org> [2018-06-19 13:33:15 -0400]:
> On Fri, Jun 15, 2018 at 01:03:38AM +0200, Szabolcs Nagy wrote:
> > From 45493abeb3918e3722ef8d75bf231ef155a2b755 Mon Sep 17 00:00:00 2001
> > From: Szabolcs Nagy <nsz@port70.net>
> > Date: Sat, 9 Jun 2018 23:22:51 +0000
> > Subject: [PATCH 15/16] add si_codes from linux v4.17
> > 
> > target specific si_codes were made generic in linux commits
> > a402ab8cc7b0578c445f348c9010e62ab390bee8 (ia64) and
> > 75abf64287cab73546382a4fa7fa2f4e3516efeb (parisc)
> > ---
> >  include/signal.h | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/include/signal.h b/include/signal.h
> > index a4f85cca..69395468 100644
> > --- a/include/signal.h
> > +++ b/include/signal.h
> > @@ -61,6 +61,13 @@ typedef struct sigaltstack stack_t;
> >  #define FPE_FLTRES 6
> >  #define FPE_FLTINV 7
> >  #define FPE_FLTSUB 8
> > +#define __FPE_DECOVF 9
> > +#define __FPE_DECDIV 10
> > +#define __FPE_DECERR 11
> > +#define __FPE_INVASC 12
> > +#define __FPE_INVDEC 13
> > +#define FPE_FLTUNK 14
> > +#define FPE_CONDTRAP 15
> >  
> >  #define ILL_ILLOPC 1
> >  #define ILL_ILLOPN 2
> > @@ -70,11 +77,17 @@ typedef struct sigaltstack stack_t;
> >  #define ILL_PRVREG 6
> >  #define ILL_COPROC 7
> >  #define ILL_BADSTK 8
> > +#define ILL_BADIADDR 9
> > +#define __ILL_BREAK 10
> > +#define __ILL_BNDMOD 11
> 
> Is there a reason some of these are __-prefixed? They don't need too
> be (FPE_* and ILL_* are reserved for signal.h) and it seems wrong that
> macros intended to be used by the application are in the
> reserved-for-implementation-use namespace rather than the public one
> for the interface.
> 

this is how linux uapi exposes them

however it seems glibc has them without __ (and only on ia64)

i thought glibc included linux uapi but apparently it has its
own thing, so probably it's better if we don't do this.

> > From 9e18e6e7854d17aa1639d6145584df27f4b4f856 Mon Sep 17 00:00:00 2001
> > From: Szabolcs Nagy <nsz@port70.net>
> > Date: Sat, 28 Apr 2018 17:25:41 +0000
> > Subject: [PATCH 16/16] Add memfd_create, mlock2 and pkey_* apis
> > 
> > This patch adds support for the following linux syscalls and related
> > interfaces following glibc:
> > 
> > memfd_create (linux v3.17)
> > mlock2 (linux v4.4)
> > pkey_alloc (linux v4.9)
> > pkey_free (linux v4.9)
> > pkey_mprotect (linux v4.9)
> > pkey_get (glibc 2.27)
> > pkey_set (glibc 2.27)
> > 
> > pkey_get / pkey_set are glibc apis, not syscalls, only an always
> > failing generic implementation is provided in this patch, for pkey_
> > apis to be useful these will need target specific implementations.
> > 
> > MLOCK_ONFAULT is moved under _GNU_SOURCE following glibc.
> > 
> > Similar to glibc, mlock2 and pkey_mprotect have fallbacks to mlock and
> > mprotect respectively in case of special arguments.
> 
> I'm holding off on this one just because I don't understand the pkey
> stuff, and it looks like it's not actually functional without
> additional arch-specific code.
> 
> It might also make sense to split this into 2 or 3 patches, since
> memfd_create and mlock2 seem like separate, simple functionality
> unrelated to the pkey stuff.
> 

ok, i'll split those out.


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

* Re: [PATCH 00/16] Linux v4.16 and v4.17 updates
  2018-06-19 19:55   ` Szabolcs Nagy
@ 2018-06-20  1:11     ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2018-06-20  1:11 UTC (permalink / raw)
  To: musl

On Tue, Jun 19, 2018 at 09:55:17PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2018-06-19 13:33:15 -0400]:
> > On Fri, Jun 15, 2018 at 01:03:38AM +0200, Szabolcs Nagy wrote:
> > > From 45493abeb3918e3722ef8d75bf231ef155a2b755 Mon Sep 17 00:00:00 2001
> > > From: Szabolcs Nagy <nsz@port70.net>
> > > Date: Sat, 9 Jun 2018 23:22:51 +0000
> > > Subject: [PATCH 15/16] add si_codes from linux v4.17
> > > 
> > > target specific si_codes were made generic in linux commits
> > > a402ab8cc7b0578c445f348c9010e62ab390bee8 (ia64) and
> > > 75abf64287cab73546382a4fa7fa2f4e3516efeb (parisc)
> > > ---
> > >  include/signal.h | 13 +++++++++++++
> > >  1 file changed, 13 insertions(+)
> > > 
> > > diff --git a/include/signal.h b/include/signal.h
> > > index a4f85cca..69395468 100644
> > > --- a/include/signal.h
> > > +++ b/include/signal.h
> > > @@ -61,6 +61,13 @@ typedef struct sigaltstack stack_t;
> > >  #define FPE_FLTRES 6
> > >  #define FPE_FLTINV 7
> > >  #define FPE_FLTSUB 8
> > > +#define __FPE_DECOVF 9
> > > +#define __FPE_DECDIV 10
> > > +#define __FPE_DECERR 11
> > > +#define __FPE_INVASC 12
> > > +#define __FPE_INVDEC 13
> > > +#define FPE_FLTUNK 14
> > > +#define FPE_CONDTRAP 15
> > >  
> > >  #define ILL_ILLOPC 1
> > >  #define ILL_ILLOPN 2
> > > @@ -70,11 +77,17 @@ typedef struct sigaltstack stack_t;
> > >  #define ILL_PRVREG 6
> > >  #define ILL_COPROC 7
> > >  #define ILL_BADSTK 8
> > > +#define ILL_BADIADDR 9
> > > +#define __ILL_BREAK 10
> > > +#define __ILL_BNDMOD 11
> > 
> > Is there a reason some of these are __-prefixed? They don't need too
> > be (FPE_* and ILL_* are reserved for signal.h) and it seems wrong that
> > macros intended to be used by the application are in the
> > reserved-for-implementation-use namespace rather than the public one
> > for the interface.
> > 
> 
> this is how linux uapi exposes them
> 
> however it seems glibc has them without __ (and only on ia64)
> 
> i thought glibc included linux uapi but apparently it has its
> own thing, so probably it's better if we don't do this.

If they're ia64 (itanic) only we can just omit them entirely, I think.

> > > From 9e18e6e7854d17aa1639d6145584df27f4b4f856 Mon Sep 17 00:00:00 2001
> > > From: Szabolcs Nagy <nsz@port70.net>
> > > Date: Sat, 28 Apr 2018 17:25:41 +0000
> > > Subject: [PATCH 16/16] Add memfd_create, mlock2 and pkey_* apis
> > > 
> > > This patch adds support for the following linux syscalls and related
> > > interfaces following glibc:
> > > 
> > > memfd_create (linux v3.17)
> > > mlock2 (linux v4.4)
> > > pkey_alloc (linux v4.9)
> > > pkey_free (linux v4.9)
> > > pkey_mprotect (linux v4.9)
> > > pkey_get (glibc 2.27)
> > > pkey_set (glibc 2.27)
> > > 
> > > pkey_get / pkey_set are glibc apis, not syscalls, only an always
> > > failing generic implementation is provided in this patch, for pkey_
> > > apis to be useful these will need target specific implementations.
> > > 
> > > MLOCK_ONFAULT is moved under _GNU_SOURCE following glibc.
> > > 
> > > Similar to glibc, mlock2 and pkey_mprotect have fallbacks to mlock and
> > > mprotect respectively in case of special arguments.
> > 
> > I'm holding off on this one just because I don't understand the pkey
> > stuff, and it looks like it's not actually functional without
> > additional arch-specific code.
> > 
> > It might also make sense to split this into 2 or 3 patches, since
> > memfd_create and mlock2 seem like separate, simple functionality
> > unrelated to the pkey stuff.
> > 
> 
> ok, i'll split those out.

Sounds good. Then I can merge the trivial ones and we can discuss the
pkey stuff and what the requirements for a working implementation are.

Rich


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

end of thread, other threads:[~2018-06-20  1:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 23:03 [PATCH 00/16] Linux v4.16 and v4.17 updates Szabolcs Nagy
2018-06-19 17:33 ` Rich Felker
2018-06-19 19:55   ` Szabolcs Nagy
2018-06-20  1:11     ` 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).