public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP]  [PATCH 0/3] Additional checks for sched_xxx, socketcall01, inotify06
@ 2016-11-02 11:57 Dejan Jovicevic
  2016-11-02 11:57 ` [LTP] [PATCH 1/3] sched_xxx: TCONF instead of TFAIL if user is not root Dejan Jovicevic
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dejan Jovicevic @ 2016-11-02 11:57 UTC (permalink / raw)
  To: ltp

This series adds checks in setup() to determine if the tests are
run as super user in case of sched_xxx and socketcall01 or to determine
if the test is run with the appropriate kernel version, in case of the
inotify06 test.

Dejan Jovicevic (3):
  sched_xxx: TCONF instead of TFAIL if user is not root
  socketcall: TCONF instead of TFAIL when user is not root
  inotify06: kernel version check

 testcases/kernel/syscalls/inotify/inotify06.c                          | 3 +++
 .../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 ++
 testcases/kernel/syscalls/socketcall/socketcall01.c                    | 1 +
 7 files changed, 10 insertions(+)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [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 1/3] sched_xxx: TCONF instead of TFAIL if user is not root
  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 14:07   ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2016-11-02 14:07 UTC (permalink / raw)
  To: ltp

Hi!
>  void setup(void)
>  {
> +	tst_require_root();
> +
>  	struct sched_param p = { 1 };

I've changed this part so that the call to tst_require_root() goes after
the struct sched_param declaration and pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[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 2/3] socketcall: TCONF instead of TFAIL when " Dejan Jovicevic
@ 2016-11-02 14:46   ` Cyril Hrubis
  0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2016-11-02 14:46 UTC (permalink / raw)
  To: ltp

Hi!
> sockatcall01 uses certain protocols that require super user
> privileges.

Right, the RAW socket needs root. You should have included that in the
commit message from the start. Pushed with better commit message, thanks.

Also it took me while to realize that the syscall is not implemented on
x86_64 and that the test returns PASS wrongly instead of CONF. I have
fixed that in another patch as well.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[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

end of thread, other threads:[~2016-11-02 14:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 14:07   ` Cyril Hrubis
2016-11-02 11:57 ` [LTP] [PATCH 2/3] socketcall: TCONF instead of TFAIL when " Dejan Jovicevic
2016-11-02 14:46   ` Cyril Hrubis
2016-11-02 11:57 ` [LTP] [PATCH 3/3] inotify06: kernel version check Dejan Jovicevic
2016-11-02 14:48   ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox