Opened 5 hours ago

Last modified 4 hours ago

#19441 new bug

mmap read or write deadlock

Reported by: korli Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Kernel Version: R1/beta5
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by korli)

Test MMapFileTest.SelfRead or MMapFileTest.SelfWrite from https://dev.haiku-os.org/ticket/19438

https://github.com/google/gvisor/blob/master/test/syscalls/linux/mmap.cc#L1683

kdebug> bt 451
stack trace for thread 451 "mmap_test"
    kernel stack: 0xffffffff81f07000 to 0xffffffff81f0c000
      user stack: 0x00007fb0a24f9000 to 0x00007fb0a34f9000
frame                       caller             <image>:function + offset
 0 ffffffff81f0b4d0 (+ 160) ffffffff800a631e   <kernel_x86_64> reschedule(int) + 0x6ae
 1 ffffffff81f0b500 (+  48) ffffffff8008fc36   <kernel_x86_64> thread_block + 0xc6
 2 ffffffff81f0b550 (+  80) ffffffff801563c9   <kernel_x86_64> VMCache::WaitForPageEvents(vm_page*, unsigned int, bool) + 0x79
 3 ffffffff81f0b6b0 (+ 352) ffffffff80136d8b   <kernel_x86_64> vm_soft_fault(VMAddressSpace*, unsigned long, bool, bool, bool, vm_page**) + 0x11fb
 4 ffffffff81f0b7b0 (+ 256) ffffffff80143021   <kernel_x86_64> vm_page_fault + 0x181
 5 ffffffff81f0b7f0 (+  64) ffffffff801699be   <kernel_x86_64> x86_page_fault_exception + 0x18e
 6 ffffffff81f0bb48 (+ 856) ffffffff8015ecfc   <kernel_x86_64> int_bottom + 0x80
kernel iframe at 0xffffffff81f0bb48 (end = 0xffffffff81f0bc10)
 rax 0x0                   rbx 0x800                 rcx 0x800
 rdx 0x800                 rsi 0xffffff002a36d000    rdi 0xe557198000
 rbp 0xffffffff81f0bc40     r8 0xffffff002a26d000     r9 0xffffffff801768d0
 r10 0xe557198000          r11 0x7d                  r12 0xffffff002a36d000
 r13 0xe557198000          r14 0x800                 r15 0x0
 rip 0xffffffff80183876    rsp 0xffffffff81f0bc10 rflags 0x50212
 vector: 0xe, error code: 0x2
 7 ffffffff81f0bc40 (+ 248) ffffffff80183876   <kernel_x86_64> memcpy + 0x26
 8 ffffffff81f0bcc0 (+ 128) ffffffff80134264   <kernel_x86_64> _ZN12_GLOBAL(???, user_access, ???, arch_cpu_user_memcpy, ???, ???, ???, ???, ???, ???, ???, ???) + 0xc4
 9 ffffffff81f0bd10 (+  80) ffffffff801396a9   <kernel_x86_64> user_memcpy + 0x89
10 ffffffff81f0be70 (+ 352) ffffffff81121f2e   </boot/system/add-ons/kernel/file_systems/ramfs> DataContainer::_DoCacheIO[clone .localalias] (long, unsigned char*, long, unsigned long*, bool) + 0x29e
11 ffffffff81f0bec0 (+  80) ffffffff8112646c   </boot/system/add-ons/kernel/file_systems/ramfs> ramfs_read(fs_volume*, fs_vnode*, void*, long, void*, unsigned long*) + 0x9c
12 ffffffff81f0bf20 (+  96) ffffffff800f8433   <kernel_x86_64> common_user_io(int, long, void*, unsigned long, bool) + 0x1d3
13 ffffffff81f0bf30 (+  16) ffffffff8015efff   <kernel_x86_64> x86_64_syscall_entry + 0xfb
user iframe at 0xffffffff81f0bf30 (end = 0xffffffff81f0bff8)
 rax 0x94                  rbx 0x1                   rcx 0x11187d5e20c
 rdx 0xe557198000          rsi 0xffffffffffffffff    rdi 0x4
 rbp 0x7fb0a34f87e0         r8 0xff                   r9 0x0
 r10 0x800                 r11 0x202                 r12 0xe44ac56a20
 r13 0x113dcc38ade         r14 0x0                   r15 0x113dcbff1f0
 rip 0x11187d5e20c         rsp 0x7fb0a34f87c8     rflags 0x202
 vector: 0x63, error code: 0x0
14 00007fb0a34f87e0 (+   0) 0000011187d5e20c   </boot/system/lib/libroot.so> _kern_read + 0x0c
15 00007fb0a34f8820 (+  64) 000001981c835af6   </boot/home/mmap_test> _start (nearest) + 0x9e36
16 00007fb0a34f88b0 (+ 144) 000001981c847233   </boot/home/mmap_test> _start (nearest) + 0x1b573
17 00007fb0a34f88f0 (+  64) 00000113dcc35d91   </boot/system/lib/libgtest.so.1.> testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 0x41
18 00007fb0a34f8920 (+  48) 00000113dcc23046   </boot/system/lib/libgtest.so.1.> testing::Test::Run() + 0xe6
19 00007fb0a34f8970 (+  80) 00000113dcc231f5   </boot/system/lib/libgtest.so.1.> testing::TestInfo::Run() + 0x185
20 00007fb0a34f89e0 (+ 112) 00000113dcc23437   </boot/system/lib/libgtest.so.1.> testing::TestSuite::Run() + 0x217
21 00007fb0a34f8aa0 (+ 192) 00000113dcc2e50c   </boot/system/lib/libgtest.so.1.> testing::internal::UnitTestImpl::RunAllTests() + 0x34c
22 00007fb0a34f8b10 (+ 112) 00000113dcc23640   </boot/system/lib/libgtest.so.1.> testing::UnitTest::Run() + 0x80
23 00007fb0a34f8b20 (+  16) 000001981c88e697   </boot/home/mmap_test> RUN_ALL_TESTS() + 0x11
24 00007fb0a34f8b40 (+  32) 000001981c88e67e   </boot/home/mmap_test> gvisor::testing::RunAllTests() + 0x22
25 00007fb0a34f8b60 (+  32) 000001981c88e588   </boot/home/mmap_test> main + 0x27
26 00007fb0a34f8b90 (+  48) 000001981c82bcfe   </boot/home/mmap_test> _start + 0x3e
27 00007fb0a34f8bc0 (+  48) 000001e0e346edd5   </boot/system/runtime_loader> runtime_loader + 0x115
28 0000000000000000 (+   0) 00007f7f5c2b0258   <commpage> commpage_thread_exit + 0x00

Change History (2)

comment:1 by korli, 5 hours ago

Description: modified (diff)

comment:2 by korli, 4 hours ago

kdebug> cache -p 0xffffffff9fe981f0
CACHE 0xffffffff9fe981f0:
  ref_count:    3
  source:       0x0000000000000000
  type:         RAM
  virtual_base: 0x0
  virtual_end:  0x800
  temporary:    1
  lock:         0xffffffff9fe98278
  lock.holder:  -1
  areas:
    area 0x2534, mmap_test mmap area
	base_addr:  0x91bd06b000, size: 0x1000
	protection: 0x2033
	owner:      0xeb
  consumers:
  pages:
	0xffffffff833bbac0 ppn 0x259bc offset 0x0 state 6 (wired) wired_count 0
kdebug> page 0xffffffff833bbac0
PAGE: 0xffffffff833bbac0
queue_next,prev: 0x0000000000000000, 0x0000000000000000
physical_number: 0x259bc
cache:           0xffffffff9fe981f0
cache_offset:    0
cache_next:      0x0000000000000000
state:           wired
wired_count:     0
usage_count:     0
busy:            1
busy_writing:    0
accessed:        0
modified:        1
accessor:        -1
area mappings:

Note: See TracTickets for help on using tickets.