[PATCH] ntdll: set correct protection flags on sections in builtin DLLs

Marcus Meissner marcus at jet.franken.de
Mon Aug 23 09:19:27 CDT 2010


On Mon, Aug 23, 2010 at 03:43:35PM +0200, Alexandre Julliard wrote:
> Marcus Meissner <marcus at jet.franken.de> writes:
> 
> > @@ -1406,7 +1409,18 @@ static void load_builtin_callback( void *module, const char *filename )
> >      }
> >      virtual_create_system_view( module, nt->OptionalHeader.SizeOfImage,
> >                                  VPROT_SYSTEM | VPROT_IMAGE | VPROT_COMMITTED |
> > -                                VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC );
> > +                                VPROT_READ | VPROT_WRITECOPY | VPROT_EXEC, &view );
> > +
> > +    sec = (IMAGE_SECTION_HEADER*)((char*)&nt->OptionalHeader+nt->FileHeader.SizeOfOptionalHeader);
> > +    for (i=0;i<nt->FileHeader.NumberOfSections;i++) {
> > +        DWORD flags = VPROT_SYSTEM | VPROT_IMAGE | VPROT_COMMITTED;
> > +
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_EXECUTE) flags |= VPROT_EXEC;
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_READ) flags |= VPROT_READ;
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_WRITE) flags |= VPROT_WRITE;
> > +        if (sec[i].Characteristics & IMAGE_SCN_MEM_SHARED) flags |= VPROT_WRITECOPY;
> > +        VIRTUAL_SetProt( view, (char*)module + sec[i].VirtualAddress, sec[i].Misc.VirtualSize, flags );
> 
> I don't think you want to actually change the permissions, our headers
> don't necessarily match the real ELF sections.

So a call to change the protection without calling mprotect() in the end?
like VIRTUAL_SetProtData() or something?

> (BTW, could you please convince your mailer to set a valid Message-Id?)

I am bouncing them from the "git format-patch origin" created files currently.

Ciao, Macus



More information about the wine-devel mailing list