[LTP] [PATCH 2/2] setsockopt10: Use lapi/{socket, tcp}.h to fix compilation

Petr Vorel pvorel@suse.cz
Fri Oct 20 13:09:18 CEST 2023


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



More information about the ltp mailing list