* [PATCH] examples: disable ucontext-cp if ucontext.h is not available
@ 2020-10-28 2:31 Simon Zeni
2020-10-28 22:33 ` Jens Axboe
0 siblings, 1 reply; 6+ messages in thread
From: Simon Zeni @ 2020-10-28 2:31 UTC (permalink / raw)
To: io-uring; +Cc: Simon Zeni
The header file `ucontext.h` is not available on musl based distros. The
example `ucontext-cp` is not built if `configure` fails to locate the
header.
Signed-off-by: Simon Zeni <[email protected]>
---
See [this mail][1] from the musl mailing list about why those functions
are not implemented
I also noticed that `make runtests` fails on alpinelinux (5.4.72-0-lts
with musl-1.2.1)
```
Tests failed: <accept-reuse> <across-fork> <defer> <double-poll-crash>
<file-register> <file-update> <io_uring_enter> <io_uring_register> <lfs-openat>
<lfs-openat-write> <link-timeout> <link_drain> <open-close> <openat2>
<pipe-eof> <poll-cancel> <poll-cancel-ton> <poll-link> <read-write>
<sigfd-deadlock> <sq-poll-dup> <sq-poll-share> <sq-space_left> <timeout>
<statx>
```
I can post a full trace if needed.
Simon
[1]: https://www.openwall.com/lists/musl/2016/02/04/4
configure | 21 +++++++++++++++++++++
examples/Makefile | 6 +++++-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index c911f59..3b96cde 100755
--- a/configure
+++ b/configure
@@ -287,6 +287,24 @@ if compile_prog_cxx "" "" "C++"; then
fi
print_config "C++" "$has_cxx"
+##########################################
+# check for ucontext support
+has_ucontext="no"
+cat > $TMPC << EOF
+#include <ucontext.h>
+int main(int argc, char **argv)
+{
+ ucontext_t ctx;
+ getcontext(&ctx);
+ return 0;
+}
+EOF
+if compile_prog "" "" "has_ucontext"; then
+ has_ucontext="yes"
+fi
+print_config "has_ucontext" "$has_ucontext"
+
+
#############################################################################
if test "$__kernel_rwf_t" = "yes"; then
@@ -304,6 +322,9 @@ fi
if test "$has_cxx" = "yes"; then
output_sym "CONFIG_HAVE_CXX"
fi
+if test "$has_ucontext" = "yes"; then
+ output_sym "CONFIG_HAVE_UCONTEXT"
+fi
echo "CC=$cc" >> $config_host_mak
print_config "CC" "$cc"
diff --git a/examples/Makefile b/examples/Makefile
index 0eec627..60c1b71 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -10,7 +10,11 @@ ifneq ($(MAKECMDGOALS),clean)
include ../config-host.mak
endif
-all_targets += io_uring-test io_uring-cp link-cp ucontext-cp
+all_targets += io_uring-test io_uring-cp link-cp
+
+ifdef CONFIG_HAVE_UCONTEXT
+all_targets += ucontext-cp
+endif
all: $(all_targets)
--
2.29.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] examples: disable ucontext-cp if ucontext.h is not available
2020-10-28 2:31 [PATCH] examples: disable ucontext-cp if ucontext.h is not available Simon Zeni
@ 2020-10-28 22:33 ` Jens Axboe
2020-10-29 0:53 ` Simon Zeni
0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-10-28 22:33 UTC (permalink / raw)
To: Simon Zeni, io-uring
On 10/27/20 8:31 PM, Simon Zeni wrote:
> The header file `ucontext.h` is not available on musl based distros. The
> example `ucontext-cp` is not built if `configure` fails to locate the
> header.
Thanks, applied.
> I also noticed that `make runtests` fails on alpinelinux (5.4.72-0-lts
> with musl-1.2.1)
>
> ```
> Tests failed: <accept-reuse> <across-fork> <defer> <double-poll-crash>
> <file-register> <file-update> <io_uring_enter> <io_uring_register> <lfs-openat>
> <lfs-openat-write> <link-timeout> <link_drain> <open-close> <openat2>
> <pipe-eof> <poll-cancel> <poll-cancel-ton> <poll-link> <read-write>
> <sigfd-deadlock> <sq-poll-dup> <sq-poll-share> <sq-space_left> <timeout>
> <statx>
It's been a while since I double checked 5.4-stable, I bet a lot of these
are due to the tests not being very diligent in checking what is and what
isn't supported. I'll take a look and rectify some of that.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] examples: disable ucontext-cp if ucontext.h is not available
2020-10-28 22:33 ` Jens Axboe
@ 2020-10-29 0:53 ` Simon Zeni
2020-10-29 1:06 ` Jens Axboe
0 siblings, 1 reply; 6+ messages in thread
From: Simon Zeni @ 2020-10-29 0:53 UTC (permalink / raw)
To: Jens Axboe, io-uring
On Wed Oct 28, 2020 at 12:33 PM EDT, Jens Axboe wrote:
> It's been a while since I double checked 5.4-stable, I bet a lot of
> these
> are due to the tests not being very diligent in checking what is and
> what
> isn't supported. I'll take a look and rectify some of that.
I tried with 5.9.1 and fewer tests failed.
```
Tests failed: <defer> <double-poll-crash> <file-register>
<io_uring_enter> <io_uring_register> <iopoll> <poll-cancel-ton>
<read-write> <rename> <sq-poll-dup> <sq-poll-share> <unlink>
```
It might be due to musl, I'll as I use the library and send the
necessary patches if needed.
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] examples: disable ucontext-cp if ucontext.h is not available
2020-10-29 0:53 ` Simon Zeni
@ 2020-10-29 1:06 ` Jens Axboe
2020-10-29 1:23 ` Simon Zeni
0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-10-29 1:06 UTC (permalink / raw)
To: Simon Zeni, io-uring
On 10/28/20 6:53 PM, Simon Zeni wrote:
> On Wed Oct 28, 2020 at 12:33 PM EDT, Jens Axboe wrote:
>> It's been a while since I double checked 5.4-stable, I bet a lot of
>> these
>> are due to the tests not being very diligent in checking what is and
>> what
>> isn't supported. I'll take a look and rectify some of that.
>
> I tried with 5.9.1 and fewer tests failed.
>
> ```
> Tests failed: <defer> <double-poll-crash> <file-register>
> <io_uring_enter> <io_uring_register> <iopoll> <poll-cancel-ton>
> <read-write> <rename> <sq-poll-dup> <sq-poll-share> <unlink>
> ```
>
> It might be due to musl, I'll as I use the library and send the
> necessary patches if needed.
The log for those would be interesting. rename/unlink is probably
me messing up on skipping on not-supported, sq-poll-* ditto. The
others, not sure - if you fail with -1/-12, probably just missing
capability checks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] examples: disable ucontext-cp if ucontext.h is not available
2020-10-29 1:06 ` Jens Axboe
@ 2020-10-29 1:23 ` Simon Zeni
2020-10-29 3:00 ` Jens Axboe
0 siblings, 1 reply; 6+ messages in thread
From: Simon Zeni @ 2020-10-29 1:23 UTC (permalink / raw)
To: Jens Axboe, io-uring
On Wed Oct 28, 2020 at 3:06 PM EDT, Jens Axboe wrote:
> The log for those would be interesting. rename/unlink is probably
> me messing up on skipping on not-supported, sq-poll-* ditto. The
> others, not sure - if you fail with -1/-12, probably just missing
> capability checks.
There you go
https://paste.sr.ht/~bl4ckb0ne/61a962894091a8442fc7ab66934e22930122ff18
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] examples: disable ucontext-cp if ucontext.h is not available
2020-10-29 1:23 ` Simon Zeni
@ 2020-10-29 3:00 ` Jens Axboe
0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2020-10-29 3:00 UTC (permalink / raw)
To: Simon Zeni, io-uring
On 10/28/20 7:23 PM, Simon Zeni wrote:
> On Wed Oct 28, 2020 at 3:06 PM EDT, Jens Axboe wrote:
>> The log for those would be interesting. rename/unlink is probably
>> me messing up on skipping on not-supported, sq-poll-* ditto. The
>> others, not sure - if you fail with -1/-12, probably just missing
>> capability checks.
>
> There you go
> https://paste.sr.ht/~bl4ckb0ne/61a962894091a8442fc7ab66934e22930122ff18
Yeah, so outside of the double-poll-crash which crashes due to some
syzbot mmap magic unrelated to io_uring, all failures are either:
-EPERM: don't properly check for !root
-ENOMEM: user doesn't have a high enough ulimit -l setting
unlink/rename not properly checking kernel level support (fixed this one)
I need to provide a generic queue setup helper that catches the two
general error cases and skips tests (saying why), then it should run
clean there too.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-10-29 7:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-28 2:31 [PATCH] examples: disable ucontext-cp if ucontext.h is not available Simon Zeni
2020-10-28 22:33 ` Jens Axboe
2020-10-29 0:53 ` Simon Zeni
2020-10-29 1:06 ` Jens Axboe
2020-10-29 1:23 ` Simon Zeni
2020-10-29 3:00 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox