syscalls/ioctl_ns: Fix failures on -m32
PATCH 1/1 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 <[email protected]>
Signed-off-by Cyril Hrubis <[email protected]>
--- testcases/kernel/syscalls/ioctl/ioctl_ns01.c | 3 +++ testcases/kernel/syscalls/ioctl/ioctl_ns02.c | 3 +++ testcases/kernel/syscalls/ioctl/ioctl_ns03.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_ns04.c | 3 +++ testcases/kernel/syscalls/ioctl/ioctl_ns05.c | 13 ++++++++++++- testcases/kernel/syscalls/ioctl/ioctl_ns06.c | 11 ++++++++++- 6 files changed, 36 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/ioctl/ioctl_ns01.c +3 -0
@@ -40,6 +40,9 @@ static void test_ns_get_parent(void) fd =SAFE_OPEN ("/proc/self/ns/pid" ,O_RDONLY ); parent_fd =ioctl (fd,NS_GET_PARENT );if (parent_fd ==-1 ) { +if (errno ==ENOTTY ) +tst_brk (TCONF ,"ioctl(NS_GET_PARENT) not implemented" ); +if (errno ==EPERM )tst_res (TPASS ,"NS_GET_PARENT fails with EPERM" );else
testcases/kernel/syscalls/ioctl/ioctl_ns02.c +3 -0
@@ -32,6 +32,9 @@ static void run(void) fd =SAFE_OPEN ("/proc/self/ns/uts" ,O_RDONLY ); parent_fd =ioctl (fd,NS_GET_PARENT );if (parent_fd ==-1 ) { +if (errno ==ENOTTY ) +tst_brk (TCONF ,"ioctl(NS_GET_PARENT) not implemented" ); +if (errno ==EINVAL )tst_res (TPASS ,"NS_GET_PARENT fails with EINVAL" );else
testcases/kernel/syscalls/ioctl/ioctl_ns03.c +5 -0
@@ -33,6 +33,11 @@ static void run(void) owner_fd =ioctl (fd,NS_GET_OWNER_UID , &uid);if (owner_fd ==-1 ) { +if (errno ==ENOTTY ) { +tst_brk (TCONF , +"ioctl(NS_GET_OWNER_UID) not implemented" ); + } +if (errno ==EINVAL )tst_res (TPASS ,"NS_GET_OWNER_UID fails, UTS namespace" );else
testcases/kernel/syscalls/ioctl/ioctl_ns04.c +3 -0
@@ -31,6 +31,9 @@ static void run(void) fd =SAFE_OPEN ("/proc/self/ns/user" ,O_RDONLY ); parent_fd =ioctl (fd,NS_GET_USERNS );if (parent_fd ==-1 ) { +if (errno ==ENOTTY ) +tst_brk (TCONF ,"ioctl(NS_GET_USERNS) not implemented" ); +if (errno ==EPERM )tst_res (TPASS ,"NS_GET_USERNS fails with EPERM" );else
testcases/kernel/syscalls/ioctl/ioctl_ns05.c +12 -1
@@ -53,7 +53,18 @@ static void run(void)sprintf (child_namespace,"/proc/%i/ns/pid" , pid); my_fd =SAFE_OPEN ("/proc/self/ns/pid" ,O_RDONLY ); child_fd =SAFE_OPEN (child_namespace,O_RDONLY ); - parent_fd =SAFE_IOCTL (child_fd,NS_GET_PARENT ); + parent_fd =ioctl (child_fd,NS_GET_PARENT ); + +if (parent_fd ==-1 ) { +TST_CHECKPOINT_WAKE (0 ); + +if (errno ==ENOTTY ) { +tst_res (TCONF ,"ioctl(NS_GET_PARENT) not implemented" ); +return ; + } + +tst_brk (TBROK |TERRNO ,"ioctl(NS_GET_PARENT) failed" ); + }struct stat my_stat, child_stat, parent_stat;
testcases/kernel/syscalls/ioctl/ioctl_ns06.c +10 -1
@@ -50,7 +50,16 @@ static void run(void) my_fd =SAFE_OPEN ("/proc/self/ns/user" ,O_RDONLY ); child_fd =SAFE_OPEN (child_namespace,O_RDONLY ); - parent_fd =SAFE_IOCTL (child_fd,NS_GET_USERNS ); + parent_fd =ioctl (child_fd,NS_GET_USERNS ); + +if (parent_fd ==-1 ) { +TST_CHECKPOINT_WAKE (0 ); + +if (errno ==ENOTTY ) +tst_brk (TCONF ,"ioctl(NS_GET_USERNS) not implemented" ); + +tst_brk (TBROK |TERRNO ,"ioctl(NS_GET_USERNS) failed" ); + }struct stat my_stat, child_stat, parent_stat;
Signature · 1 line
2.19.2
PATCH 1/1 syscalls/ioctl_ns: Fix failures on -m32
Hi,
Quoted 5 lines
These are not apparently implemented in the 32bit compat layer so the test were failing with ENOTTY there.
Reported-by Richard Palethorpe <[email protected]>Signed-off-by Cyril Hrubis <[email protected]>
Reviewed-by Petr Vorel <[email protected]>
Kind regards,
Petr
PATCH 1/1 syscalls/ioctl_ns: Fix failures on -m32
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]