Bug #110
x86_64 port - init_stage2 in init module breakpoints at random
| Status: | Assigned | Start: | 05/03/2010 | ||
|---|---|---|---|---|---|
| Priority: | Normal | Due date: | |||
| Assigned to: | % Done: | 50% |
|||
| Category: | Kernel | Spent time: | 8.00 hours | ||
| Target version: | Foster Post-Release Milestone #1 |
Description
The init_stage2 function in the init module throws a breakpoint at a seemingly random time. This could be during a VFS lookup but has also happened before any VFS calls are made. It seems to have something to do with the Thread/Process mix, as the same code outside of the init_stage2 function (ie, in the actual module entrypoint function) works fine.
Associated revisions
Revision fcdaf0510606d91b4d1a02b2d202522f24f50062
x64: everything builds again. Runs until loading/running the TUI, at which point it hits the behaviour in issue #110.
Revision a33b9344fa286b12afb33d69c2ccca56f8757ec5
x64: everything builds again. Runs until loading/running the TUI, at which point it hits the behaviour in issue #110.
History
Updated by Matthew Iselin about 1 year ago
- Category set to Kernel
- Target version set to Foster Post-Release Milestone #1
- % Done changed from 0 to 40
The x86_64 port now #PFs somewhere within either the TUI application, the dynamic linker, or a usermode stub within the kernel. Still debugging.
Updated by Matthew Iselin about 1 year ago
- % Done changed from 40 to 50
#PF is now mostly reproduced.
The following code, at the start of the TUI main() function, works:
void posix_syscall1(long func, long p1)
{
long eax = ((1&0xFFFF) << 16) | (func&0xFFFF);
long ret;
asm volatile("syscall" : "=a" (ret), "=b" (errno) : "0" (eax), "1" (p1) : "rcx");
}
int main (int argc, char **argv)
{
posix_syscall1(4321, 0xdeadbeef);
....
However, the following page faults:
int main (int argc, char **argv)
{
__pedigree_test_posix_syscalls();
....
__pedigree_test_posix_syscalls is defined in libc.so.
The log file for both is as follows:
(NN) Syscall: at start, will be returning to 0x804fe58. (NN) POSIX: returning to 0x804fe58. (NN) POSIX: [0x2] : 4321 (EE) PosixSyscallManager: invalid syscall received: 4321 (NN) Syscall: at end, returning to 0x804fe58. (NN) Syscall: at start, will be returning to 0x4000201c. (NN) Syscall: at end, returning to 0x4000201c. (NN) Syscall: at start, will be returning to 0x600676. (NN) POSIX: returning to 0x600676. (NN) POSIX: [0x2] : 1234 (EE) PosixSyscallManager: invalid syscall received: 1234 (NN) Syscall: at end, returning to 0x600676. (EE) Page Fault Exception at 0x00005678, error code 0x00000006 (EE) Details: NOT PRESENT | WRITE | USER MODE |
As can be seen, the libc-based system call fails. The code directly after this test is a while loop. Seems like a dynamic linker issue to me.
Updated by Matthew Iselin about 1 year ago
Turns out that #PF was due to an register not being added to the clobber list. New #PF somewhere in libc (inside _svfprintf_r), but I'm not convinced it's a libc issue.