You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void setup(void)
{
euid = geteuid();
pw = SAFE_GETPWNAM("nobody");
}
static void do_test(unsigned int i)
{
struct test_case *tc = &tcase[i];
mqd_t fd;
tst_res(TINFO, "queue name %s", tc->qname);
/*
* When test ended with SIGTERM etc, mq descriptor is left remains.
* So we delete it first.
*/
mq_unlink(QUEUE_NAME);
/* prepare */
fd = SAFE_MQ_OPEN(QUEUE_NAME, O_CREAT | O_EXCL | O_RDWR, S_IRWXU, NULL);
if (tc->as_nobody && seteuid(pw->pw_uid)) {
tst_res(TFAIL | TERRNO, "seteuid failed");
goto EXIT;
}
seteuid(pw->pw_uid) is supposed to change the owner to "nobody", but still "root" is executing as owner and as a result testcase is failing.
Below is the snapshot of execution record:
tst.c:1558: TINFO: Timeout per run is 0h 20m 00s
mq_unlink01.c:76: TINFO: queue name /test_mqueue
mq_unlink01.c:99: TPASS: mq_unlink returned 0: SUCCESS (0)
mq_unlink01.c:76: TINFO: queue name /test_mqueue
mq_unlink01.c:95: TFAIL: mq_unlink returned 0, expected -1, expected errno EACCES (13): SUCCESS (0)
mq_unlink01.c:76: TINFO: queue name /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
mq_unlink01.c:99: TPASS: mq_unlink returned -1: ENOENT (2)
mq_unlink01.c:76: TINFO: queue name /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
mq_unlink01.c:99: TPASS: mq_unlink returned -1: ENAMETOOLONG (36)
Summary:
passed 3
failed 1
broken 0
skipped 0
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=1 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: ltp-pan reported some tests FAIL
LTP Version: 20230127
Please suggest the solution
The text was updated successfully, but these errors were encountered:
I can't reproduce the problem on my Tumbleweed system.
seteuid(pw->pw_uid) is supposed to change the owner to "nobody"
This call is supposed to change the effective user to "nobody". This should provoke an access error when trying to unlink the message queue that is still owned by root (although maybe the permissions/ownership of the parent directory might be relevant as well).
In testcase 1:
seteuid(pw->pw_uid) is supposed to change the owner to "nobody", but still "root" is executing as owner and as a result testcase is failing.
Below is the snapshot of execution record:
tst.c:1558: TINFO: Timeout per run is 0h 20m 00s
mq_unlink01.c:76: TINFO: queue name /test_mqueue
mq_unlink01.c:99: TPASS: mq_unlink returned 0: SUCCESS (0)
mq_unlink01.c:76: TINFO: queue name /test_mqueue
mq_unlink01.c:95: TFAIL: mq_unlink returned 0, expected -1, expected errno EACCES (13): SUCCESS (0)
mq_unlink01.c:76: TINFO: queue name /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
mq_unlink01.c:99: TPASS: mq_unlink returned -1: ENOENT (2)
mq_unlink01.c:76: TINFO: queue name /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
mq_unlink01.c:99: TPASS: mq_unlink returned -1: ENAMETOOLONG (36)
Summary:
passed 3
failed 1
broken 0
skipped 0
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=1 corefile=no
cutime=0 cstime=0
<<<test_end>>>
INFO: ltp-pan reported some tests FAIL
LTP Version: 20230127
Please suggest the solution
The text was updated successfully, but these errors were encountered: