14 Commits

Author SHA1 Message Date
Ayush Ranjan 2df29e11dd Deflake MsgqueueTest.MsgCtlIpcStat test.
This test flakes with <1% rate. There is a relevant comment
explaining that "timestamps only have a resolution of seconds"
and so we need to sleep for a second to actually see the timestamps
change. However, currently the tests sleeps *before* calculating
local time. Which beats the point. Move the local time declaration
before the sleep.

absl::ToTimeT() rounds down to the nearest second, discarding
nanoseconds field completely. I think the host kernel might be
rounding up the `msqid_ds` time fields.

Tested: 1000 runs of this test pass natively.
PiperOrigin-RevId: 455187650
2022-06-15 12:05:41 -07:00
Fabricio Voznika 19051dd26f Fix uninitialized messages in MsgqueueTest
PiperOrigin-RevId: 392760305
2021-08-24 15:26:29 -07:00
gVisor bot b495ae599a Merge pull request #6262 from sudo-sturbia:msgqueue/syscalls3
PiperOrigin-RevId: 391416650
2021-08-17 17:44:26 -07:00
Zyad A. Ali 2f1c65e7fa Implement stub for msgctl(2).
Add support for msgctl and enable tests.

Fixes #135
2021-08-17 20:34:51 +02:00
Zyad A. Ali 122fd928f9 Add tests for msgctl(2).
Updates #135
2021-08-17 20:31:32 +02:00
Rahat Mahmood 8d84c5a8ee Wrap test queues in Queue object on creation.
PiperOrigin-RevId: 390245901
2021-08-11 16:35:52 -07:00
Rahat Mahmood 569f605f43 Correctly handle interruptions in blocking msgqueue syscalls.
Reported-by: syzbot+63bde04529f701c76168@syzkaller.appspotmail.com
Reported-by: syzbot+69866b9a16ec29993e6a@syzkaller.appspotmail.com
PiperOrigin-RevId: 389084629
2021-08-05 20:16:54 -07:00
Rahat Mahmood 15853bdc88 Replace unsafe use of fork() in msgqueue tests.
Msgqueue tests were using fork() to run create a separate thread of
execution for passing messages back and forth over a queue. However,
the child process after a fork() may only use async-signal-safe
functions, which at a minimum exclude gtest asserts.

Instead, use threads.

PiperOrigin-RevId: 389073744
2021-08-05 18:47:30 -07:00
Zyad A. Ali 6ef2f177fb Implement MSG_COPY option for msgrcv(2).
Implement Queue.Copy and add more tests for it.

Updates #135
2021-08-03 18:13:24 +02:00
Zyad A. Ali eb638ee583 Implement stubs for msgsnd(2) and msgrcv(2).
Add support for msgsnd and msgrcv and enable syscall tests.

Updates #135
2021-08-03 18:13:24 +02:00
Zyad A. Ali 61bb9b254e Add blocking and general tests for msgsnd(2) and msgrcv(2).
Updates #135
2021-08-03 18:13:24 +02:00
Zyad A. Ali addbf18979 Add non-blocking tests for msgsnd(2) and msgrcv(2).
Updates #135
2021-08-03 18:13:24 +02:00
Zyad A. Ali 4a874557f5 Implement stubs for msgget(2) and msgctl(IPC_RMID).
Add support for msgget, and msgctl(IPC_RMID), and enable msgqueue
syscall tests.

Updates #135
2021-07-13 22:12:02 +02:00
Zyad A. Ali c8851be593 Add initial test cases for msgget(2).
Updates #135
2021-07-13 22:12:02 +02:00