Heap allocation doesn't properly detect out of memory error
robert-w-gries opened this issue · comments
This problem comes up while testing scheduling.
On x86_64
, we can create around 50 processes. If we then start a process cycle where each process creates the other, we hit a page fault and sometimes a double fault.
Error code: (empty)
ExceptionStack {
instruction_pointer: 0x1116b6,
code_segment: 0x8,
cpu_flags: 0x6,
stack_pointer: 0x40017940,
stack_segment: 0x10
}
InterruptDescription {
vector: 14,
mnemonic: "#PF",
description: "Page Fault",
irqtype: "Fault",
source: "Any memory reference."
}
Page fault while accessing 0x3fffffff
The instruction pointer points to a BTreeMap related function:
000000000013f130 <_ZN219_$LT$alloc..btree..node..Handle$LT$alloc..btree..node..NodeRef$LT$alloc..btree..node..marker..Mut$LT$$u27$a$GT$$C$$u20$K$C$$u20$V$C$$u20$alloc..btree..node..marker..Leaf$GT$$C$$u20$alloc..btree..node..marker..KV$GT$$GT$5split17h962bd6a453e19508E>:
13f130: 55 push %rbp
13f131: 48 89 e5 mov %rsp,%rbp
13f134: 48 81 ec a0 0f 00 00 sub $0xfa0,%rsp
13f13b: 48 89 f8 mov %rdi,%rax
13f13e: 48 8d 8d 60 f1 ff ff lea -0xea0(%rbp),%rcx
13f145: c6 85 56 f9 ff ff 00 movb $0x0,-0x6aa(%rbp)
13f14c: c6 85 55 f9 ff ff 00 movb $0x0,-0x6ab(%rbp)
13f153: c6 85 57 f9 ff ff 00 movb $0x0,-0x6a9(%rbp)
13f15a: c6 85 54 f9 ff ff 00 movb $0x0,-0x6ac(%rbp)
13f161: c6 85 53 f9 ff ff 00 movb $0x0,-0x6ad(%rbp)
13f168: 48 89 bd 50 f1 ff ff mov %rdi,-0xeb0(%rbp)
13f16f: 48 89 cf mov %rcx,%rdi
13f172: 48 89 85 48 f1 ff ff mov %rax,-0xeb8(%rbp)
13f179: 48 89 b5 40 f1 ff ff mov %rsi,-0xec0(%rbp)
13f180: e8 1b 25 00 00 callq 1416a0 <_ZN55_$LT$alloc..btree..node..LeafNode$LT$K$C$$u20$V$GT$$GT$3new17h54747f5e44c2a0b4E>
13f185: eb 0e jmp 13f195 <_ZN219_$LT$alloc..btree..node..Handle$LT$alloc..btree..node..NodeRef$LT$alloc..btree..node..marker..Mut$LT$$u27$a$GT$$C$$u20$K$C$$u20$V$C$$u20$alloc..btree..node..marker..Leaf$GT$$C$$u20$alloc..btree..node..marker..KV$GT$$GT$5split17h962bd6a453e19508E+0x65>