Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining a large global vector of strings results in page fault #4

Open
razvand opened this issue Apr 5, 2021 · 0 comments
Open

Defining a large global vector of strings results in page fault #4

razvand opened this issue Apr 5, 2021 · 0 comments

Comments

@razvand
Copy link

razvand commented Apr 5, 2021

This is the program highlighting the issue. For 2726 items in the CXX_VALUES vector, it causes a page fault. For 2725 items (one less) there is no page fault. This is happening both on the kvm and on the linuxu platforms.

A stack trace of the issue points to:

(gdb) bt
#0  std::__1::ios_base::Init::Init (this=<optimized out>) at /home/razvan/projects/unicore/unikraft-my/apps/t/build/libcxx/origin/libcxx-7.0.0.src/src/iostream.cpp:85
#1  0x0000000000204fae in __static_initialization_and_destruction_0 (__priority=65535, __initialize_p=1) at /home/razvan/projects/unicore/unikraft-my/apps/t/build/libcxx/origin/libcxx-7
.0.0.src/src/iostream.cpp:80
#2  _GLOBAL__sub_I__ZNSt3__13cinE () at /home/razvan/projects/unicore/unikraft-my/apps/t/build/libcxx/origin/libcxx-7.0.0.src/src/iostream.cpp:124
#3  0x000000000010c0b2 in main_thread_func (arg=0x3fdff50) at /home/razvan/projects/unicore/unikraft-my/unikraft.git/lib/ukboot/boot.c:135
#4  0x0000000000105757 in asm_thread_starter () at /home/razvan/projects/unicore/unikraft-my/unikraft.git/plat/common/x86/thread_start.S:39
#5  0x0000000000000000 in ?? ()

The highlighted instruction (=>) is the one where the issue occurs.

(gdb) disass
Dump of assembler code for function std::__1::ios_base::Init::Init():
   0x0000000000141e10 <+0>:     push   %rbp
   0x0000000000141e11 <+1>:     mov    %rsp,%rbp
   0x0000000000141e14 <+4>:     push   %rbx
   0x0000000000141e15 <+5>:     sub    $0x18,%rsp
   0x0000000000141e19 <+9>:     callq  0x110ec0 <__getreent>
   0x0000000000141e1e <+14>:    mov    $0x29a3a0,%edi
=> 0x0000000000141e23 <+19>:    mov    0x8(%rax),%rbx
   0x0000000000141e27 <+23>:    callq  0x213640 <std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()>
   0x0000000000141e2c <+28>:    lea    -0x18(%rbp),%rdi

It seems to point to a C++ initialization issue in Unikraft, before the calling of the main() function.
It's possible to be related to memory alocation / initialization in the Unikraft startup sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant