preadv2 test does not consider new flag from linux 4.16
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glibc (Ubuntu) |
Fix Released
|
Undecided
|
Adam Conrad | ||
Bionic |
Fix Released
|
Undecided
|
Thadeu Lima de Souza Cascardo | ||
Cosmic |
Fix Released
|
Undecided
|
Adam Conrad |
Bug Description
[Impact]
When tested against newer versions of linux, glibc tests will fail as it makes some assumptions about supportead features on the kernel.
[Fix]
Ignore "invalid" (rather unknown) flags success as failure, instead exiting as unsupported (equivalent to skip).
[Test case]
Build glibc and run its tests on linux 5.3.
[Regression potential]
The same test is being ignored right now, we risk ignoring a failure on an older version of linux, like 4.15. However, that could happen because the feature is backported to said kernel. And we are currently ignoring the failure anyway.
=======
FAIL: misc/tst-
original exit status 1
error: tst-preadvwrite
error: 1 test failures
----------
----------
FAIL: misc/tst-
original exit status 1
error: tst-preadvwrite
error: 1 test failures
This is testing for the flag immediately after the last known flag. So, if it's 0x8, it's going to test for 0x10.
The test snippet:
int invalid_flag = RWF_SUPPORTED != 0 ? __builtin_clz (RWF_SUPPORTED) : 2;
invalid_flag = 0x1 << ((sizeof (int) * CHAR_BIT) - invalid_flag);
char buf[32];
const struct iovec vec = { .iov_base = buf, .iov_len = sizeof (buf) };
if (preadv2 (temp_fd, &vec, 1, 0, invalid_flag) != -1)
FAIL_EXIT1 ("preadv2 did not fail with an invalid flag");
However, linux 4.16 has introduced RWF_APPEND.
commit e1fc742e14e01d8
Author: Jürg Billeter <email address hidden>
Date: Fri Sep 29 14:07:17 2017 +0200
fs: add RWF_APPEND
---
+/* per-IO O_APPEND */
+#define RWF_APPEND ((__force __kernel_
+
/* mask of flags supported by the kernel */
-#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT)
+#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT |\
+ RWF_APPEND)
CVE References
tags: | added: rls-cc-incoming |
Changed in glibc (Ubuntu Bionic): | |
assignee: | nobody → Adam Conrad (adconrad) |
Changed in glibc (Ubuntu Cosmic): | |
assignee: | nobody → Adam Conrad (adconrad) |
Changed in glibc (Ubuntu Cosmic): | |
status: | New → Fix Released |
description: | updated |
Nominating bionic, as we are going to hit this issue there as soon as some backport of linux appears on bionic.