diff options
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl/0004-Fixup-support-for-io_pgetevents_time64-syscall.patch')
-rw-r--r-- | meta/recipes-connectivity/openssl/openssl/0004-Fixup-support-for-io_pgetevents_time64-syscall.patch | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl/0004-Fixup-support-for-io_pgetevents_time64-syscall.patch b/meta/recipes-connectivity/openssl/openssl/0004-Fixup-support-for-io_pgetevents_time64-syscall.patch deleted file mode 100644 index c8bc6f5c68..0000000000 --- a/meta/recipes-connectivity/openssl/openssl/0004-Fixup-support-for-io_pgetevents_time64-syscall.patch +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | From e5499a3cac1e823c3e0697e8667e952317b70cc8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alistair Francis <alistair.francis@wdc.com> | ||
3 | Date: Thu, 4 Mar 2021 12:10:11 -0500 | ||
4 | Subject: [PATCH] Fixup support for io_pgetevents_time64 syscall | ||
5 | |||
6 | This is a fixup for the original commit 5b5e2985f355c8e99c196d9ce5d02c15bebadfbc | ||
7 | "Add support for io_pgetevents_time64 syscall" that didn't correctly | ||
8 | work for 32-bit architecutres with a 64-bit time_t that aren't RISC-V. | ||
9 | |||
10 | For a full discussion of the issue see: | ||
11 | https://github.com/openssl/openssl/commit/5b5e2985f355c8e99c196d9ce5d02c15bebadfbc | ||
12 | |||
13 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | |||
15 | Reviewed-by: Tomas Mraz <tomas@openssl.org> | ||
16 | Reviewed-by: Paul Dale <pauli@openssl.org> | ||
17 | (Merged from https://github.com/openssl/openssl/pull/14432) | ||
18 | Upstream-Status: Accepted | ||
19 | --- | ||
20 | engines/e_afalg.c | 55 ++++++++++++++++++++++++++++++++++++----------- | ||
21 | 1 file changed, 42 insertions(+), 13 deletions(-) | ||
22 | |||
23 | diff --git a/engines/e_afalg.c b/engines/e_afalg.c | ||
24 | index 9480d7c24b..4e9d67db2d 100644 | ||
25 | --- a/engines/e_afalg.c | ||
26 | +++ b/engines/e_afalg.c | ||
27 | @@ -124,27 +124,56 @@ static ossl_inline int io_read(aio_context_t ctx, long n, struct iocb **iocb) | ||
28 | return syscall(__NR_io_submit, ctx, n, iocb); | ||
29 | } | ||
30 | |||
31 | +/* A version of 'struct timespec' with 32-bit time_t and nanoseconds. */ | ||
32 | +struct __timespec32 | ||
33 | +{ | ||
34 | + __kernel_long_t tv_sec; | ||
35 | + __kernel_long_t tv_nsec; | ||
36 | +}; | ||
37 | + | ||
38 | static ossl_inline int io_getevents(aio_context_t ctx, long min, long max, | ||
39 | struct io_event *events, | ||
40 | struct timespec *timeout) | ||
41 | { | ||
42 | +#if defined(__NR_io_pgetevents_time64) | ||
43 | + /* Check if we are a 32-bit architecture with a 64-bit time_t */ | ||
44 | + if (sizeof(*timeout) != sizeof(struct __timespec32)) { | ||
45 | + int ret = syscall(__NR_io_pgetevents_time64, ctx, min, max, events, | ||
46 | + timeout, NULL); | ||
47 | + if (ret == 0 || errno != ENOSYS) | ||
48 | + return ret; | ||
49 | + } | ||
50 | +#endif | ||
51 | + | ||
52 | #if defined(__NR_io_getevents) | ||
53 | - return syscall(__NR_io_getevents, ctx, min, max, events, timeout); | ||
54 | -#elif defined(__NR_io_pgetevents_time64) | ||
55 | - /* Let's only support the 64 suffix syscalls for 64-bit time_t. | ||
56 | - * This simplifies the code for us as we don't need to use a 64-bit | ||
57 | - * version of timespec with a 32-bit time_t and handle converting | ||
58 | - * between 64-bit and 32-bit times and check for overflows. | ||
59 | - */ | ||
60 | - if (sizeof(timeout->tv_sec) == 8) | ||
61 | - return syscall(__NR_io_pgetevents_time64, ctx, min, max, events, timeout, NULL); | ||
62 | + if (sizeof(*timeout) == sizeof(struct __timespec32)) | ||
63 | + /* | ||
64 | + * time_t matches our architecture length, we can just use | ||
65 | + * __NR_io_getevents | ||
66 | + */ | ||
67 | + return syscall(__NR_io_getevents, ctx, min, max, events, timeout); | ||
68 | else { | ||
69 | - errno = ENOSYS; | ||
70 | - return -1; | ||
71 | + /* | ||
72 | + * We don't have __NR_io_pgetevents_time64, but we are using a | ||
73 | + * 64-bit time_t on a 32-bit architecture. If we can fit the | ||
74 | + * timeout value in a 32-bit time_t, then let's do that | ||
75 | + * and then use the __NR_io_getevents syscall. | ||
76 | + */ | ||
77 | + if (timeout && timeout->tv_sec == (long)timeout->tv_sec) { | ||
78 | + struct __timespec32 ts32; | ||
79 | + | ||
80 | + ts32.tv_sec = (__kernel_long_t) timeout->tv_sec; | ||
81 | + ts32.tv_nsec = (__kernel_long_t) timeout->tv_nsec; | ||
82 | + | ||
83 | + return syscall(__NR_io_getevents, ctx, min, max, events, ts32); | ||
84 | + } else { | ||
85 | + return syscall(__NR_io_getevents, ctx, min, max, events, NULL); | ||
86 | + } | ||
87 | } | ||
88 | -#else | ||
89 | -# error "We require either the io_getevents syscall or __NR_io_pgetevents_time64." | ||
90 | #endif | ||
91 | + | ||
92 | + errno = ENOSYS; | ||
93 | + return -1; | ||
94 | } | ||
95 | |||
96 | static void afalg_waitfd_cleanup(ASYNC_WAIT_CTX *ctx, const void *key, | ||
97 | -- | ||
98 | 2.30.1 | ||
99 | |||