Skip to content

Commit 7d7309e

Browse files
committed
syscalls/ioctl_ns: Fix failures on -m32
These are not apparently implemented in the 32bit compat layer so the test were failing with ENOTTY there. Reported-by: Richard Palethorpe <rpalethorpe@suse.de> Signed-off-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Petr Vorel <pvorel@suse.cz>
1 parent 8a35daf commit 7d7309e

File tree

6 files changed

+36
-2
lines changed

6 files changed

+36
-2
lines changed

testcases/kernel/syscalls/ioctl/ioctl_ns01.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ static void test_ns_get_parent(void)
4040
fd = SAFE_OPEN("/proc/self/ns/pid", O_RDONLY);
4141
parent_fd = ioctl(fd, NS_GET_PARENT);
4242
if (parent_fd == -1) {
43+
if (errno == ENOTTY)
44+
tst_brk(TCONF, "ioctl(NS_GET_PARENT) not implemented");
45+
4346
if (errno == EPERM)
4447
tst_res(TPASS, "NS_GET_PARENT fails with EPERM");
4548
else

testcases/kernel/syscalls/ioctl/ioctl_ns02.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ static void run(void)
3232
fd = SAFE_OPEN("/proc/self/ns/uts", O_RDONLY);
3333
parent_fd = ioctl(fd, NS_GET_PARENT);
3434
if (parent_fd == -1) {
35+
if (errno == ENOTTY)
36+
tst_brk(TCONF, "ioctl(NS_GET_PARENT) not implemented");
37+
3538
if (errno == EINVAL)
3639
tst_res(TPASS, "NS_GET_PARENT fails with EINVAL");
3740
else

testcases/kernel/syscalls/ioctl/ioctl_ns03.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ static void run(void)
3333

3434
owner_fd = ioctl(fd, NS_GET_OWNER_UID, &uid);
3535
if (owner_fd == -1) {
36+
if (errno == ENOTTY) {
37+
tst_brk(TCONF,
38+
"ioctl(NS_GET_OWNER_UID) not implemented");
39+
}
40+
3641
if (errno == EINVAL)
3742
tst_res(TPASS, "NS_GET_OWNER_UID fails, UTS namespace");
3843
else

testcases/kernel/syscalls/ioctl/ioctl_ns04.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ static void run(void)
3131
fd = SAFE_OPEN("/proc/self/ns/user", O_RDONLY);
3232
parent_fd = ioctl(fd, NS_GET_USERNS);
3333
if (parent_fd == -1) {
34+
if (errno == ENOTTY)
35+
tst_brk(TCONF, "ioctl(NS_GET_USERNS) not implemented");
36+
3437
if (errno == EPERM)
3538
tst_res(TPASS, "NS_GET_USERNS fails with EPERM");
3639
else

testcases/kernel/syscalls/ioctl/ioctl_ns05.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,18 @@ static void run(void)
5353
sprintf(child_namespace, "/proc/%i/ns/pid", pid);
5454
my_fd = SAFE_OPEN("/proc/self/ns/pid", O_RDONLY);
5555
child_fd = SAFE_OPEN(child_namespace, O_RDONLY);
56-
parent_fd = SAFE_IOCTL(child_fd, NS_GET_PARENT);
56+
parent_fd = ioctl(child_fd, NS_GET_PARENT);
57+
58+
if (parent_fd == -1) {
59+
TST_CHECKPOINT_WAKE(0);
60+
61+
if (errno == ENOTTY) {
62+
tst_res(TCONF, "ioctl(NS_GET_PARENT) not implemented");
63+
return;
64+
}
65+
66+
tst_brk(TBROK | TERRNO, "ioctl(NS_GET_PARENT) failed");
67+
}
5768

5869
struct stat my_stat, child_stat, parent_stat;
5970

testcases/kernel/syscalls/ioctl/ioctl_ns06.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ static void run(void)
5050

5151
my_fd = SAFE_OPEN("/proc/self/ns/user", O_RDONLY);
5252
child_fd = SAFE_OPEN(child_namespace, O_RDONLY);
53-
parent_fd = SAFE_IOCTL(child_fd, NS_GET_USERNS);
53+
parent_fd = ioctl(child_fd, NS_GET_USERNS);
54+
55+
if (parent_fd == -1) {
56+
TST_CHECKPOINT_WAKE(0);
57+
58+
if (errno == ENOTTY)
59+
tst_brk(TCONF, "ioctl(NS_GET_USERNS) not implemented");
60+
61+
tst_brk(TBROK | TERRNO, "ioctl(NS_GET_USERNS) failed");
62+
}
5463

5564
struct stat my_stat, child_stat, parent_stat;
5665

0 commit comments

Comments
 (0)