Memory Protection Wierdness

Robert Lunnon bob at yarrabee.net.au
Fri Jun 27 18:22:37 CDT 2003


I am playing with Worms II and the installer that comes with the Demo and uncovered a signal handling fault Under Solaris and some wierdness in the installer.

After decompressing the application the installer executes the setup program which displays a splash screen the application then generates a Page Fault Exception. I can't give a stack trace because here is where the wierdness is. The Setup Program seems to not inherit the -debugmsg status and doesn't end up under control of the debugger (By this time there are 5 wine processes running)

Anyway to cut a long story short the page fault DOES occur in a mapped region (Its in VIRTUAL_DumpViews() listing) but doesn't have a handler associated with it. This makes VirtualHandleFault fall through to the following code

          BYTE vprot = view->prot[((char *)addr - (char *)view->base) >> page_shift];
            void *page = (void *)((UINT_PTR)addr & ~page_mask);
            char *stack = (char *)NtCurrentTeb()->stack_base + SIGNAL_STACK_SIZE + page_mask + 1;
            if (vprot & VPROT_GUARD)
            {
                VIRTUAL_SetProt( view, page, page_mask + 1, vprot & ~VPROT_GUARD );
                ret = STATUS_GUARD_PAGE_VIOLATION;
            }
            /* is it inside the stack guard pages? */
            if (((char *)addr >= stack) && ((char *)addr < stack + 2*(page_mask+1)))
                ret = STATUS_STACK_OVERFLOW;

But of course this code doesn't reset the page protections to allow the access.

I Doctored this code so it would always allow the access and the installer then completed OK, But worms itself will not run yet

Q. Should all views have handlers ?  Under What Conditions would they not ???




More information about the wine-devel mailing list