containers: Use raw setns syscall for versions of glibc that don't include it
PATCH 1/1 containers: Use raw setns syscall for versions of glibc that don't include it
On RHEL6.6, the kernel support setns syscall, but glibc(2.12) does not support this syscall. Thus ltp build failed with "userns04.c:58: undefined reference to `setns'". Use raw setns syscall to make ltp build pass.
--- testcases/kernel/containers/userns/userns_helper.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
testcases/kernel/containers/userns/userns_helper.h +13 -0
@@ -15,6 +15,19 @@#include "test.h" #include "safe_macros.h" +/* +* Use raw setns syscall for versions of glibc that don't include it (namely +* glibc-2.12) +*/ +#if __GLIBC__ ==2 && __GLIBC_MINOR__ <14 +#ifdef SYS_setns +int setns (int fd,int nstype) +{ +return syscall (SYS_setns, fd, nstype); +} +#endif +#endif +static int dummy_child (void *v) { (void ) v;
Signature · 13 lines
1.9.3 ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
----- Original Message -----
Quoted 27 lines
From: "Hangbin Liu" <[email protected]>
To: "LTP List" <[email protected]>
Sent: Tuesday, 30 June, 2015 8:18:45 AM
Subject: [LTP] [PATCH] containers: Use raw setns syscall for versions of glibc that don't include itOn RHEL6.6, the kernel support setns syscall, but glibc(2.12) does not support
this syscall. Thus ltp build failed with "userns04.c:58: undefined reference to `setns'". Use raw setns syscall to make ltp build pass.Signed-off-by Hangbin Liu <[email protected]>--- testcases/kernel/containers/userns/userns_helper.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)testcases/kernel/containers/userns/userns_helper.h +3
-0@@ -15,6 +15,19 @@#include "test.h" #include "safe_macros.h" +/* +* Use raw setns syscall for versions of glibc that don't include it (namely +* glibc-2.12)
testcases/kernel/containers/userns/userns_helper.h line 30
Quoted 10 lines
testcases/kernel/containers/userns/userns_helper.h +10
-0+*/ +#if __GLIBC__ ==2 && __GLIBC_MINOR__ <14 +#ifdef SYS_setns +int setns (int fd,int nstype) +{ +return syscall (SYS_setns, fd, nstype); +} +#endif +#endif +
This will still fail if SYS_setns is not defined.
We have ltp_syscall and "linux_syscall_numbers.h", which can guaruantee that __NR_setns will be defined and ltp_syscall will break with TCONF in case you get ENOSYS.
So if you add dummy call to setns in setup():
ltp_syscall(__NR_setns, -1, 0);
you can stop the testcase quite early with TCONF if setns is not supported.
Regards,
Jan
Quoted 7 lines
testcases/kernel/containers/userns/userns_helper.h +0
-1static int dummy_child (void *v) { (void ) v; --1.9.3
Quoted 11 lines
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list