* [LTP] [PATCH 1/3] sched_xxx: TCONF instead of TFAIL if user is not root
2016-11-02 11:57 [LTP] [PATCH 0/3] Additional checks for sched_xxx, socketcall01, inotify06 Dejan Jovicevic
@ 2016-11-02 11:57 ` Dejan Jovicevic
2016-11-02 14:07 ` Cyril Hrubis
2016-11-02 11:57 ` [LTP] [PATCH 2/3] socketcall: TCONF instead of TFAIL when " Dejan Jovicevic
2016-11-02 11:57 ` [LTP] [PATCH 3/3] inotify06: kernel version check Dejan Jovicevic
2 siblings, 1 reply; 7+ messages in thread
From: Dejan Jovicevic @ 2016-11-02 11:57 UTC (permalink / raw)
To: ltp
Tests sched_rr_get_interval01, sched_rr_get_interval02,
sched_rr_get_interval03, sched_setparam02 and sched_setparam03
break with TFAIL if they are not ran as root. This is because
they all require setting scheduling policy to SCHED_RR or other
requiring super user privileges.
This was changed so that tests break with TCONF reporting the
appropriate message to the user if he is not root.
Signed-off-by: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
---
.../kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c | 1 +
.../kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c | 1 +
.../kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c | 1 +
testcases/kernel/syscalls/sched_setparam/sched_setparam02.c | 1 +
testcases/kernel/syscalls/sched_setparam/sched_setparam03.c | 2 ++
5 files changed, 6 insertions(+)
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
index 7527c43..b6084f6 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
@@ -115,6 +115,7 @@ int main(int ac, char **av)
/* setup() - performs all ONE TIME setup for this test */
void setup(void)
{
+ tst_require_root();
/*
* Initialize scheduling parameter structure to use with
* sched_setscheduler()
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
index 5410176..6bf743f 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
@@ -119,6 +119,7 @@ int main(int ac, char **av)
/* setup() - performs all ONE TIME setup for this test */
void setup(void)
{
+ tst_require_root();
/*
* Initialize scheduling parameter structure to use with
* sched_setscheduler()
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
index c9686ad..56f2fcf 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
@@ -142,6 +142,7 @@ int main(int ac, char **av)
/* setup() - performs all ONE TIME setup for this test */
void setup(void)
{
+ tst_require_root();
/*
* Initialize scheduling parameter structure to use with
* sched_setscheduler()
diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c
index 9321a4e..132cc9d 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c
@@ -145,6 +145,7 @@ int main(int ac, char **av)
/* setup() - performs all ONE TIME setup for this test */
void setup(void)
{
+ tst_require_root();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
index 127a74f..50caecb 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
@@ -150,6 +150,8 @@ int main(int ac, char **av)
/* setup() - performs all ONE TIME setup for this test */
void setup(void)
{
+ tst_require_root();
+
struct sched_param p = { 1 };
tst_sig(FORK, DEF_HANDLER, cleanup);
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [LTP] [PATCH 2/3] socketcall: TCONF instead of TFAIL when user is not root
2016-11-02 11:57 [LTP] [PATCH 0/3] Additional checks for sched_xxx, socketcall01, inotify06 Dejan Jovicevic
2016-11-02 11:57 ` [LTP] [PATCH 1/3] sched_xxx: TCONF instead of TFAIL if user is not root Dejan Jovicevic
@ 2016-11-02 11:57 ` Dejan Jovicevic
2016-11-02 14:46 ` Cyril Hrubis
2016-11-02 11:57 ` [LTP] [PATCH 3/3] inotify06: kernel version check Dejan Jovicevic
2 siblings, 1 reply; 7+ messages in thread
From: Dejan Jovicevic @ 2016-11-02 11:57 UTC (permalink / raw)
To: ltp
sockatcall01 uses certain protocols that require super user
privileges.
Signed-off-by: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
---
testcases/kernel/syscalls/socketcall/socketcall01.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/testcases/kernel/syscalls/socketcall/socketcall01.c b/testcases/kernel/syscalls/socketcall/socketcall01.c
index d439729..b576bd8 100644
--- a/testcases/kernel/syscalls/socketcall/socketcall01.c
+++ b/testcases/kernel/syscalls/socketcall/socketcall01.c
@@ -142,6 +142,7 @@ int main(int ac, char **av)
/* setup() - performs all ONE TIME setup for this test. */
void setup(void)
{
+ tst_require_root();
tst_sig(NOFORK, DEF_HANDLER, cleanup);
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [LTP] [PATCH 3/3] inotify06: kernel version check
2016-11-02 11:57 [LTP] [PATCH 0/3] Additional checks for sched_xxx, socketcall01, inotify06 Dejan Jovicevic
2016-11-02 11:57 ` [LTP] [PATCH 1/3] sched_xxx: TCONF instead of TFAIL if user is not root Dejan Jovicevic
2016-11-02 11:57 ` [LTP] [PATCH 2/3] socketcall: TCONF instead of TFAIL when " Dejan Jovicevic
@ 2016-11-02 11:57 ` Dejan Jovicevic
2016-11-02 14:48 ` Cyril Hrubis
2 siblings, 1 reply; 7+ messages in thread
From: Dejan Jovicevic @ 2016-11-02 11:57 UTC (permalink / raw)
To: ltp
For test inotify06, kernels prior to 4.2 have a race when inode
is being deleted while inotify group watching that inode is being
torn down. When the race is hit, the kernel crashes or loops. So,
added a check to see if the kernel is >= 4.2.0, and if not, the
test breaks with TCONF and an appropriate message.
Signed-off-by: Dejan Jovicevic <dejan.jovicevic@rt-rk.com>
---
testcases/kernel/syscalls/inotify/inotify06.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/testcases/kernel/syscalls/inotify/inotify06.c b/testcases/kernel/syscalls/inotify/inotify06.c
index 71f7596..1caa70d 100644
--- a/testcases/kernel/syscalls/inotify/inotify06.c
+++ b/testcases/kernel/syscalls/inotify/inotify06.c
@@ -67,6 +67,9 @@ static void cleanup(void)
static void setup(void)
{
+ if (tst_kvercmp(4, 2, 0) < 0)
+ tst_brkm(TCONF, NULL, "Test must be run with kernel 4.2 or newer");
+
int i;
tst_sig(FORK, DEF_HANDLER, cleanup);
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [LTP] [PATCH 3/3] inotify06: kernel version check
2016-11-02 11:57 ` [LTP] [PATCH 3/3] inotify06: kernel version check Dejan Jovicevic
@ 2016-11-02 14:48 ` Cyril Hrubis
0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2016-11-02 14:48 UTC (permalink / raw)
To: ltp
Hi!
> For test inotify06, kernels prior to 4.2 have a race when inode
> is being deleted while inotify group watching that inode is being
> torn down. When the race is hit, the kernel crashes or loops. So,
> added a check to see if the kernel is >= 4.2.0, and if not, the
> test breaks with TCONF and an appropriate message.
NO.
Bringing down broken kernel is exactly the whole point of the test.
Otherwise you cannot tell if the fix was backported to your kernel or
not.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 7+ messages in thread