17 Commits
Author SHA1 Message Date
Xin ZhongandgVisor bot 2ae334d8a1 Fix TSAN flakes and data races in msgqueue syscall tests
In test/syscalls/linux/msgqueue.cc:
- Fixed a TSAN data race in MsgSndRmWhileBlocking and MsgRcvRmWhileBlocking by
passing the message queue ID by-value into background threads instead of
evaluating queue.get() on the raw shared pointer.
- Fixed a multi-run global state bleed in MsgCtlMsgInfo by checking global
msgpool queue offsets relative to their existing background state rather than
hardcoding strict zeros.

PiperOrigin-RevId: 955474605
2026-07-28 14:33:15 -07:00
Jamie LiuandgVisor bot 255e4bf6b0 msgqueue: various fixes
- Fix msgrcv(MSG_COPY) ignoring maxSize, by merging Queue.Copy() into
  Queue.Receive().

- Fix msgrcv(MSG_NOERROR) of truncated messages overwriting the first byte
  after the end of the received message.

- Fix msgrcv(MSG_NOERROR) of truncated messages incorrectly updating
  Queue.byteCount.

- Remove Message.Size, which is completely redundant with len(Message.Text).

- Remove msgqueue.Blocker, which is redundant with context.Blocker and
  context.Context after cl/415189675.

PiperOrigin-RevId: 853322832
2026-01-07 10:40:09 -08:00
Jamie LiuandgVisor bot d523d841e4 msgqueue: check permissions in Queue.Copy()
PiperOrigin-RevId: 852992055
2026-01-06 17:09:13 -08:00
Ayush RanjanandgVisor bot d4662051ad 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 VoznikaandgVisor bot 9e664e0261 Fix uninitialized messages in MsgqueueTest
PiperOrigin-RevId: 392760305
2021-08-24 15:26:29 -07:00
gVisor bot d3db71d3b1 Merge pull request #6262 from sudo-sturbia:msgqueue/syscalls3
PiperOrigin-RevId: 391416650
2021-08-17 17:44:26 -07:00
Zyad A. Ali 4ba2317532 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 85daf7c339 Add tests for msgctl(2).
Updates #135
2021-08-17 20:31:32 +02:00
Rahat MahmoodandgVisor bot f41c7e8118 Wrap test queues in Queue object on creation.
PiperOrigin-RevId: 390245901
2021-08-11 16:35:52 -07:00
Rahat MahmoodandgVisor bot 027fe3c892 Correctly handle interruptions in blocking msgqueue syscalls.
Reported-by: [email protected]
Reported-by: [email protected]
PiperOrigin-RevId: 389084629
2021-08-05 20:16:54 -07:00
Rahat MahmoodandgVisor bot 012d8e5954 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 f517422db2 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 5eb71ba8ed 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 acf6ce4643 Add blocking and general tests for msgsnd(2) and msgrcv(2).
Updates #135
2021-08-03 18:13:24 +02:00
Zyad A. Ali e61bd37a82 Add non-blocking tests for msgsnd(2) and msgrcv(2).
Updates #135
2021-08-03 18:13:24 +02:00
Zyad A. Ali 0683ff858f 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 ffcb29b29c Add initial test cases for msgget(2).
Updates #135
2021-07-13 22:12:02 +02:00