* [LTP] [PATCH v2 1/1] lapi/io_uring: <sys/types.h> => <linux/types.h>
@ 2024-01-26 11:15 Petr Vorel
2024-01-26 15:29 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2024-01-26 11:15 UTC (permalink / raw)
To: ltp
This fixes compilation on old toolchains:
Some old toolchains require to add <linux/types.h> to missing kernel
types:
tst_safe_io_uring.c: In function ‘safe_io_uring_init’:
tst_safe_io_uring.c:34:45: error: ‘__u32’ undeclared (first use in this function)
34 | params->sq_entries * sizeof(__u32);
| ^~~~~
io_uring02.c: In function ‘drain_fallback’:
io_uring02.c:106:34: error: ‘__u64’ undeclared (first use in this function)
106 | sqe_ptr->addr = (__u64)&spam_header;
| ^~~~~
io_uring02.c:106:34: note: each undeclared identifier is reported only once for each function it appears in
io_uring02.c: In function ‘run’:
io_uring02.c:221:26: error: ‘__u64’ undeclared (first use in this function)
221 | sqe_ptr->addr = (__u64)&beef_header;
| ^~~~~
Newer kernel headers includes <linux/types.h> in <linux/io_uring.h>, but
we still support compilers without this header. Therefore replace
<sys/types.h> in lapi header with <linux/types.h>.
Fixes: 3f2ff5431 ("Add safe functions for io_uring to LTP library")
Fixes: c4f669f13 ("Add test for CVE 2020-29373")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Fix also io_uring02.c
include/lapi/io_uring.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 03c45190e..c05517595 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -11,9 +11,9 @@
#include <unistd.h>
#include <fcntl.h>
-#include <sys/types.h>
#include <sys/uio.h>
#include <stdlib.h>
+#include <linux/types.h>
#include "lapi/syscalls.h"
--
2.43.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [LTP] [PATCH v2 1/1] lapi/io_uring: <sys/types.h> => <linux/types.h>
2024-01-26 11:15 [LTP] [PATCH v2 1/1] lapi/io_uring: <sys/types.h> => <linux/types.h> Petr Vorel
@ 2024-01-26 15:29 ` Cyril Hrubis
2024-01-27 5:54 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2024-01-26 15:29 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
Hi!
> This fixes compilation on old toolchains:
>
> Some old toolchains require to add <linux/types.h> to missing kernel
> types:
>
> tst_safe_io_uring.c: In function ‘safe_io_uring_init’:
> tst_safe_io_uring.c:34:45: error: ‘__u32’ undeclared (first use in this function)
> 34 | params->sq_entries * sizeof(__u32);
> | ^~~~~
>
> io_uring02.c: In function ‘drain_fallback’:
> io_uring02.c:106:34: error: ‘__u64’ undeclared (first use in this function)
> 106 | sqe_ptr->addr = (__u64)&spam_header;
> | ^~~~~
> io_uring02.c:106:34: note: each undeclared identifier is reported only once for each function it appears in
> io_uring02.c: In function ‘run’:
> io_uring02.c:221:26: error: ‘__u64’ undeclared (first use in this function)
> 221 | sqe_ptr->addr = (__u64)&beef_header;
> | ^~~~~
>
> Newer kernel headers includes <linux/types.h> in <linux/io_uring.h>, but
> we still support compilers without this header. Therefore replace
> <sys/types.h> in lapi header with <linux/types.h>.
I did look twice and we do not seem to use anything from the
<sys/types.h> in the header, so this should be safe.
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] 3+ messages in thread
end of thread, other threads:[~2024-01-27 5:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-26 11:15 [LTP] [PATCH v2 1/1] lapi/io_uring: <sys/types.h> => <linux/types.h> Petr Vorel
2024-01-26 15:29 ` Cyril Hrubis
2024-01-27 5:54 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox