managarm / managarm

Pragmatic microkernel-based OS with fully asynchronous I/O
MIT License
1.57k stars 77 forks source link

posix-subsystem crash in KmsgFile::readSome #659

Open qookei opened 5 months ago

qookei commented 5 months ago

Running dmesg | grep -E " S" causes the following assert fail:

In function readSome, file ../../../src/managarm/posix/subsystem/src/devices/kmsg.cpp:52: Assertion 'offset_ == resp.effective_dequeue()' failed!
(gdb) f 5
#5  0x0000000000431e93 in (anonymous namespace)::KmsgFile::readSome (this=<optimized out>, data=<optimized out>, length=<optimized out>) at ../../../src/managarm/posix/subsystem/src/devices/kmsg.cpp:52
52          assert(offset_ == resp.effective_dequeue());
(gdb) p offset_
value has been optimized out
(gdb) p resp
$1 = {static message_id = 3, static head_size = 128, m_error = <optimized out>, p_error = <optimized out>, m_size = <optimized out>, p_size = <optimized out>, m_effective_dequeue = 5845760, p_effective_dequeue = <optimized out>, 
  m_new_dequeue = 5845792, p_new_dequeue = <optimized out>}
(gdb) 
qookei commented 5 months ago

Adding some debug prints reveals:

offset_ = 993272
resp.effective_dequeue() = 993320
In function readSome, file ../../../src/managarm/posix/subsystem/src/devices/kmsg.cpp:54: Assertion 'offset_ == resp.effective_dequeue()' failed!
no92 commented 2 months ago

I'm unable to reproduce this using the command above; are there other ways to cause this?