* [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c
@ 2023-10-20 11:09 Petr Vorel
2023-10-20 11:09 ` [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation Petr Vorel
2023-10-20 12:21 ` [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c Cyril Hrubis
0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2023-10-20 11:09 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
Both SOL_TLS and TCP_ULP definitions are from Linux 4.13, it were added
in glibc 2.27. We still support compiling on older glibc, thus add this
definition.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
include/lapi/socket.h | 4 ++++
include/lapi/tcp.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/include/lapi/socket.h b/include/lapi/socket.h
index 794dee49f..23e7ba6cf 100644
--- a/include/lapi/socket.h
+++ b/include/lapi/socket.h
@@ -62,6 +62,10 @@
# define SOL_ALG 279
#endif
+#ifndef SOL_TLS
+# define SOL_TLS 282
+#endif
+
#ifndef HAVE_STRUCT_MMSGHDR
struct mmsghdr {
struct msghdr msg_hdr;
diff --git a/include/lapi/tcp.h b/include/lapi/tcp.h
index bb98f28f0..87c5636f6 100644
--- a/include/lapi/tcp.h
+++ b/include/lapi/tcp.h
@@ -12,6 +12,10 @@
# define TCP_FASTOPEN 23
#endif
+#ifndef TCP_ULP
+# define TCP_ULP 31
+#endif
+
#ifndef TCP_FASTOPEN_CONNECT
# define TCP_FASTOPEN_CONNECT 30 /* Attempt FastOpen with connect */
#endif
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation
2023-10-20 11:09 [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c Petr Vorel
@ 2023-10-20 11:09 ` Petr Vorel
2023-10-20 14:34 ` Martin Doucha
2023-10-20 12:21 ` [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c Cyril Hrubis
1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2023-10-20 11:09 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
Distros with glibc-2.26 and older will fail due missing SOL_TLS
in <sys/socket.h> and TCP_ULP in <netinet/tcp.h>. Use fallback
definitions in lapi/socket.h and lapi/tcp.h.
Also replace quotes ("") with sharp brackets (<>) for <netinet/in.h>
(it's a system header, the same was for netinet/tcp.h, but it was
replaced with lapi).
Fixes: bdb37aab9 ("Add setsockopt10 TLS ULP UAF CVE-2023-0461")
Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/kernel/syscalls/setsockopt/setsockopt10.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt10.c b/testcases/kernel/syscalls/setsockopt/setsockopt10.c
index afd2c40a1..4e7e44938 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt10.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt10.c
@@ -49,10 +49,11 @@
#ifdef HAVE_LINUX_TLS_H
#include <linux/tls.h>
-#include "netinet/in.h"
-#include "netinet/tcp.h"
+#include <netinet/in.h>
#include "lapi/sched.h"
+#include "lapi/socket.h"
+#include "lapi/tcp.h"
#include "tst_checkpoint.h"
#include "tst_net.h"
#include "tst_safe_net.h"
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c
2023-10-20 11:09 [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c Petr Vorel
2023-10-20 11:09 ` [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation Petr Vorel
@ 2023-10-20 12:21 ` Cyril Hrubis
1 sibling, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2023-10-20 12:21 UTC (permalink / raw)
To: Petr Vorel; +Cc: Richard Palethorpe, ltp
Hi!
For both:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation
2023-10-20 11:09 ` [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation Petr Vorel
@ 2023-10-20 14:34 ` Martin Doucha
2023-10-20 14:43 ` Petr Vorel
0 siblings, 1 reply; 6+ messages in thread
From: Martin Doucha @ 2023-10-20 14:34 UTC (permalink / raw)
To: Petr Vorel, ltp; +Cc: Richard Palethorpe
Hi,
I've checked that setsockopt10 will compile on SLE-15SP1. For both patches:
Reviewed-by: Martin Doucha <mdoucha@suse.cz>
On 20. 10. 23 13:09, Petr Vorel wrote:
> Distros with glibc-2.26 and older will fail due missing SOL_TLS
> in <sys/socket.h> and TCP_ULP in <netinet/tcp.h>. Use fallback
> definitions in lapi/socket.h and lapi/tcp.h.
>
> Also replace quotes ("") with sharp brackets (<>) for <netinet/in.h>
> (it's a system header, the same was for netinet/tcp.h, but it was
> replaced with lapi).
>
> Fixes: bdb37aab9 ("Add setsockopt10 TLS ULP UAF CVE-2023-0461")
> Reported-by: Martin Doucha <mdoucha@suse.cz>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> testcases/kernel/syscalls/setsockopt/setsockopt10.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt10.c b/testcases/kernel/syscalls/setsockopt/setsockopt10.c
> index afd2c40a1..4e7e44938 100644
> --- a/testcases/kernel/syscalls/setsockopt/setsockopt10.c
> +++ b/testcases/kernel/syscalls/setsockopt/setsockopt10.c
> @@ -49,10 +49,11 @@
> #ifdef HAVE_LINUX_TLS_H
>
> #include <linux/tls.h>
> -#include "netinet/in.h"
> -#include "netinet/tcp.h"
> +#include <netinet/in.h>
>
> #include "lapi/sched.h"
> +#include "lapi/socket.h"
> +#include "lapi/tcp.h"
> #include "tst_checkpoint.h"
> #include "tst_net.h"
> #include "tst_safe_net.h"
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation
2023-10-20 14:34 ` Martin Doucha
@ 2023-10-20 14:43 ` Petr Vorel
2023-10-23 8:05 ` Richard Palethorpe
0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2023-10-20 14:43 UTC (permalink / raw)
To: Martin Doucha; +Cc: Richard Palethorpe, ltp
HI Martin,
> Hi,
> I've checked that setsockopt10 will compile on SLE-15SP1. For both patches:
thanks for testing. So we now have covered distros based with 4.12 and 5.3
kernels and glibc 2.26.
Merged.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation
2023-10-20 14:43 ` Petr Vorel
@ 2023-10-23 8:05 ` Richard Palethorpe
0 siblings, 0 replies; 6+ messages in thread
From: Richard Palethorpe @ 2023-10-23 8:05 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hello,
Petr Vorel <pvorel@suse.cz> writes:
> HI Martin,
>> Hi,
>> I've checked that setsockopt10 will compile on SLE-15SP1. For both patches:
>
> thanks for testing. So we now have covered distros based with 4.12 and 5.3
> kernels and glibc 2.26.
Thanks for cleaning that up!
>
> Merged.
>
> Kind regards,
> Petr
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-10-23 8:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 11:09 [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c Petr Vorel
2023-10-20 11:09 ` [LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation Petr Vorel
2023-10-20 14:34 ` Martin Doucha
2023-10-20 14:43 ` Petr Vorel
2023-10-23 8:05 ` Richard Palethorpe
2023-10-20 12:21 ` [LTP] [PATCH 1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox