[00/22] Updates for linux v4.19, v4.20 and v5.0

Submitted by Szabolcs Nagy on March 7, 2019, 11:12 p.m.

Details

Message ID 20190307231251.GD26605@port70.net
State New
Series "Updates for linux v4.19, v4.20 and v5.0"
Headers show

Patch hide | download patch | download mbox

From 859d08a51ca7c5eafe232cf1d33bf1e8d4731ee1 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Thu, 7 Mar 2019 21:58:12 +0000
Subject: [PATCH 22/22] aarch64: add HWCAP_ definitions from linux v5.0

HWCAP_SB - speculation barrier instruction available added in linux
commit bd4fb6d270bc423a9a4098108784f7f9254c4e6d
HWCAP_PACA, HWCAP_PACG - pointer authentication instructions available
(address and generic) added in linux commit
7503197562567b57ec14feb3a9d5400ebc56812f
---
 arch/aarch64/bits/hwcap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/aarch64/bits/hwcap.h b/arch/aarch64/bits/hwcap.h
index 8c040014..ad670914 100644
--- a/arch/aarch64/bits/hwcap.h
+++ b/arch/aarch64/bits/hwcap.h
@@ -27,3 +27,6 @@ 
 #define HWCAP_ILRCPC		(1 << 26)
 #define HWCAP_FLAGM		(1 << 27)
 #define HWCAP_SSBS		(1 << 28)
+#define HWCAP_SB		(1 << 29)
+#define HWCAP_PACA		(1 << 30)
+#define HWCAP_PACG		(1UL << 31)
-- 
2.19.1


Comments

Rich Felker March 8, 2019, 8:32 p.m.
On Fri, Mar 08, 2019 at 12:12:51AM +0100, Szabolcs Nagy wrote:
> build tested on arm, aarch64, i386, m68k, mips, mips64, powerpc,
> powerpc64le, s390x, sh4 and x86_64.
> 
> Szabolcs Nagy (22):
>   sys/socket.h: add SO_TXTIME from linux v4.19
>   sys/inotify.h: add IN_MASK_CREATE from linux v4.19
>   netinet/tcp.h: add tcp_info fields from linux v4.19
>   netinet/udp.h: add UDP_ENCAP_RXRPC from linux v4.19
>   elf.h: add new mips core dump note values from linux v4.19
>   aarch64, or1k: define rseq syscall number following linux v4.19
>   arm: add io_pgetevents syscall number from v4.19
>   sys/mman.h: add new hugetlb mmap flags from linux v4.19
>   add PACKET_IGNORE_OUTGOING sockopt from linux v4.20
>   netinet/in.h update following linux v4.20
>   netinet/in.h add IPV6_MULTICAST_ALL from linux v4.20
>   sys/prctl.h: add PR_SPEC_INDIRECT_BRANCH from linux v4.20
>   bits/ioctl.h: add TIOC{G,S}ISO7816 from linux v4.20
>   aarch64: add HWCAP_SSBS from linux v4.20
>   powerpc: add PTRACE_SYSEMU from linux v4.20
>   netinet/udp.h: add UDP_GRO from linux v5.0
>   netinet/tcp.h: add TCP_NLA_SRTT from linux v5.0
>   aarch64, or1k: add kexec_file_load syscall number from linux v5.0
>   elf.h: update with C-SKY definitions
>   elf.h: add NT_ definitions from linux v5.0
>   sys/prctl.h: add PR_PAC_RESET_KEYS from linux v5.0
>   aarch64: add HWCAP_ definitions from linux v5.0

Looks mostly ok. Some questions:

> From d8b15a06288dee0895bd6b51cbb81f3c696ba504 Mon Sep 17 00:00:00 2001
> From: Szabolcs Nagy <nsz@port70.net>
> Date: Wed, 23 Jan 2019 20:06:12 +0000
> Subject: [PATCH 10/22] netinet/in.h update following linux v4.20
> 
> IN_BADCLASS and IN_EXPERIMENTAL are changed and new macros are added
> for class-e addresses.
> 
> linux commit 65cab850f0eeaa9180bd2e10a231964f33743edf
> ---
>  include/netinet/in.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/include/netinet/in.h b/include/netinet/in.h
> index 192679a6..2f87e33f 100644
> --- a/include/netinet/in.h
> +++ b/include/netinet/in.h
> @@ -168,8 +168,12 @@ uint16_t ntohs(uint16_t);
>  #define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
>  #define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
>  #define	IN_MULTICAST(a)		IN_CLASSD(a)
> -#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
> -#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
> +#define	IN_MULTICAST_NET	0xe0000000
> +#define	IN_BADCLASS(a)		((((in_addr_t)(a)) == 0xffffffff)
> +#define	IN_EXPERIMENTAL(a)	IN_BADCLASS((a))
> +#define	IN_CLASSE(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
> +#define	IN_CLASSE_NET		0xffffffff
> +#define	IN_CLASSE_NSHIFT	0

You've described these as Linux 4.20 additions, but they aren't
specific to any Linux API or defined by Linux as far as I can tell.
Rather, aren't they aligned with some change by IANA or something? The
motivation for having them would not be that Linux made corresponding
changes in kernel headers, but rather that they're the proper
definitions for changes to a relevant network-related standard.

> From f06c03ef3ce4c21d15416e071d3a7e2bab40928a Mon Sep 17 00:00:00 2001
> From: Szabolcs Nagy <nsz@port70.net>
> Date: Thu, 7 Mar 2019 21:53:48 +0000
> Subject: [PATCH 21/22] sys/prctl.h: add PR_PAC_RESET_KEYS from linux v5.0
> 
> aarch64 pointer authentication code related prctl that allows
> reinitializing the key for the thread, added in linux commit
> ba830885656414101b2f8ca88786524d4bb5e8c1
> ---
>  include/sys/prctl.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/sys/prctl.h b/include/sys/prctl.h
> index 07a3490b..4b6c8918 100644
> --- a/include/sys/prctl.h
> +++ b/include/sys/prctl.h
> @@ -146,6 +146,13 @@ struct prctl_mm_map {
>  #define PR_SPEC_DISABLE (1UL << 2)
>  #define PR_SPEC_FORCE_DISABLE (1UL << 3)
>  
> +#define PR_PAC_RESET_KEYS       54
> +# define PR_PAC_APIAKEY (1UL << 0)
> +# define PR_PAC_APIBKEY (1UL << 1)
> +# define PR_PAC_APDAKEY (1UL << 2)
> +# define PR_PAC_APDBKEY (1UL << 3)
> +# define PR_PAC_APGAKEY (1UL << 4)
> +
>  int prctl (int, ...);

Is there a reason for this formatting? It's unlike anything we use
elsewhere in the file or elsewhere in musl.

Rich
Szabolcs Nagy March 8, 2019, 10:53 p.m.
* Rich Felker <dalias@libc.org> [2019-03-08 15:32:45 -0500]:
> On Fri, Mar 08, 2019 at 12:12:51AM +0100, Szabolcs Nagy wrote:
> > From d8b15a06288dee0895bd6b51cbb81f3c696ba504 Mon Sep 17 00:00:00 2001
> > From: Szabolcs Nagy <nsz@port70.net>
> > Date: Wed, 23 Jan 2019 20:06:12 +0000
> > Subject: [PATCH 10/22] netinet/in.h update following linux v4.20
> > 
> > IN_BADCLASS and IN_EXPERIMENTAL are changed and new macros are added
> > for class-e addresses.
> > 
> > linux commit 65cab850f0eeaa9180bd2e10a231964f33743edf
> > ---
> >  include/netinet/in.h | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/netinet/in.h b/include/netinet/in.h
> > index 192679a6..2f87e33f 100644
> > --- a/include/netinet/in.h
> > +++ b/include/netinet/in.h
> > @@ -168,8 +168,12 @@ uint16_t ntohs(uint16_t);
> >  #define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
> >  #define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
> >  #define	IN_MULTICAST(a)		IN_CLASSD(a)
> > -#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
> > -#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
> > +#define	IN_MULTICAST_NET	0xe0000000
> > +#define	IN_BADCLASS(a)		((((in_addr_t)(a)) == 0xffffffff)
> > +#define	IN_EXPERIMENTAL(a)	IN_BADCLASS((a))
> > +#define	IN_CLASSE(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
> > +#define	IN_CLASSE_NET		0xffffffff
> > +#define	IN_CLASSE_NSHIFT	0
> 
> You've described these as Linux 4.20 additions, but they aren't
> specific to any Linux API or defined by Linux as far as I can tell.
> Rather, aren't they aligned with some change by IANA or something? The
> motivation for having them would not be that Linux made corresponding
> changes in kernel headers, but rather that they're the proper
> definitions for changes to a relevant network-related standard.

my idea was to enable users to use netinet/in.h instead
of linux/in.h, so new definitions added there are blindly
copied (i didn't fully understand the linux commit
message explaining why this change was useful, so yes this
may need some investigation)

> > From f06c03ef3ce4c21d15416e071d3a7e2bab40928a Mon Sep 17 00:00:00 2001
> > From: Szabolcs Nagy <nsz@port70.net>
> > Date: Thu, 7 Mar 2019 21:53:48 +0000
> > Subject: [PATCH 21/22] sys/prctl.h: add PR_PAC_RESET_KEYS from linux v5.0
> > 
> > aarch64 pointer authentication code related prctl that allows
> > reinitializing the key for the thread, added in linux commit
> > ba830885656414101b2f8ca88786524d4bb5e8c1
> > ---
> >  include/sys/prctl.h | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/include/sys/prctl.h b/include/sys/prctl.h
> > index 07a3490b..4b6c8918 100644
> > --- a/include/sys/prctl.h
> > +++ b/include/sys/prctl.h
> > @@ -146,6 +146,13 @@ struct prctl_mm_map {
> >  #define PR_SPEC_DISABLE (1UL << 2)
> >  #define PR_SPEC_FORCE_DISABLE (1UL << 3)
> >  
> > +#define PR_PAC_RESET_KEYS       54
> > +# define PR_PAC_APIAKEY (1UL << 0)
> > +# define PR_PAC_APIBKEY (1UL << 1)
> > +# define PR_PAC_APDAKEY (1UL << 2)
> > +# define PR_PAC_APDBKEY (1UL << 3)
> > +# define PR_PAC_APGAKEY (1UL << 4)
> > +
> >  int prctl (int, ...);
> 
> Is there a reason for this formatting? It's unlike anything we use
> elsewhere in the file or elsewhere in musl.

i just copied this format from the kernel, the prctl
option PR_PAC_RESET_KEYS takes a flags argument, so
i guess the indentation of the flag macros imply that
they belong to the option above, but indeed other
macros are not formatted this way, i can drop the space.
Rich Felker March 13, 2019, 4:38 p.m.
On Fri, Mar 08, 2019 at 11:53:15PM +0100, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2019-03-08 15:32:45 -0500]:
> > On Fri, Mar 08, 2019 at 12:12:51AM +0100, Szabolcs Nagy wrote:
> > > From d8b15a06288dee0895bd6b51cbb81f3c696ba504 Mon Sep 17 00:00:00 2001
> > > From: Szabolcs Nagy <nsz@port70.net>
> > > Date: Wed, 23 Jan 2019 20:06:12 +0000
> > > Subject: [PATCH 10/22] netinet/in.h update following linux v4.20
> > > 
> > > IN_BADCLASS and IN_EXPERIMENTAL are changed and new macros are added
> > > for class-e addresses.
> > > 
> > > linux commit 65cab850f0eeaa9180bd2e10a231964f33743edf
> > > ---
> > >  include/netinet/in.h | 8 ++++++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/include/netinet/in.h b/include/netinet/in.h
> > > index 192679a6..2f87e33f 100644
> > > --- a/include/netinet/in.h
> > > +++ b/include/netinet/in.h
> > > @@ -168,8 +168,12 @@ uint16_t ntohs(uint16_t);
> > >  #define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
> > >  #define	IN_CLASSD(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
> > >  #define	IN_MULTICAST(a)		IN_CLASSD(a)
> > > -#define	IN_EXPERIMENTAL(a)	((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
> > > -#define	IN_BADCLASS(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
> > > +#define	IN_MULTICAST_NET	0xe0000000
> > > +#define	IN_BADCLASS(a)		((((in_addr_t)(a)) == 0xffffffff)
> > > +#define	IN_EXPERIMENTAL(a)	IN_BADCLASS((a))
> > > +#define	IN_CLASSE(a)		((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
> > > +#define	IN_CLASSE_NET		0xffffffff
> > > +#define	IN_CLASSE_NSHIFT	0
> > 
> > You've described these as Linux 4.20 additions, but they aren't
> > specific to any Linux API or defined by Linux as far as I can tell.
> > Rather, aren't they aligned with some change by IANA or something? The
> > motivation for having them would not be that Linux made corresponding
> > changes in kernel headers, but rather that they're the proper
> > definitions for changes to a relevant network-related standard.
> 
> my idea was to enable users to use netinet/in.h instead
> of linux/in.h, so new definitions added there are blindly
> copied (i didn't fully understand the linux commit
> message explaining why this change was useful, so yes this
> may need some investigation)

After reading it, I don't fully understand what's going on either, and
whether there's any reason the userspace macros need to change. So I'm
going to hold off on this patch for now until there's a good
explanation for it. The rest are fine and I'm merging them...

> > > From f06c03ef3ce4c21d15416e071d3a7e2bab40928a Mon Sep 17 00:00:00 2001
> > > From: Szabolcs Nagy <nsz@port70.net>
> > > Date: Thu, 7 Mar 2019 21:53:48 +0000
> > > Subject: [PATCH 21/22] sys/prctl.h: add PR_PAC_RESET_KEYS from linux v5.0
> > > 
> > > aarch64 pointer authentication code related prctl that allows
> > > reinitializing the key for the thread, added in linux commit
> > > ba830885656414101b2f8ca88786524d4bb5e8c1
> > > ---
> > >  include/sys/prctl.h | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/include/sys/prctl.h b/include/sys/prctl.h
> > > index 07a3490b..4b6c8918 100644
> > > --- a/include/sys/prctl.h
> > > +++ b/include/sys/prctl.h
> > > @@ -146,6 +146,13 @@ struct prctl_mm_map {
> > >  #define PR_SPEC_DISABLE (1UL << 2)
> > >  #define PR_SPEC_FORCE_DISABLE (1UL << 3)
> > >  
> > > +#define PR_PAC_RESET_KEYS       54
> > > +# define PR_PAC_APIAKEY (1UL << 0)
> > > +# define PR_PAC_APIBKEY (1UL << 1)
> > > +# define PR_PAC_APDAKEY (1UL << 2)
> > > +# define PR_PAC_APDBKEY (1UL << 3)
> > > +# define PR_PAC_APGAKEY (1UL << 4)
> > > +
> > >  int prctl (int, ...);
> > 
> > Is there a reason for this formatting? It's unlike anything we use
> > elsewhere in the file or elsewhere in musl.
> 
> i just copied this format from the kernel, the prctl
> option PR_PAC_RESET_KEYS takes a flags argument, so
> i guess the indentation of the flag macros imply that
> they belong to the option above, but indeed other
> macros are not formatted this way, i can drop the space.

..with these changes. Will push soon.

Rich