-
Notifications
You must be signed in to change notification settings - Fork 5
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
Try to get Git to run on Ward #39
Comments
Unsurprisingly, statically-linked Git compiled with glibc on the host crashes while trying to access the auxiliary vectors during process startup, in this code from csu/libc-start.c:154...168:
My next step will be to see if we can stub out the auxiliary vectors and make this not crash. |
Added null auxiliary vectors (1e1968a), and got this:
The pagefault is in __brk:
And the syscalls that failed to be run were, in order:
So it seems likely that the missing brk syscall is the source of the problem: We do actually implement the
So I'll look into whether we can do the same thing and implement sbrk as a library function over a brk syscall, or just add a second syscall. |
brk support in 97ba5e6 gives us:
Better. Looks like the new crash is in __libc_setup_tls, so I'll look into that later. |
It might be worth using the table from tools/syscall.py to print the missing syscalls by name instead of number. That script already generates an array of names for the implemented Ward syscalls, so it shouldn't be a big change |
syscalls named in 856ed6b:
Fault seems to occur in __libc_setup_tls:
The instruction that stores l_tls_offset faults:
This is because _dl_main_map is mapped as read-only, so __libc_setup_tls's attempt to modify it fails. I'm not yet sure why this is mapped as read-only, because it's not mapped as read-only when this runs under linux. It's stored in the .data section, which is marked writable and loaded via a program header mapped RW. So perhaps we have broken ELF-loading code? EDIT: ELF-loading code looks okay; need to check whether page tables are correct at _start, and if so, where it gets changed. |
Something deeper is going on here with the page-mapping troubles: (log edited to remove irrelevant debug messages for clarity)
Notably, no matter how weird glibc handles itself, git's execution should not result in EDIT:
[note: sv6 hung there at the end] In other words: oh no how is it possible that the git binary suddenly stops having the right magic number. List of strange behaviors so far:
EDIT 2: looks like the ELF header as stored in mfs was getting randomly zeroed; I found the following traceback of the memset call responsible:
It looks to me like the page is somehow getting double-freed. Which is pretty bad. EDIT 3: Yes, absolutely getting double-freed, but the tracebacks are incomplete and I don't quite understand the code well enough to figure out what's going on:
Notably, the destroy() invocations are on line 140, which means they are following the is_unique()-gated code path; which raises the question -- why are there two unique references to the same page? |
For the sake of being an appropriate macrobenchmark.
The text was updated successfully, but these errors were encountered: