All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it
@ 2015-10-28  3:11 Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 2/11] capset/capset02: " Cui Bixuan
                   ` (9 more replies)
  0 siblings, 10 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for setegid().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/bind/bind02.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/bind/bind02.c b/testcases/kernel/syscalls/bind/bind02.c
index 721f525..3dc5652 100644
--- a/testcases/kernel/syscalls/bind/bind02.c
+++ b/testcases/kernel/syscalls/bind/bind02.c
@@ -127,6 +127,8 @@ int main(int argc, char *argv[])
 	 * Linux doesn't have that limitation apparently. */
 	char *username = NULL;
 
+	tst_require_root();
+
 	if (argc != 2) {
 		tst_resm(TINFO, "Defaulting to user nobody");
 		username = strdup(nobody_uid);
-- 
1.6.0.2


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

* [LTP] [PATCH 2/11] capset/capset02: Testcase failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 3/11] chroot/chroot04: " Cui Bixuan
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for seteuid().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/capset/capset02.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/capset/capset02.c b/testcases/kernel/syscalls/capset/capset02.c
index 146755c..d08878e 100644
--- a/testcases/kernel/syscalls/capset/capset02.c
+++ b/testcases/kernel/syscalls/capset/capset02.c
@@ -174,6 +174,7 @@ int main(int ac, char **av)
 
 void setup(void)
 {
+	tst_require_root();
 
 	TEST_PAUSE;
 
-- 
1.6.0.2


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

* [LTP] [PATCH 3/11] chroot/chroot04: Testcase failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 2/11] capset/capset02: " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 4/11] execve/execve03: " Cui Bixuan
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for seteuid().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/chroot/chroot04.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/chroot/chroot04.c b/testcases/kernel/syscalls/chroot/chroot04.c
index 6d1d46b..254db0c 100644
--- a/testcases/kernel/syscalls/chroot/chroot04.c
+++ b/testcases/kernel/syscalls/chroot/chroot04.c
@@ -99,6 +99,8 @@ void setup(void)
 {
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
+	tst_require_root();
+
 	TEST_PAUSE;
 
 	/* make a temporary directory and cd to it */
-- 
1.6.0.2


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

* [LTP] [PATCH 4/11] execve/execve03: Testcase failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 2/11] capset/capset02: " Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 3/11] chroot/chroot04: " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 5/11] syscalls/fcntl: Testcases " Cui Bixuan
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for setgid().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/execve/execve03.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/execve/execve03.c b/testcases/kernel/syscalls/execve/execve03.c
index a3e589e..15b575d 100644
--- a/testcases/kernel/syscalls/execve/execve03.c
+++ b/testcases/kernel/syscalls/execve/execve03.c
@@ -166,6 +166,8 @@ void setup(void)
 	char *cwdname = NULL;
 	int fd;
 
+	tst_require_root();
+
 	umask(0);
 
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-- 
1.6.0.2


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

* [LTP] [PATCH 5/11] syscalls/fcntl: Testcases failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
                   ` (2 preceding siblings ...)
  2015-10-28  3:11 ` [LTP] [PATCH 4/11] execve/execve03: " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 6/11] mmap/mmap12: Testcase " Cui Bixuan
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for setreuid().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/fcntl/fcntl18.c |    2 ++
 testcases/kernel/syscalls/fcntl/fcntl33.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/fcntl/fcntl18.c b/testcases/kernel/syscalls/fcntl/fcntl18.c
index 6b9a7aa..5eefbd1 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl18.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl18.c
@@ -171,6 +171,8 @@ void setup(void)
 
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
+	tst_require_root();
+
 	umask(0);
 
 	TEST_PAUSE;
diff --git a/testcases/kernel/syscalls/fcntl/fcntl33.c b/testcases/kernel/syscalls/fcntl/fcntl33.c
index bffb9cb..161c814 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl33.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl33.c
@@ -112,6 +112,8 @@ static void setup(void)
 {
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
+	tst_require_root();
+
 	tst_timer_check(CLOCK_MONOTONIC);
 
 	/* Backup and set the lease-break-time. */
-- 
1.6.0.2


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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
                   ` (3 preceding siblings ...)
  2015-10-28  3:11 ` [LTP] [PATCH 5/11] syscalls/fcntl: Testcases " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-29 11:57   ` Cyril Hrubis
  2015-10-28  3:11 ` [LTP] [PATCH 7/11] mq_open/mq_open01: " Cui Bixuan
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for open /proc/self/pagemap file.

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/mmap/mmap12.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/mmap/mmap12.c b/testcases/kernel/syscalls/mmap/mmap12.c
index ba8c646..7484601 100644
--- a/testcases/kernel/syscalls/mmap/mmap12.c
+++ b/testcases/kernel/syscalls/mmap/mmap12.c
@@ -143,6 +143,8 @@ static void setup(void)
 {
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
+	tst_require_root();
+
 	if ((tst_kvercmp(2, 6, 25)) < 0)
 		tst_brkm(TCONF, NULL,
 			"This test can only run on kernels that are 2.6.25 and "
-- 
1.6.0.2


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

* [LTP] [PATCH 7/11] mq_open/mq_open01: Testcase failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
                   ` (4 preceding siblings ...)
  2015-10-28  3:11 ` [LTP] [PATCH 6/11] mmap/mmap12: Testcase " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 8/11] ipc/msgctl: Testcases " Cui Bixuan
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for mq_open().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/mq_open/mq_open01.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c
index 529dd7a..f53b4bc 100644
--- a/testcases/kernel/syscalls/mq_open/mq_open01.c
+++ b/testcases/kernel/syscalls/mq_open/mq_open01.c
@@ -112,6 +112,8 @@ void cleanup(void)
 /******************************************************************************/
 void setup(void)
 {
+	tst_require_root();
+
 	/* Capture signals if any */
 	/* Create temporary directories */
 	TEST_PAUSE;
-- 
1.6.0.2


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

* [LTP] [PATCH 8/11] ipc/msgctl: Testcases failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
                   ` (5 preceding siblings ...)
  2015-10-28  3:11 ` [LTP] [PATCH 7/11] mq_open/mq_open01: " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 9/11] ipc/semctl: " Cui Bixuan
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for msgctl().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/ipc/msgctl/msgctl06.c |    2 ++
 testcases/kernel/syscalls/ipc/msgctl/msgctl07.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl06.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl06.c
index a0b1d35..6c7108f 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl06.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl06.c
@@ -123,6 +123,8 @@ int main(int argc, char *argv[])
  *   ****************************************************************/
 void setup(void)
 {
+	tst_require_root();
+
 	/* You will want to enable some signal handling so you can capture
 	 * unexpected signals like SIGSEGV.
 	 */
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl07.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl07.c
index ac1215c..0eebfb6 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl07.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl07.c
@@ -299,6 +299,8 @@ void setup(void)
 {
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
+	tst_require_root();
+
 	TEST_PAUSE;
 
 	tst_tmpdir();
-- 
1.6.0.2


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

* [LTP] [PATCH 9/11] ipc/semctl: Testcases failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
                   ` (6 preceding siblings ...)
  2015-10-28  3:11 ` [LTP] [PATCH 8/11] ipc/msgctl: Testcases " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-29 12:45   ` Cyril Hrubis
  2015-10-28  3:11 ` [LTP] [PATCH 10/11] ipc/shmctl: Testcase " Cui Bixuan
  2015-10-28  3:11 ` [LTP] [PATCH 11/11] unshare/unshare01: " Cui Bixuan
  9 siblings, 1 reply; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for semop() and semget().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/ipc/semctl/semctl06.c |    2 ++
 testcases/kernel/syscalls/ipc/semctl/semctl07.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl06.c b/testcases/kernel/syscalls/ipc/semctl/semctl06.c
index c298345..0b7d853 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl06.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl06.c
@@ -387,6 +387,8 @@ void setup(void)
 {
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
+	tst_require_root();
+
 	TEST_PAUSE;
 
 	tst_tmpdir();
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl07.c b/testcases/kernel/syscalls/ipc/semctl/semctl07.c
index 3cc1eff..2eb9b5e 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl07.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl07.c
@@ -155,6 +155,8 @@ void setup(void)
 {
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
+	tst_require_root();
+
 	TEST_PAUSE;
 
 	tst_tmpdir();
-- 
1.6.0.2


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

* [LTP] [PATCH 10/11] ipc/shmctl: Testcase failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
                   ` (7 preceding siblings ...)
  2015-10-28  3:11 ` [LTP] [PATCH 9/11] ipc/semctl: " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-28  7:12   ` Zeng Linggang
  2015-10-29 12:46   ` Cyril Hrubis
  2015-10-28  3:11 ` [LTP] [PATCH 11/11] unshare/unshare01: " Cui Bixuan
  9 siblings, 2 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for shmctl().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/ipc/shmctl/shmctl01.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
index ac66ceb..5aa039f 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
@@ -470,6 +470,8 @@ void setup(void)
 {
 	tst_sig(FORK, sighandler, cleanup);
 
+	Add tst_require_root();
+
 	TEST_PAUSE;
 
 	tst_tmpdir();
-- 
1.6.0.2


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

* [LTP] [PATCH 11/11] unshare/unshare01: Testcase failed when no root user run it
  2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
                   ` (8 preceding siblings ...)
  2015-10-28  3:11 ` [LTP] [PATCH 10/11] ipc/shmctl: Testcase " Cui Bixuan
@ 2015-10-28  3:11 ` Cui Bixuan
  2015-10-29 12:52   ` Cyril Hrubis
  9 siblings, 1 reply; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  3:11 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for unshare().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/unshare/unshare01.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/unshare/unshare01.c b/testcases/kernel/syscalls/unshare/unshare01.c
index 17a5a5f..84d1892 100644
--- a/testcases/kernel/syscalls/unshare/unshare01.c
+++ b/testcases/kernel/syscalls/unshare/unshare01.c
@@ -144,6 +144,8 @@ void cleanup(void)
 /******************************************************************************/
 void setup(void)
 {
+	tst_require_root();
+
 	/* Capture signals if any */
 	/* Create temporary directories */
 	TEST_PAUSE;
-- 
1.6.0.2


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

* [LTP] [PATCH 10/11] ipc/shmctl: Testcase failed when no root user run it
  2015-10-28  3:11 ` [LTP] [PATCH 10/11] ipc/shmctl: Testcase " Cui Bixuan
@ 2015-10-28  7:12   ` Zeng Linggang
  2015-10-28  7:31     ` [LTP] [PATCH 10/11 v2] " Cui Bixuan
  2015-10-28  7:33     ` [LTP] [PATCH 10/11] " Cui Bixuan
  2015-10-29 12:46   ` Cyril Hrubis
  1 sibling, 2 replies; 27+ messages in thread
From: Zeng Linggang @ 2015-10-28  7:12 UTC (permalink / raw)
  To: ltp

Hi,

On Wed, 2015-10-28 at 03:11 +0000, Cui Bixuan wrote:
> Add tst_require_root() to testcase for shmctl().
> 
> Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
> ---
>  testcases/kernel/syscalls/ipc/shmctl/shmctl01.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> index ac66ceb..5aa039f 100644
> --- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> +++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> @@ -470,6 +470,8 @@ void setup(void)
>  {
>  	tst_sig(FORK, sighandler, cleanup);
>  
> +	Add tst_require_root();
> +

tst_requite_root();

Thanks,
Zeng

>  	TEST_PAUSE;
>  
>  	tst_tmpdir();
> -- 
> 1.6.0.2
> 
> 



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

* [LTP] [PATCH 10/11 v2] ipc/shmctl: Testcase failed when no root user run it
  2015-10-28  7:12   ` Zeng Linggang
@ 2015-10-28  7:31     ` Cui Bixuan
  2015-10-28  7:33     ` [LTP] [PATCH 10/11] " Cui Bixuan
  1 sibling, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  7:31 UTC (permalink / raw)
  To: ltp

Add tst_require_root() to testcase for shmctl().

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/ipc/shmctl/shmctl01.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
index ac66ceb..5aa039f 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
@@ -470,6 +470,8 @@ void setup(void)
 {
 	tst_sig(FORK, sighandler, cleanup);

+	tst_require_root();
+
 	TEST_PAUSE;

 	tst_tmpdir();
-- 1.6.0.2

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

* [LTP] [PATCH 10/11] ipc/shmctl: Testcase failed when no root user run it
  2015-10-28  7:12   ` Zeng Linggang
  2015-10-28  7:31     ` [LTP] [PATCH 10/11 v2] " Cui Bixuan
@ 2015-10-28  7:33     ` Cui Bixuan
  1 sibling, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-28  7:33 UTC (permalink / raw)
  To: ltp

On 2015/10/28 15:12, Zeng Linggang wrote:
> Hi,
> 
>>  {
>>  	tst_sig(FORK, sighandler, cleanup);
>>  
>> +	Add tst_require_root();
>> +
> 
> tst_requite_root();
> 
> Thanks,
> Zeng

Thank you :-)

Cui Bixuan
> 
>>  	TEST_PAUSE;
>>  
>>  	tst_tmpdir();
>> -- 
>> 1.6.0.2
>>
>>
> 
> 
> 
> 


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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-28  3:11 ` [LTP] [PATCH 6/11] mmap/mmap12: Testcase " Cui Bixuan
@ 2015-10-29 11:57   ` Cyril Hrubis
  2015-10-30  8:56     ` Cui Bixuan
  2015-10-30  9:19     ` [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it Cui Bixuan
  0 siblings, 2 replies; 27+ messages in thread
From: Cyril Hrubis @ 2015-10-29 11:57 UTC (permalink / raw)
  To: ltp

Hi!
> Add tst_require_root() to testcase for open /proc/self/pagemap file.

On my machines the /proc/self/pagemap is readable by the process (it's
owned by the user that has started the program).

What is output of ls -l /proc/self/pagemap on your machine?

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH 9/11] ipc/semctl: Testcases failed when no root user run it
  2015-10-28  3:11 ` [LTP] [PATCH 9/11] ipc/semctl: " Cui Bixuan
@ 2015-10-29 12:45   ` Cyril Hrubis
  0 siblings, 0 replies; 27+ messages in thread
From: Cyril Hrubis @ 2015-10-29 12:45 UTC (permalink / raw)
  To: ltp

Hi!
> diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl07.c b/testcases/kernel/syscalls/ipc/semctl/semctl07.c
> index 3cc1eff..2eb9b5e 100644
> --- a/testcases/kernel/syscalls/ipc/semctl/semctl07.c
> +++ b/testcases/kernel/syscalls/ipc/semctl/semctl07.c
> @@ -155,6 +155,8 @@ void setup(void)
>  {
>  	tst_sig(NOFORK, DEF_HANDLER, cleanup);
>  
> +	tst_require_root();
> +
>  	TEST_PAUSE;
>  
>  	tst_tmpdir();

This test runs fine without root for me.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH 10/11] ipc/shmctl: Testcase failed when no root user run it
  2015-10-28  3:11 ` [LTP] [PATCH 10/11] ipc/shmctl: Testcase " Cui Bixuan
  2015-10-28  7:12   ` Zeng Linggang
@ 2015-10-29 12:46   ` Cyril Hrubis
  1 sibling, 0 replies; 27+ messages in thread
From: Cyril Hrubis @ 2015-10-29 12:46 UTC (permalink / raw)
  To: ltp

Hi!
> diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> index ac66ceb..5aa039f 100644
> --- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> +++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> @@ -470,6 +470,8 @@ void setup(void)
>  {
>  	tst_sig(FORK, sighandler, cleanup);
>  
> +	Add tst_require_root();
> +
>  	TEST_PAUSE;
>  
>  	tst_tmpdir();

This one runs fine as well.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH 11/11] unshare/unshare01: Testcase failed when no root user run it
  2015-10-28  3:11 ` [LTP] [PATCH 11/11] unshare/unshare01: " Cui Bixuan
@ 2015-10-29 12:52   ` Cyril Hrubis
  0 siblings, 0 replies; 27+ messages in thread
From: Cyril Hrubis @ 2015-10-29 12:52 UTC (permalink / raw)
  To: ltp

Hi!
And the rest (patches I didn't commented) is pushed with slightly
shortened commit message topic (ideally it should fit to 50 chars),
thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-29 11:57   ` Cyril Hrubis
@ 2015-10-30  8:56     ` Cui Bixuan
  2015-10-30  9:29       ` Jan Stancek
  2015-10-30  9:19     ` [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it Cui Bixuan
  1 sibling, 1 reply; 27+ messages in thread
From: Cui Bixuan @ 2015-10-30  8:56 UTC (permalink / raw)
  To: ltp

On 2015/10/29 19:57, Cyril Hrubis wrote:
> Hi!
>> Add tst_require_root() to testcase for open /proc/self/pagemap file.
> 
> On my machines the /proc/self/pagemap is readable by the process (it's
> owned by the user that has started the program).
> 
> What is output of ls -l /proc/self/pagemap on your machine?
I look my system and others:
1) SUSE SP2: 3.0.13-0.27-default (uname -a); test PASS;  -r--r--r-- 1 root root 0 Oct 30 16:13 /proc/self/pagemap
2) Ubuntu: 3.13.0-32-generic;                test PASS;  -r--r--r--. 1 cuibixuan cuibixuan 0 10? 30 16:19 /proc/self/pagemap
3) SUSE: 4.2.0-0.11-default;                 test FAIL;  -r-------- 1 root root 0 Nov 13 01:39 /proc/self/pagemap
4) arm64: linux 4.1.6;                       test FAIL;  -r-------- 1 root root 0 Jan 18 01:53 /proc/self/pagemap

Maybe the higher version of the kernel change the file attributes
of /proc/self/pagemap, I think.

But I read the Documentation/vm/pagemap.txt and look at the source code in kernel,
can't get it. :-(

Someone help?
> 


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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-29 11:57   ` Cyril Hrubis
  2015-10-30  8:56     ` Cui Bixuan
@ 2015-10-30  9:19     ` Cui Bixuan
  1 sibling, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-10-30  9:19 UTC (permalink / raw)
  To: ltp

On 2015/10/29 19:57, Cyril Hrubis wrote:
> Hi!
>> Add tst_require_root() to testcase for open /proc/self/pagemap file.
> 
> On my machines the /proc/self/pagemap is readable by the process (it's
> owned by the user that has started the program).
> 
> What is output of ls -l /proc/self/pagemap on your machine?
I look my system and others:
1) SUSE SP2: 3.0.13-0.27-default (uname -a); test PASS;  -r--r--r-- 1 root root 0 Oct 30 16:13 /proc/self/pagemap
2) Ubuntu: 3.13.0-32-generic;                test PASS;  -r--r--r--. 1 cuibixuan cuibixuan 0 10? 30 16:19 /proc/self/pagemap
3) SUSE: 4.2.0-0.11-default;                 test FAIL;  -r-------- 1 root root 0 Nov 13 01:39 /proc/self/pagemap
4) arm64: linux 4.1.6;                       test FAIL;  -r-------- 1 root root 0 Jan 18 01:53 /proc/self/pagemap

Maybe the higher version of the kernel change the file attributes
of /proc/self/pagemap, I think.

But I read the Documentation/vm/pagemap.txt and look at the source code in kernel,
can't get it. :-(

Someone help?
> 


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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-30  8:56     ` Cui Bixuan
@ 2015-10-30  9:29       ` Jan Stancek
  2015-10-31  0:54         ` Cui Bixuan
  0 siblings, 1 reply; 27+ messages in thread
From: Jan Stancek @ 2015-10-30  9:29 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Cui Bixuan" <cuibixuan@huawei.com>
> To: "Cyril Hrubis" <chrubis@suse.cz>
> Cc: zhuyanpeng@huawei.com, zhanyongming@huawei.com, ltp@lists.linux.it
> Sent: Friday, 30 October, 2015 9:56:36 AM
> Subject: Re: [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
> 
> On 2015/10/29 19:57, Cyril Hrubis wrote:
> > Hi!
> >> Add tst_require_root() to testcase for open /proc/self/pagemap file.
> > 
> > On my machines the /proc/self/pagemap is readable by the process (it's
> > owned by the user that has started the program).
> > 
> > What is output of ls -l /proc/self/pagemap on your machine?
> I look my system and others:
> 1) SUSE SP2: 3.0.13-0.27-default (uname -a); test PASS;  -r--r--r-- 1 root
> root 0 Oct 30 16:13 /proc/self/pagemap
> 2) Ubuntu: 3.13.0-32-generic;                test PASS;  -r--r--r--. 1
> cuibixuan cuibixuan 0 10? 30 16:19 /proc/self/pagemap
> 3) SUSE: 4.2.0-0.11-default;                 test FAIL;  -r-------- 1 root
> root 0 Nov 13 01:39 /proc/self/pagemap
> 4) arm64: linux 4.1.6;                       test FAIL;  -r-------- 1 root
> root 0 Jan 18 01:53 /proc/self/pagemap
> 
> Maybe the higher version of the kernel change the file attributes
> of /proc/self/pagemap, I think.

commit 32ed74a4b968a4faff7aaaff557035ce5d5e70ab
Author: Djalal Harouni <tixxdz@opendz.org>
Date:   Mon Apr 7 15:38:38 2014 -0700

    procfs: make /proc/*/pagemap 0400
    
    The /proc/*/pagemap contain sensitive information and currently its mode
    is 0444.  Change this to 0400, so the VFS will prevent unprivileged
    processes from getting file descriptors on arbitrary privileged
    /proc/*/pagemap files.

but that doesn't explain why process can't read its own pagemap.
For 3) and 4): Did you run that as unprivileged user or as a root?

Can you paste full output from mmap12 run (the one that fails)?

Regards,
Jan

> 
> But I read the Documentation/vm/pagemap.txt and look at the source code in
> kernel,
> can't get it. :-(
> 
> Someone help?
> > 
> 
> 
> --
> Mailing list info: http://lists.linux.it/listinfo/ltp
> 

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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-30  9:29       ` Jan Stancek
@ 2015-10-31  0:54         ` Cui Bixuan
  2015-10-31  8:15           ` Jan Stancek
  0 siblings, 1 reply; 27+ messages in thread
From: Cui Bixuan @ 2015-10-31  0:54 UTC (permalink / raw)
  To: ltp

On 2015/10/30 17:29, Jan Stancek wrote:
> 
> 
> 
> 
> ----- Original Message -----
>> From: "Cui Bixuan" <cuibixuan@huawei.com>
>> To: "Cyril Hrubis" <chrubis@suse.cz>
>> Cc: zhuyanpeng@huawei.com, zhanyongming@huawei.com, ltp@lists.linux.it
>> Sent: Friday, 30 October, 2015 9:56:36 AM
>> Subject: Re: [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
>>
>> On 2015/10/29 19:57, Cyril Hrubis wrote:
>>> Hi!
>>>> Add tst_require_root() to testcase for open /proc/self/pagemap file.
>>>
>>> On my machines the /proc/self/pagemap is readable by the process (it's
>>> owned by the user that has started the program).
>>>
>>> What is output of ls -l /proc/self/pagemap on your machine?
>> I look my system and others:
>> 1) SUSE SP2: 3.0.13-0.27-default (uname -a); test PASS;  -r--r--r-- 1 root
>> root 0 Oct 30 16:13 /proc/self/pagemap
>> 2) Ubuntu: 3.13.0-32-generic;                test PASS;  -r--r--r--. 1
>> cuibixuan cuibixuan 0 10? 30 16:19 /proc/self/pagemap
>> 3) SUSE: 4.2.0-0.11-default;                 test FAIL;  -r-------- 1 root
>> root 0 Nov 13 01:39 /proc/self/pagemap
>> 4) arm64: linux 4.1.6;                       test FAIL;  -r-------- 1 root
>> root 0 Jan 18 01:53 /proc/self/pagemap
>>
>> Maybe the higher version of the kernel change the file attributes
>> of /proc/self/pagemap, I think.
> 
> commit 32ed74a4b968a4faff7aaaff557035ce5d5e70ab
> Author: Djalal Harouni <tixxdz@opendz.org>
> Date:   Mon Apr 7 15:38:38 2014 -0700
> 
>     procfs: make /proc/*/pagemap 0400
>     
>     The /proc/*/pagemap contain sensitive information and currently its mode
>     is 0444.  Change this to 0400, so the VFS will prevent unprivileged
>     processes from getting file descriptors on arbitrary privileged
>     /proc/*/pagemap files.
> 
> but that doesn't explain why process can't read its own pagemap.
> For 3) and 4): Did you run that as unprivileged user or as a root?
> 
> Can you paste full output from mmap12 run (the one that fails)?
> 
Ok,

3)
linux-91x6:/home/cuibixuan/ltp.git/testcases/kernel/syscalls/mmap # ./mmap12
mmap12      1  TPASS  :  Functionality of mmap() successful
linux-91x6:/home/cuibixuan/ltp.git/testcases/kernel/syscalls/mmap # uname -a
Linux linux-91x6 4.2.0-0.11-default #1 SMP Mon Sep 28 06:25:26 CST 2015 x86_64 x86_64 x86_64 GNU/Linux
linux-91x6:/home/cuibixuan/ltp.git/testcases/kernel/syscalls/mmap # ./mmap12
mmap12      1  TPASS  :  Functionality of mmap() successful
linux-91x6:/home/cuibixuan/ltp.git/testcases/kernel/syscalls/mmap # su cuibixuan
cuibixuan@linux-91x6:~/ltp.git/testcases/kernel/syscalls/mmap> ./mmap12
mmap12      1  TFAIL  :  mmap12.c:112: Open dev pagemap failed: errno=EPERM(1): Operation not permitted
cuibixuan@linux-91x6:~/ltp.git/testcases/kernel/syscalls/mmap> ls -l /proc/self/pagemap
-r-------- 1 cuibixuan users 0 Nov 13 18:19 /proc/self/pagemap


4)
[root@localhost tmp]# ./mmap12
mmap12      1  TPASS  :  Functionality of mmap() successful
[root@localhost tmp]# su cuibixuan
[cuibixuan@localhost tmp]$ ./mmap12
mmap12      1  TFAIL  :  mmap12.c:112: Open dev pagemap failed: errno=EPERM(1): Operation not permitted
[cuibixuan@localhost tmp]$ ls -l /proc/self/pagemap
-r-------- 1 cuibixuan cuibixuan 0 Jun  2 18:03 /proc/self/pagemap
[cuibixuan@localhost tmp]$ uname -r
4.1.6+
[cuibixuan@localhost tmp]$ uname -i
aarch64

> Regards,
> Jan
> 
>>
>> But I read the Documentation/vm/pagemap.txt and look at the source code in
>> kernel,
>> can't get it. :-(
>>
>> Someone help?
>>>
>>
>>
>> --
>> Mailing list info: http://lists.linux.it/listinfo/ltp
>>
> 
> .
> 


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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-31  0:54         ` Cui Bixuan
@ 2015-10-31  8:15           ` Jan Stancek
  2015-11-02 11:54             ` Cyril Hrubis
  0 siblings, 1 reply; 27+ messages in thread
From: Jan Stancek @ 2015-10-31  8:15 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Cui Bixuan" <cuibixuan@huawei.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: "Cyril Hrubis" <chrubis@suse.cz>, zhuyanpeng@huawei.com, zhanyongming@huawei.com, ltp@lists.linux.it
> Sent: Saturday, 31 October, 2015 1:54:07 AM
> Subject: Re: [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
> 
> On 2015/10/30 17:29, Jan Stancek wrote:
> > 
> > 
> > 
> > 
> > ----- Original Message -----
> >> From: "Cui Bixuan" <cuibixuan@huawei.com>
> >> To: "Cyril Hrubis" <chrubis@suse.cz>
> >> Cc: zhuyanpeng@huawei.com, zhanyongming@huawei.com, ltp@lists.linux.it
> >> Sent: Friday, 30 October, 2015 9:56:36 AM
> >> Subject: Re: [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root
> >> user run it
> >>
> >> On 2015/10/29 19:57, Cyril Hrubis wrote:
> >>> Hi!
> >>>> Add tst_require_root() to testcase for open /proc/self/pagemap file.
> >>>
> >>> On my machines the /proc/self/pagemap is readable by the process (it's
> >>> owned by the user that has started the program).
> >>>
> >>> What is output of ls -l /proc/self/pagemap on your machine?
> >> I look my system and others:
> >> 1) SUSE SP2: 3.0.13-0.27-default (uname -a); test PASS;  -r--r--r-- 1 root
> >> root 0 Oct 30 16:13 /proc/self/pagemap
> >> 2) Ubuntu: 3.13.0-32-generic;                test PASS;  -r--r--r--. 1
> >> cuibixuan cuibixuan 0 10? 30 16:19 /proc/self/pagemap
> >> 3) SUSE: 4.2.0-0.11-default;                 test FAIL;  -r-------- 1 root
> >> root 0 Nov 13 01:39 /proc/self/pagemap
> >> 4) arm64: linux 4.1.6;                       test FAIL;  -r-------- 1 root
> >> root 0 Jan 18 01:53 /proc/self/pagemap
> >>
> >> Maybe the higher version of the kernel change the file attributes
> >> of /proc/self/pagemap, I think.
> > 
> > commit 32ed74a4b968a4faff7aaaff557035ce5d5e70ab
> > Author: Djalal Harouni <tixxdz@opendz.org>
> > Date:   Mon Apr 7 15:38:38 2014 -0700
> > 
> >     procfs: make /proc/*/pagemap 0400
> >     
> >     The /proc/*/pagemap contain sensitive information and currently its
> >     mode
> >     is 0444.  Change this to 0400, so the VFS will prevent unprivileged
> >     processes from getting file descriptors on arbitrary privileged
> >     /proc/*/pagemap files.
> > 
> > but that doesn't explain why process can't read its own pagemap.
> > For 3) and 4): Did you run that as unprivileged user or as a root?
> > 

Looks like the EPERM is from this patch, which disabled reading for non-privileged users:

commit ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Date:   Mon Mar 9 23:11:12 2015 +0200
    pagemap: do not leak physical addresses to non-privileged userspace

it was later removed in:

commit 1c90308e7a77af6742a97d1021cca923b23b7f0d
Author: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date:   Tue Sep 8 15:00:07 2015 -0700
    pagemap: hide physical addresses from non-privileged users

So I'm thinking that we should check "if euid != 0 and opening pagemap gives EPERM",
then quit with TCONF.

Regards,
Jan

> 
> > Regards,
> > Jan
> > 
> >>
> >> But I read the Documentation/vm/pagemap.txt and look at the source code in
> >> kernel,
> >> can't get it. :-(
> >>
> >> Someone help?
> >>>
> >>
> >>
> >> --
> >> Mailing list info: http://lists.linux.it/listinfo/ltp
> >>
> > 
> > .
> > 
> 
> 

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

* [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it
  2015-10-31  8:15           ` Jan Stancek
@ 2015-11-02 11:54             ` Cyril Hrubis
  2015-11-03  8:01               ` [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user Cui Bixuan
  0 siblings, 1 reply; 27+ messages in thread
From: Cyril Hrubis @ 2015-11-02 11:54 UTC (permalink / raw)
  To: ltp

Hi!
> So I'm thinking that we should check "if euid != 0 and opening pagemap gives EPERM",
> then quit with TCONF.

Sounds good to me.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user
  2015-11-02 11:54             ` Cyril Hrubis
@ 2015-11-03  8:01               ` Cui Bixuan
  2015-11-03  8:24                 ` Jan Stancek
  0 siblings, 1 reply; 27+ messages in thread
From: Cui Bixuan @ 2015-11-03  8:01 UTC (permalink / raw)
  To: ltp

Unprivileged user open /proc/self/pagemap fail so add check for it

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 testcases/kernel/syscalls/mmap/mmap12.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/mmap/mmap12.c b/testcases/kernel/syscalls/mmap/mmap12.c
index ba8c646..ebc44ae 100644
--- a/testcases/kernel/syscalls/mmap/mmap12.c
+++ b/testcases/kernel/syscalls/mmap/mmap12.c
@@ -108,8 +108,14 @@ static int page_check(void)
 	index = (vmstart / page_sz) * sizeof(uint64_t);

 	pm = open("/proc/self/pagemap", O_RDONLY);
-	if (pm == -1)
-		tst_brkm(TFAIL | TERRNO, NULL, "Open dev pagemap failed");
+	if (pm == -1) {
+		if ((0 != geteuid()) && (errno == EPERM))
+			tst_brkm(TCONF | TERRNO, NULL,
+				"don't have permission to open dev pagemap");
+		else
+			tst_brkm(TFAIL | TERRNO, NULL,
+				"Open dev pagemap failed");
+	}

 	offset = lseek(pm, index, SEEK_SET);
 	if (offset != index)
-- 
1.6.0.2

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

* [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user
  2015-11-03  8:01               ` [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user Cui Bixuan
@ 2015-11-03  8:24                 ` Jan Stancek
  2015-11-03  8:45                   ` Cui Bixuan
  0 siblings, 1 reply; 27+ messages in thread
From: Jan Stancek @ 2015-11-03  8:24 UTC (permalink / raw)
  To: ltp





----- Original Message -----
> From: "Cui Bixuan" <cuibixuan@huawei.com>
> To: "Cyril Hrubis" <chrubis@suse.cz>
> Cc: "Jan Stancek" <jstancek@redhat.com>, zhuyanpeng@huawei.com, zhanyongming@huawei.com, ltp@lists.linux.it
> Sent: Tuesday, 3 November, 2015 9:01:22 AM
> Subject: [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user
> 
> Unprivileged user open /proc/self/pagemap fail so add check for it
> 
> Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>

Pushed with more verbose commit message and small changes to style.

Regards,
Jan

> ---
>  testcases/kernel/syscalls/mmap/mmap12.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/mmap/mmap12.c
> b/testcases/kernel/syscalls/mmap/mmap12.c
> index ba8c646..ebc44ae 100644
> --- a/testcases/kernel/syscalls/mmap/mmap12.c
> +++ b/testcases/kernel/syscalls/mmap/mmap12.c
> @@ -108,8 +108,14 @@ static int page_check(void)
>  	index = (vmstart / page_sz) * sizeof(uint64_t);
> 
>  	pm = open("/proc/self/pagemap", O_RDONLY);
> -	if (pm == -1)
> -		tst_brkm(TFAIL | TERRNO, NULL, "Open dev pagemap failed");
> +	if (pm == -1) {
> +		if ((0 != geteuid()) && (errno == EPERM))
> +			tst_brkm(TCONF | TERRNO, NULL,
> +				"don't have permission to open dev pagemap");
> +		else
> +			tst_brkm(TFAIL | TERRNO, NULL,
> +				"Open dev pagemap failed");
> +	}
> 
>  	offset = lseek(pm, index, SEEK_SET);
>  	if (offset != index)
> --
> 1.6.0.2
> 

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

* [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user
  2015-11-03  8:24                 ` Jan Stancek
@ 2015-11-03  8:45                   ` Cui Bixuan
  0 siblings, 0 replies; 27+ messages in thread
From: Cui Bixuan @ 2015-11-03  8:45 UTC (permalink / raw)
  To: ltp

On 2015/11/3 16:24, Jan Stancek wrote:
> 
> 
> 
> 
> ----- Original Message -----
>> From: "Cui Bixuan" <cuibixuan@huawei.com>
>> To: "Cyril Hrubis" <chrubis@suse.cz>
>> Cc: "Jan Stancek" <jstancek@redhat.com>, zhuyanpeng@huawei.com, zhanyongming@huawei.com, ltp@lists.linux.it
>> Sent: Tuesday, 3 November, 2015 9:01:22 AM
>> Subject: [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user
>>
>> Unprivileged user open /proc/self/pagemap fail so add check for it
>>
>> Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
> 
> Pushed with more verbose commit message and small changes to style.
> 
Thank you for your help.

Cui Bixuan

> Regards,
> Jan
> 
>> ---
>>  testcases/kernel/syscalls/mmap/mmap12.c |   10 ++++++++--
>>  1 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/mmap/mmap12.c
>> b/testcases/kernel/syscalls/mmap/mmap12.c
>> index ba8c646..ebc44ae 100644
>> --- a/testcases/kernel/syscalls/mmap/mmap12.c
>> +++ b/testcases/kernel/syscalls/mmap/mmap12.c
>> @@ -108,8 +108,14 @@ static int page_check(void)
>>  	index = (vmstart / page_sz) * sizeof(uint64_t);
>>
>>  	pm = open("/proc/self/pagemap", O_RDONLY);
>> -	if (pm == -1)
>> -		tst_brkm(TFAIL | TERRNO, NULL, "Open dev pagemap failed");
>> +	if (pm == -1) {
>> +		if ((0 != geteuid()) && (errno == EPERM))
>> +			tst_brkm(TCONF | TERRNO, NULL,
>> +				"don't have permission to open dev pagemap");
>> +		else
>> +			tst_brkm(TFAIL | TERRNO, NULL,
>> +				"Open dev pagemap failed");
>> +	}
>>
>>  	offset = lseek(pm, index, SEEK_SET);
>>  	if (offset != index)
>> --
>> 1.6.0.2
>>
> 
> .
> 


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

end of thread, other threads:[~2015-11-03  8:45 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28  3:11 [LTP] [PATCH 1/11] bind/bind02: Testcase failed when no root user run it Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 2/11] capset/capset02: " Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 3/11] chroot/chroot04: " Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 4/11] execve/execve03: " Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 5/11] syscalls/fcntl: Testcases " Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 6/11] mmap/mmap12: Testcase " Cui Bixuan
2015-10-29 11:57   ` Cyril Hrubis
2015-10-30  8:56     ` Cui Bixuan
2015-10-30  9:29       ` Jan Stancek
2015-10-31  0:54         ` Cui Bixuan
2015-10-31  8:15           ` Jan Stancek
2015-11-02 11:54             ` Cyril Hrubis
2015-11-03  8:01               ` [LTP] [PATCH 6/11 v2] mmap/mmap12: Testcase failed for non-root user Cui Bixuan
2015-11-03  8:24                 ` Jan Stancek
2015-11-03  8:45                   ` Cui Bixuan
2015-10-30  9:19     ` [LTP] [PATCH 6/11] mmap/mmap12: Testcase failed when no root user run it Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 7/11] mq_open/mq_open01: " Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 8/11] ipc/msgctl: Testcases " Cui Bixuan
2015-10-28  3:11 ` [LTP] [PATCH 9/11] ipc/semctl: " Cui Bixuan
2015-10-29 12:45   ` Cyril Hrubis
2015-10-28  3:11 ` [LTP] [PATCH 10/11] ipc/shmctl: Testcase " Cui Bixuan
2015-10-28  7:12   ` Zeng Linggang
2015-10-28  7:31     ` [LTP] [PATCH 10/11 v2] " Cui Bixuan
2015-10-28  7:33     ` [LTP] [PATCH 10/11] " Cui Bixuan
2015-10-29 12:46   ` Cyril Hrubis
2015-10-28  3:11 ` [LTP] [PATCH 11/11] unshare/unshare01: " Cui Bixuan
2015-10-29 12:52   ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.