* [LTP] [PATCH] syscalls/getxattr05: skip userns test cases when not supported
@ 2019-06-19 12:47 Amir Goldstein
2019-06-19 14:23 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Amir Goldstein @ 2019-06-19 12:47 UTC (permalink / raw)
To: ltp
These test cases are failing when CONFIG_USER_NS is not defined.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
testcases/kernel/syscalls/getxattr/getxattr05.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/getxattr/getxattr05.c b/testcases/kernel/syscalls/getxattr/getxattr05.c
index 31b985ee0..c0d339f29 100644
--- a/testcases/kernel/syscalls/getxattr/getxattr05.c
+++ b/testcases/kernel/syscalls/getxattr/getxattr05.c
@@ -37,11 +37,13 @@
#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LIBACL)
#define TEST_FILE "testfile"
+#define SELF_USERNS "/proc/self/ns/user"
#define MAX_USERNS "/proc/sys/user/max_user_namespaces"
#define UID_MAP "/proc/self/uid_map"
static acl_t acl;
static int orig_max_userns = -1;
+static int user_ns_supported = 1;
static struct tcase {
/* 0: without userns, 1: with userns */
@@ -110,6 +112,11 @@ static void do_getxattr(unsigned int n)
struct tcase *tc = &tcases[n];
pid_t pid;
+ if (tc->set_userns && !user_ns_supported) {
+ tst_res(TCONF, "user namespace not available");
+ return;
+ }
+
pid = SAFE_FORK();
if (!pid) {
if (tc->set_userns)
@@ -144,10 +151,13 @@ static void setup(void)
/* The default value of max_user_namespaces is set to 0 on some distros,
* We need to change the default value to call unshare().
*/
- if (!access(MAX_USERNS, F_OK)) {
+ if (access(SELF_USERNS, F_OK) != 0) {
+ user_ns_supported = 0;
+ } else if (!access(MAX_USERNS, F_OK)) {
SAFE_FILE_SCANF(MAX_USERNS, "%d", &orig_max_userns);
SAFE_FILE_PRINTF(MAX_USERNS, "%d", 10);
}
+
}
static void cleanup(void)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [LTP] [PATCH] syscalls/getxattr05: skip userns test cases when not supported
2019-06-19 12:47 [LTP] [PATCH] syscalls/getxattr05: skip userns test cases when not supported Amir Goldstein
@ 2019-06-19 14:23 ` Cyril Hrubis
2019-06-20 13:30 ` Amir Goldstein
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2019-06-19 14:23 UTC (permalink / raw)
To: ltp
Hi!
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] syscalls/getxattr05: skip userns test cases when not supported
2019-06-19 14:23 ` Cyril Hrubis
@ 2019-06-20 13:30 ` Amir Goldstein
0 siblings, 0 replies; 3+ messages in thread
From: Amir Goldstein @ 2019-06-20 13:30 UTC (permalink / raw)
To: ltp
On Wed, Jun 19, 2019 at 5:23 PM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> Pushed, thanks.
FYI, some more false positive failures I ran into.
I've put them in my skip list, if somebody has time to fix them...
ioctl_ns04 and ioctl_ns06 also fail when CONFIG_USER_NS is not defined:
ioctl_ns04.c:24: CONF: namespace not available
safe_macros.c:225: BROK: ioctl_ns04.c:31:
open(/proc/self/ns/user,0,034641644410) failed: ENOENT
oom03 and oom05 fail when CONFIG_MEMCG is not defined:
mem.c:757: BROK: mount /dev/cgroup: ENOENT
And also does not cleanup /dev/cgroup afterwards, so error them becomes:
safe_macros.c:169: BROK: mem.c:747: mkdir(/dev/cgroup,0777) failed: EEXIST
Thanks,
Amir.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-20 13:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-19 12:47 [LTP] [PATCH] syscalls/getxattr05: skip userns test cases when not supported Amir Goldstein
2019-06-19 14:23 ` Cyril Hrubis
2019-06-20 13:30 ` Amir Goldstein
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.