diff mbox series

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

Message ID 20231020110918.26066-2-pvorel@suse.cz
State Accepted
Headers show
Series [1/2] lapi/{socket, tcp}.h: Add fallback definition for setsockopt10.c | expand

Commit Message

Petr Vorel Oct. 20, 2023, 11:09 a.m. UTC
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(-)

Comments

Martin Doucha Oct. 20, 2023, 2:34 p.m. UTC | #1
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"
Petr Vorel Oct. 20, 2023, 2:43 p.m. UTC | #2
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
Richard Palethorpe Oct. 23, 2023, 8:05 a.m. UTC | #3
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
diff mbox series

Patch

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"