Skip to contentSkip to conversation

needs_root: Add setting of needs_root

PATCH zhaogongyi via ltp 2 participants 2 messages Oct 13, 2022

lore
Share & tools
lore
#0 lore raw

Hi Petr,

It is failed on my system:

sh-4.4$ ./msgget03
tst_test.c:1535: TINFO: Timeout per run is 0h 00m 30s
msgget03.c:42: TINFO: Current environment 0 message queues are already in use msgget03.c:45: TBROK: Failed to open FILE '/proc/sys/kernel/msgmni' for writing: EACCES (13)

Summary:

passed   0
failed   0
broken   1
skipped  0

warnings 0
tst_sys_conf.c:118: TWARN: Failed to open FILE '/proc/sys/kernel/msgmni'

Quoted 53 lines
Quoted 2 lines

Add setting of needs_root, otherwise run the test without root will fail and report EACCESS or EPERM.

...

Quoted 2 lines
 testcases/kernel/syscalls/bind/bind06.c                       | 1 +
 testcases/kernel/syscalls/cma/process_vm_readv02.c            | 1

+

Quoted 1 line
 testcases/kernel/syscalls/cma/process_vm_readv03.c            | 1

+

Quoted 1 line
 testcases/kernel/syscalls/cma/process_vm_writev02.c           | 1

+

Quoted 11 lines
 testcases/kernel/syscalls/copy_file_range/copy_file_range01.c | 1 +
 testcases/kernel/syscalls/ipc/msgget/msgget03.c               | 1 +
 testcases/kernel/syscalls/preadv/preadv03.c                   | 1 +
 testcases/kernel/syscalls/pwritev/pwritev03.c                 | 1 +
 testcases/kernel/syscalls/sendto/sendto03.c                   | 1 +
 testcases/kernel/syscalls/setsockopt/setsockopt05.c           | 1 +
 testcases/kernel/syscalls/setsockopt/setsockopt06.c           | 1 +
 testcases/kernel/syscalls/setsockopt/setsockopt07.c           | 1 +
 testcases/kernel/syscalls/setsockopt/setsockopt08.c           | 1 +
 testcases/kernel/syscalls/setsockopt/setsockopt09.c           | 1 +
 testcases/kernel/syscalls/swapon/swapon01.c                   | 1

+

Quoted 1 line
 15 files changed, 15 insertions(+)

...

Review static void cleanup(void) · line 78

Quoted 9 lines

+++ b/testcases/kernel/syscalls/ipc/msgget/msgget03.c

(quoted diff) +1 -0
@@ -72,6 +72,7 @@ static void cleanup(void)
 
 static struct tst_test test = {
 	.needs_tmpdir = 1,
+	.needs_root = 1,
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_msgget,

At least this one is working without root:

$ ./testcases/kernel/syscalls/ipc/msgget/msgget03
tst_test.c:1526: TINFO: Timeout per run is 0h 00m 30s
msgget03.c:41: TINFO: Current environment 0 message queues are
already in use
msgget03.c:55: TINFO: The maximum number of message queues (32000)
reached
msgget03.c:30: TPASS: msgget(1629588886, 1536) : ENOSPC (28)

Summary:

passed   1
failed   0
broken   0
skipped  0

warnings 0

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw
Quoted 8 lines

Hi Petr,

It is failed on my system:

sh-4.4$ ./msgget03
tst_test.c:1535: TINFO: Timeout per run is 0h 00m 30s
msgget03.c:42: TINFO: Current environment 0 message queues are already in use msgget03.c:45: TBROK: Failed to open FILE '/proc/sys/kernel/msgmni' for writing: EACCES (13)

Ah, b740bfac5 ("msgget03: Set custom queue limit") causes the need for root. IMHO this one is valid.

I'd suggest to remove needs_root for needs_device and mount_device now (i.e. send v2).

nit: FYI most of the people use bottom posting on mailing lists, you use top posting. Combine both makes it hard to follow.

https://en.wikipedia.org/wiki/Posting_style

Kind regards,
Petr

Quoted 7 lines

Summary:

passed   0
failed   0
broken   1
skipped  0

warnings 0
tst_sys_conf.c:118: TWARN: Failed to open FILE '/proc/sys/kernel/msgmni'

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp