ioctl_pidfd02-06: Add CONFIG_USER_NS and CONFIG_PID_NS to needs_kconfigs
PATCH 1/1 ioctl_pidfd02-06: Add CONFIG_USER_NS and CONFIG_PID_NS to needs_kconfigs
The flags CLONE_NEWUSER and CLONE_NEWPID require specific namespace support. Add CONFIG_USER_NS and CONFIG_PID_NS to needs_kconfigs so these tests return TCONF instead of failing.
--- testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd03.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd04.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 5 +++++ 5 files changed, 25 insertions(+)
testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +5 -0
@@ -81,5 +81,10 @@ static struct tst_test test = { {&info0, .size = sizeof(*info0)}, {&info1, .size = sizeof(*info1)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" , +NULL } };
testcases/kernel/syscalls/ioctl/ioctl_pidfd03.c +5 -0
@@ -60,5 +60,10 @@ static struct tst_test test = { {&args, .size = sizeof(*args)}, {&info, .size = sizeof(*info)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" , +NULL } };
testcases/kernel/syscalls/ioctl/ioctl_pidfd04.c +5 -0
@@ -67,5 +67,10 @@ static struct tst_test test = { {&args, .size = sizeof(*args)}, {&info, .size = sizeof(*info)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" , +NULL } };
testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c +5 -0
@@ -71,5 +71,10 @@ static struct tst_test test = { {&args, .size = sizeof(*args)}, {&info_invalid, .size = sizeof(*info_invalid)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" , +NULL } };
testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c +5 -0
@@ -62,5 +62,10 @@ static struct tst_test test = { {&args, .size = sizeof(*args)}, {&info, .size = sizeof(*info)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" , +NULL } };
Signature · 5 lines
2.47.3 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Obviously correct, thanks.
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi all,
Quoted 18 lines
The flags
CLONE_NEWUSERandCLONE_NEWPIDrequire specific namespace support. AddCONFIG_USER_NSandCONFIG_PID_NStoneeds_kconfigsso these tests return TCONF instead of failing.Signed-off-by Terry Tritton <[email protected]>--- testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd03.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd04.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 5 +++++ 5 files changed, 25 insertions(+)testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +0
-0
testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c static struct tst_test test = { · line 87
Quoted 7 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +4
-0@@ -81,5 +81,10 @@ static struct tst_test test = { {&info0, .size = sizeof(*info0)}, {&info1, .size = sizeof(*info1)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" ,
How about to check /proc/self/ns/user and /proc/self/ns/pid as ioctl_ns06.c does?
int exists = access("/proc/self/ns/user", F_OK);
if (exists < 0)
tst_res(TCONF, "namespace not available");Long time ago we tried to avoid forcing config. Is it now considered as better? (maybe more readable?) Or we would keep checking /proc (or /sys) but add a comment for required functions?
Kind regards,
Petr
Quoted 1 line
testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +1
-0+NULL
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Quoted 31 lines · Petr Vorel
Hi all,
Quoted 18 lines
The flags
CLONE_NEWUSERandCLONE_NEWPIDrequire specific namespace support. AddCONFIG_USER_NSandCONFIG_PID_NStoneeds_kconfigsso these tests return TCONF instead of failing.Signed-off-by Terry Tritton <[email protected]>--- testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd03.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd04.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd05.c | 5 +++++ testcases/kernel/syscalls/ioctl/ioctl_pidfd06.c | 5 +++++ 5 files changed, 25 insertions(+)testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +0
-0testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c static struct tst_test test = { · line 87
Quoted 7 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +4
-0@@ -81,5 +81,10 @@ static struct tst_test test = { {&info0, .size = sizeof(*info0)}, {&info1, .size = sizeof(*info1)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" ,How about to check
/proc/self/ns/userand/proc/self/ns/pidasioctl_ns06.cdoes?
Quoted 8 lines
int exists = access("/proc/self/ns/user", F_OK); if (exists < 0) tst_res(TCONF, "namespace not available");Long time ago we tried to avoid forcing config. Is it now considered as better? (maybe more readable?) Or we would keep checking /proc (or /sys) but add a comment for required functions?
This case is specific to the CONFIG_PID_NS/CONFIG_USER_NS configurations and the feature can't be tested if kernel is not configured with them. Manual is clear about it: https://www.man7.org/linux/man-pages/man7/pid_namespaces.7.html
Quoted 5 lines
Kind regards,
PetrQuoted 1 line
testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +1
-0+NULL
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
...
Quoted 18 lines
Quoted 17 lines
testcases/kernel/syscalls/ioctl/ioctl_pidfd02.c static struct tst_test test = { · line 87
Quoted 9 lines
+++
b/testcases/kernel/syscalls/ioctl/ioctl_pidfd02.ctestcases/kernel/syscalls/ioctl/ioctl_pidfd02.c +4
-0@@ -81,5 +81,10 @@ static struct tst_test test = { {&info0, .size = sizeof(*info0)}, {&info1, .size = sizeof(*info1)}, {} + }, + .needs_kconfigs = (const char *[]) { +"CONFIG_USER_NS" , +"CONFIG_PID_NS" ,How about to check
/proc/self/ns/userand/proc/self/ns/pidasioctl_ns06.cdoes?int exists = access("/proc/self/ns/user", F_OK); if (exists < 0) tst_res(TCONF, "namespace not available");
Quoted 7 lines
Quoted 3 lines
Long time ago we tried to avoid forcing config. Is it now considered as better? (maybe more readable?) Or we would keep checking /proc (or /sys) but add a comment for required functions?
This case is specific to the CONFIG_PID_NS/CONFIG_USER_NS configurations and the feature can't be tested if kernel is not configured with them. Manual is clear about it: https://www.man7.org/linux/man-pages/man7/pid_namespaces.7.html
And https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html.
Yeah, I understand that. The dependency of CLONE_NEWUSER/CLONE_NEWPID is also visible in kernel sources (e.g. fs/nsfs.c). But my question was different:
Do we now prefer everything kind of document with .needs_kconfigs, even it's possible to detect it otherwise? (speed of parsing kconfig, kind of hard request for kconfig being available even we can figure the support otherwise).
And if we decide for forcing kconfig, we should update ioctl_ns06.c, which does /proc based detection (i.e. to use the same approach).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 7 lines
And https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html.
Yeah, I understand that. The dependency of CLONE_NEWUSER/CLONE_NEWPID is also visible in kernel sources (e.g.
fs/nsfs.c). But my question was different:
Do we now prefer everything kind of document with .needs_kconfigs, even it's possible to detect it otherwise? (speed of parsing kconfig, kind of hard request for kconfig being available even we can figure the support otherwise).
I believe we shouldn't see this as black/white but use this feature when it's really needed. This is the case.
Quoted 3 lines
And if we decide for forcing kconfig, we should update
ioctl_ns06.c, which does /proc based detection (i.e. to use the same approach).
I didn't check this, but I'm pretty sure we should go all around and verify many other tests with the same issue. We should do it in this patch-set or on a searate one.
Quoted 3 lines
Kind regards,
Petr
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 10 lines
Quoted 7 lines
And https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html.
Yeah, I understand that. The dependency of CLONE_NEWUSER/CLONE_NEWPID is also visible in kernel sources (e.g.
fs/nsfs.c). But my question was different:
Do we now prefer everything kind of document with .needs_kconfigs, even it's possible to detect it otherwise? (speed of parsing kconfig, kind of hard request for kconfig being available even we can figure the support otherwise).I believe we shouldn't see this as black/white but use this feature when it's really needed. This is the case.
Sure, .needs_kconfigs is used when test request some functionality based on kconfig. But many tests use /proc or /sys based detection (e.g. ioctl_ns06.c) or based on certain errno, see include/lapi/syscalls.h or testcases/kernel/syscalls/fanotify/fanotify.h) because these were added before LTP supported kconfig. Later, when kconfig was added it was considering as a last resort (when there was no way to detect dependency otherwise).
Have we decide to move everything into kconfig?
I'm not sure myself. needs_kconfigs is simpler and obvious, but it requires kernel config. I suppose the speed of parsing config is not an issue.
It'd be nice to mention the resolution (preferred vs. only if no other way to detect the support) into
https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.html
or into upcommig doc/developers/ground_rules.rst
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
Kind regards,
Petr
Quoted 10 lines
Quoted 2 lines
And if we decide for forcing kconfig, we should update
ioctl_ns06.c, which does /proc based detection (i.e. to use the same approach).I didn't check this, but I'm pretty sure we should go all around and verify many other tests with the same issue. We should do it in this patch-set or on a searate one.
Quoted 2 lines
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Quoted 19 lines · Petr Vorel
Quoted 10 lines
Quoted 7 lines
And https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html.
Yeah, I understand that. The dependency of CLONE_NEWUSER/CLONE_NEWPID is also visible in kernel sources (e.g.
fs/nsfs.c). But my question was different:
Do we now prefer everything kind of document with .needs_kconfigs, even it's possible to detect it otherwise? (speed of parsing kconfig, kind of hard request for kconfig being available even we can figure the support otherwise).I believe we shouldn't see this as black/white but use this feature when it's really needed. This is the case.
Sure, .needs_kconfigs is used when test request some functionality based on kconfig. But many tests use /proc or /sys based detection (e.g.
ioctl_ns06.c) or based on certain errno, seeinclude/lapi/syscalls.hortestcases/kernel/syscalls/fanotify/fanotify.h) because these were added before LTP supported kconfig. Later, when kconfig was added it was considering as a last resort (when there was no way to detect dependency otherwise).
Quoted 8 lines
Have we decide to move everything into kconfig?
I'm not sure myself.
needs_kconfigsis simpler and obvious, but it requires kernel config. I suppose the speed of parsing config is not an issue.It'd be nice to mention the resolution (preferred vs. only if no other way to detect the support) into
https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.html
Feel free to add this comment, but for me it's obvious that if a feature can't be present in the kernel due to kconfigs we should check kconfig :-)
Quoted 17 lines
or into upcommig
doc/developers/ground_rules.rst
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/Kind regards,
PetrQuoted 10 lines
Quoted 2 lines
And if we decide for forcing kconfig, we should update
ioctl_ns06.c, which does /proc based detection (i.e. to use the same approach).I didn't check this, but I'm pretty sure we should go all around and verify many other tests with the same issue. We should do it in this patch-set or on a searate one.
Quoted 2 lines
Kind regards,
Petr
So what we do with the patch? Should we merge it?
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Quoted 25 lines · Petr Vorel
Quoted 24 lines
Quoted 10 lines
Quoted 7 lines
And https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html.
Yeah, I understand that. The dependency of CLONE_NEWUSER/CLONE_NEWPID is also visible in kernel sources (e.g.
fs/nsfs.c). But my question was different:
Do we now prefer everything kind of document with .needs_kconfigs, even it's possible to detect it otherwise? (speed of parsing kconfig, kind of hard request for kconfig being available even we can figure the support otherwise).I believe we shouldn't see this as black/white but use this feature when it's really needed. This is the case.
Sure, .needs_kconfigs is used when test request some functionality based on kconfig. But many tests use /proc or /sys based detection (e.g.
ioctl_ns06.c) or based on certain errno, seeinclude/lapi/syscalls.hortestcases/kernel/syscalls/fanotify/fanotify.h) because these were added before LTP supported kconfig. Later, when kconfig was added it was considering as a last resort (when there was no way to detect dependency otherwise).Have we decide to move everything into kconfig?
I'm not sure myself.
needs_kconfigsis simpler and obvious, but it requires kernel config. I suppose the speed of parsing config is not an issue.
Quoted 7 lines
Quoted 3 lines
It'd be nice to mention the resolution (preferred vs. only if no other way to detect the support) into
https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.htmlFeel free to add this comment, but for me it's obvious that if a feature can't be present in the kernel due to kconfigs we should check kconfig :-)
I've just taken another look at this and it appears the test would still fail if the config is not present or if KCONFIG_SKIP_CHECK is set, in which case perhaps the run time detection may be preferred as it will still work in these cases?
I'm not sure how common either of those cases are though?
Would it be better to have the run time detection in tst_kconfig_check as a fall back in case the config is not present?
Then the tests can just define the needs_kconfigs and not have to worry about other checks.
Quoted 14 lines
Quoted 14 lines
or into upcommig
doc/developers/ground_rules.rst
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/Kind regards,
PetrQuoted 6 lines
Quoted 2 lines
And if we decide for forcing kconfig, we should update
ioctl_ns06.c, which does /proc based detection (i.e. to use the same approach).I didn't check this, but I'm pretty sure we should go all around and verify many other tests with the same issue. We should do it in this patch-set or on a searate one.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Kind regards,
PetrSo what we do with the patch? Should we merge it?
I'm happy to go through and update other tests in this patch or another.
Thanks
Terry
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 31 lines
Hi,
Quoted 28 lines · Petr Vorel
Quoted 27 lines
Quoted 10 lines
Quoted 7 lines
And https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html.
Yeah, I understand that. The dependency of CLONE_NEWUSER/CLONE_NEWPID is also visible in kernel sources (e.g.
fs/nsfs.c). But my question was different:
Do we now prefer everything kind of document with .needs_kconfigs, even it's possible to detect it otherwise? (speed of parsing kconfig, kind of hard request for kconfig being available even we can figure the support otherwise).I believe we shouldn't see this as black/white but use this feature when it's really needed. This is the case.
Sure, .needs_kconfigs is used when test request some functionality based on kconfig. But many tests use /proc or /sys based detection (e.g.
ioctl_ns06.c) or based on certain errno, seeinclude/lapi/syscalls.hortestcases/kernel/syscalls/fanotify/fanotify.h) because these were added before LTP supported kconfig. Later, when kconfig was added it was considering as a last resort (when there was no way to detect dependency otherwise).Have we decide to move everything into kconfig?
I'm not sure myself.
needs_kconfigsis simpler and obvious, but it requires kernel config. I suppose the speed of parsing config is not an issue.It'd be nice to mention the resolution (preferred vs. only if no other way to detect the support) into
https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.html
Quoted 8 lines
Quoted 3 lines
Feel free to add this comment, but for me it's obvious that if a feature can't be present in the kernel due to kconfigs we should check kconfig :-)
I've just taken another look at this and it appears the test would still fail if the config is not present or if
KCONFIG_SKIP_CHECKis set, in which case perhaps the run time detection may be preferred as it will still work in these cases?
Maybe I'm missing something obvious. IMHO kconfig check for CONFIG_USER_NS and CONFIG_PID_NS is equal to checking for /proc/self/ns/user and /proc/self/ns/pid.
"runtime detection" you mean looking at /proc, but actually both ways are "runtime detections" because LTP expects correct kernel config for running kernel or looks into /proc/config.gz.
Just looking at /proc is faster and works without KCONFIG_SKIP_CHECK. OTOH kconfig is somehow documenting it. It could be documented in normal test doc if we inspect /proc.
@Li @Cyril, I'm sorry to raise this again (I haven't found a thread in which we discussed it last time). Which one do we prefer in case both can be used?
Quoted 6 lines
I'm not sure how common either of those cases are though?
Would it be better to have the run time detection in
tst_kconfig_checkas a fall back in case the config is not present?
Then the tests can just define theneeds_kconfigsand not have to worry about other checks.
Using both looks to me overkill.
Kind regards,
Petr
Quoted 23 lines
Quoted 14 lines
Quoted 12 lines
or into upcommig
doc/developers/ground_rules.rst
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/Kind regards,
PetrQuoted 6 lines
Quoted 2 lines
And if we decide for forcing kconfig, we should update
ioctl_ns06.c, which does /proc based detection (i.e. to use the same approach).I didn't check this, but I'm pretty sure we should go all around and verify many other tests with the same issue. We should do it in this patch-set or on a searate one.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Kind regards,
PetrSo what we do with the patch? Should we merge it?
I'm happy to go through and update other tests in this patch or another.
Thanks
Terry
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Sure, .needs_kconfigs is used when test request some functionality based on kconfig. But many tests use /proc or /sys based detection (e.g.
ioctl_ns06.c) or based on certain errno, seeinclude/lapi/syscalls.hortestcases/kernel/syscalls/fanotify/fanotify.h) because these were added before LTP supported kconfig. Later, when kconfig was added it was considering as a last resort (when there was no way to detect dependency otherwise).Have we decide to move everything into kconfig?
I'm not sure myself.
needs_kconfigsis simpler and obvious, but it requires kernel config. I suppose the speed of parsing config is not an issue.It'd be nice to mention the resolution (preferred vs. only if no other way to detect the support) into
https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.html
Quoted 8 lines
Quoted 3 lines
Feel free to add this comment, but for me it's obvious that if a feature can't be present in the kernel due to kconfigs we should check kconfig :-)
I've just taken another look at this and it appears the test would still fail if the config is not present or if
KCONFIG_SKIP_CHECKis set, in which case perhaps the run time detection may be preferred as it will still work in these cases?
The KCONFIG_SKIP_CHECK is a flag aimed at developers, it shouldn't be enabled in production testing.
As for the missing config there is 95 testcases that have needs_kconfigs set at this moment and the number is growing steadily. I would argue that you cannot run LTP without having config available. And the config location is autodetected on common distributions as well.
Quoted 4 lines
Would it be better to have the run time detection in
tst_kconfig_checkas a fall back in case the config is not present?
Then the tests can just define theneeds_kconfigsand not have to worry about other checks.
I would avoid any complexity that isn't strictly necessary, the less we do, the less breakage we have to deal with later. In that sense adding the needs_kconfigs and expect the config to be there is probably the most straightforward solution.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 40 lines
Hi!
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
Sure, .needs_kconfigs is used when test request some functionality based on kconfig. But many tests use /proc or /sys based detection (e.g.
ioctl_ns06.c) or based on certain errno, seeinclude/lapi/syscalls.hortestcases/kernel/syscalls/fanotify/fanotify.h) because these were added before LTP supported kconfig. Later, when kconfig was added it was considering as a last resort (when there was no way to detect dependency otherwise).Have we decide to move everything into kconfig?
I'm not sure myself.
needs_kconfigsis simpler and obvious, but it requires kernel config. I suppose the speed of parsing config is not an issue.It'd be nice to mention the resolution (preferred vs. only if no other way to detect the support) into
https://linux-test-project.readthedocs.io/en/latest/developers/writing_tests.htmlQuoted 8 lines
Quoted 3 lines
Feel free to add this comment, but for me it's obvious that if a feature can't be present in the kernel due to kconfigs we should check kconfig :-)
I've just taken another look at this and it appears the test would still fail if the config is not present or if
KCONFIG_SKIP_CHECKis set, in which case perhaps the run time detection may be preferred as it will still work in these cases?The
KCONFIG_SKIP_CHECKis a flag aimed at developers, it shouldn't be enabled in production testing.As for the missing config there is 95 testcases that have
needs_kconfigsset at this moment and the number is growing steadily. I would argue that you cannot run LTP without having config available. And the config location is autodetected on common distributions as well.Quoted 4 lines
Would it be better to have the run time detection in
tst_kconfig_checkas a fall back in case the config is not present?
Then the tests can just define theneeds_kconfigsand not have to worry about other checks.
Quoted 4 lines
I would avoid any complexity that isn't strictly necessary, the less we do, the less breakage we have to deal with later. In that sense adding the
needs_kconfigsand expect the config to be there is probably the most straightforward solution.
Thanks for your input. I understand that you're for replacing in ioctl_ns06.c:
int exists = access("/proc/self/ns/user", F_OK);
if (exists < 0)
tst_res(TCONF, "namespace not available");with .needs_kconfigs:
.needs_kconfigs = (const char *[]) {
"CONFIG_USER_NS",
NULL
}Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 9 lines
Thanks for your input. I understand that you're for replacing in
ioctl_ns06.c:int exists = access("/proc/self/ns/user", F_OK); if (exists < 0) tst_res(TCONF, "namespace not available");with .needs_kconfigs:
Quoted 8 lines
.needs_kconfigs = (const char *[]) { "CONFIG_USER_NS", NULL }Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
I think that from a long term view this is going to be simpler solution than having many different types of checks. The less diverse these checks are the easier they are to review and maintain. Hence I lean towards kernel config checks even though they are slower (mostly unmeasurable on today's harware) than the alternatives.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 19 lines
Hi!
Quoted 9 lines
Thanks for your input. I understand that you're for replacing in
ioctl_ns06.c:int exists = access("/proc/self/ns/user", F_OK); if (exists < 0) tst_res(TCONF, "namespace not available");with .needs_kconfigs:
Quoted 8 lines
.needs_kconfigs = (const char *[]) { "CONFIG_USER_NS", NULL }Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
Quoted 5 lines
I think that from a long term view this is going to be simpler solution than having many different types of checks. The less diverse these checks are the easier they are to review and maintain. Hence I lean towards kernel config checks even though they are slower (mostly unmeasurable on today's harware) than the alternatives.
Great, thanks for a general resolution. Unless somebody objects I'm ok with the conclusion (ideally we should formalise it in rules in docs).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 20 lines · Cyril Hrubis
Hi!
Quoted 9 lines
Thanks for your input. I understand that you're for replacing in
ioctl_ns06.c:int exists = access("/proc/self/ns/user", F_OK); if (exists < 0) tst_res(TCONF, "namespace not available");with .needs_kconfigs:
Quoted 8 lines
.needs_kconfigs = (const char *[]) { "CONFIG_USER_NS", NULL }Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
Quoted 5 lines
I think that from a long term view this is going to be simpler solution than having many different types of checks. The less diverse these checks are the easier they are to review and maintain. Hence I lean towards kernel config checks even though they are slower (mostly unmeasurable on today's harware) than the alternatives.
I think I lean opposite way, and rather have a check for right environment to support the test.
You can have feature X enabled in kernel config, but still disabled later at boot/runtime
(e.g. max_user_namespaces=0), or a module simply not being loaded.
Quoted 5 lines
--
Cyril Hrubis
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 27 lines · Cyril Hrubis
Quoted 20 lines
Hi!
Quoted 9 lines
Thanks for your input. I understand that you're for replacing in
ioctl_ns06.c:int exists = access("/proc/self/ns/user", F_OK); if (exists < 0) tst_res(TCONF, "namespace not available");with .needs_kconfigs:
Quoted 8 lines
.needs_kconfigs = (const char *[]) { "CONFIG_USER_NS", NULL }Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
Quoted 5 lines
I think that from a long term view this is going to be simpler solution than having many different types of checks. The less diverse these checks are the easier they are to review and maintain. Hence I lean towards kernel config checks even though they are slower (mostly unmeasurable on today's harware) than the alternatives.
Quoted 5 lines
I think I lean opposite way, and rather have a check for right environment to support the test.
You can have feature X enabled in kernel config, but still disabled later at boot/runtime
(e.g. max_user_namespaces=0), or a module simply not being loaded.
+1, all "tristate" configured as module might be missing. (openSUSE JeOS suffers with this when minimal kernel is installed).
But "bool" are safe unless depend on "tristate" configured as module (not the case of CONFIG_USER_NS).
Kind regards,
Petr
Quoted 3 lines
Quoted 3 lines
--
Cyril Hrubis
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel
Reviewed-by...
Quoted 16 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
I think that from a long term view this is going to be simpler solution than having many different types of checks. The less diverse these checks are the easier they are to review and maintain. Hence I lean towards kernel config checks even though they are slower (mostly unmeasurable on today's harware) than the alternatives.
Quoted 5 lines
I think I lean opposite way, and rather have a check for right environment to support the test.
You can have feature X enabled in kernel config, but still disabled later at boot/runtime
(e.g. max_user_namespaces=0), or a module simply not being loaded.
Quoted 8 lines
+1, all "tristate" configured as module might be missing. (openSUSE JeOS suffers with this when minimal kernel is installed).
But "bool" are safe unless depend on "tristate" configured as module (not the case of
CONFIG_USER_NS).Kind regards,
Petr
OK, it's a bool, let's merge it.
I'm sorry to block it with a long discussion, but IMHO it was useful to bring some conclusion (I'm going to send a patch for rules).
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Cyril Hrubis
Reviewed-byHi!
Quoted 3 lines
OK, it's a bool, let's merge it.
I'm sorry to block it with a long discussion, but IMHO it was useful to bring some conclusion (I'm going to send a patch for rules).
I would merge this before the release, since this works fine as long as namespaces are not disabled on commandline, which should be a corner case and I would like to fix that with the hooks I've proposed in reply to email from Jan.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 11 lines
Hi!
Quoted 3 lines
OK, it's a bool, let's merge it.
I'm sorry to block it with a long discussion, but IMHO it was useful to bring some conclusion (I'm going to send a patch for rules).I would merge this before the release, since this works fine as long as namespaces are not disabled on commandline, which should be a corner case and I would like to fix that with the hooks I've proposed in reply to email from Jan.
Reviewed-by Cyril Hrubis <[email protected]>
Right, finally merged.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
I think that from a long term view this is going to be simpler solution than having many different types of checks. The less diverse these checks are the easier they are to review and maintain. Hence I lean towards kernel config checks even though they are slower (mostly unmeasurable on today's harware) than the alternatives.
Quoted 5 lines
I think I lean opposite way, and rather have a check for right environment to support the test.
You can have feature X enabled in kernel config, but still disabled later at boot/runtime
(e.g. max_user_namespaces=0), or a module simply not being loaded.
That is a good catch.
Maybe the best way forward would be to add hooks for certain config options into the LTP kernel config parser that would do additional runtime checks. That way we would have both the information on which kernel configs should be enabled in test metadata as well as runtime checks.
What about eventually adding something as:
lib/tst_kconfig.c +14 -0
@@ -110,6 +110,18 @@ static void close_kconfig(FILE *fp)fclose (fp); } +static void runtime_check (struct tst_kconfig_var *var) +{ +if (strstr (var->id,"CONFIG_USER_NS" )) { +if (!tst_user_ns_enabled ()) { +tst_res (TINFO ,"CONFIG_USER_NS present but runtime is disabled" ); + var->val ='n' ; + } + } else if (...) + ... + } +} +static inline int kconfig_parse_line (const char *line,struct tst_kconfig_var *vars,unsigned int vars_len)
@@ -183,9 +195,11 @@ out:switch (val[0 ]) {case 'y' : vars[i].choice ='y' ; +runtime_check (&vars[i]);return 1 ;case 'm' : vars[i].choice ='m' ; +runtime_check (&vars[i]);return 1 ; } }
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi all,
[ Cc Martin ]
Quoted 17 lines
Hi!
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
Because that was my question - really always prefer kconfig even there is a simple runtime solution? I'd like to have some "rule" like conclusion we can point during review.
I think that from a long term view this is going to be simpler solution than having many different types of checks. The less diverse these checks are the easier they are to review and maintain. Hence I lean towards kernel config checks even though they are slower (mostly unmeasurable on today's harware) than the alternatives.
Quoted 5 lines
I think I lean opposite way, and rather have a check for right environment to support the test.
You can have feature X enabled in kernel config, but still disabled later at boot/runtime
(e.g. max_user_namespaces=0), or a module simply not being loaded.
Quoted 7 lines
That is a good catch.
Maybe the best way forward would be to add hooks for certain config options into the LTP kernel config parser that would do additional runtime checks. That way we would have both the information on which kernel configs should be enabled in test metadata as well as runtime checks.
I like the idea: having metadata doc + runtime check is nice.
FYI (I know you all watch GitHub PR but just in case) to document that for some tests require more things to check, e.g. kconfig + min_kver:
https://github.com/linux-test-project/ltp/pull/1285
Kind regards,
Petr
Quoted 37 lines
What about eventually adding something as:
lib/tst_kconfig.c +14
-0@@ -110,6 +110,18 @@ static void close_kconfig(FILE *fp)fclose (fp); } +static void runtime_check (struct tst_kconfig_var *var) +{ +if (strstr (var->id,"CONFIG_USER_NS" )) { +if (!tst_user_ns_enabled ()) { +tst_res (TINFO ,"CONFIG_USER_NS present but runtime is disabled" ); + var->val ='n' ; + } + } else if (...) + ... + } +} +static inline int kconfig_parse_line (const char *line,struct tst_kconfig_var *vars,unsigned int vars_len)@@ -183,9 +195,11 @@ out:switch (val[0 ]) {case 'y' : vars[i].choice ='y' ; +runtime_check (&vars[i]);return 1 ;case 'm' : vars[i].choice ='m' ; +runtime_check (&vars[i]);return 1 ; } }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 8 lines
Quoted 5 lines
Maybe the best way forward would be to add hooks for certain config options into the LTP kernel config parser that would do additional runtime checks. That way we would have both the information on which kernel configs should be enabled in test metadata as well as runtime checks.
I like the idea: having metadata doc + runtime check is nice.
+1
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp