flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
AlexP
Don't know much about what you're trying to say, I know some interpreted languages allow modifications of their own code, maybe you should check out MSDN, or even better the most recent PE spec's probably has something in there about weird section things like that.
|
|||
![]() |
|
vid
i think it's not problem of segmentation, it's elsewhere. can you post example code that demonstrates your problem?
|
|||
![]() |
|
matefkr
A little later, now i don't have the file and i can't remember the exact code.
|
|||
![]() |
|
f0dder
Protection is done per-page, not through the use of selectors (both code and data are base=0 limit=4g on 32bit windows). So as long as you set the PE section permissions, the windows loader will set the per-page permissions, and you're good to go.
I wouldn't mix "Initialized" and "Uninitialized" though, and why are you adding "Shared"? What you want is Read/Write/Execute/Initialized, nothing more, nothing less. |
|||
![]() |
|
matefkr
It pretty much explains, why could i reach the code segment through ds, but what about rewriteable,and executable code? I could rewrite bytes in the code segment. Also i don't know much about pageing. Is there something in pageing which removes write protection?
|
|||
![]() |
|
f0dder
FLAT address space (is, base=0, limit=4gb for code,data,stack descriptors) is why you can "get to code through DS" (which is the default, by the way). Try adding a CS: segment/selector override, and you'll get a protection violation even though the pages are writable.
Paging offers per-page (duh ![]() The Windows PE loader sets per-page permissions according to the PE section flags you specify with fasm or link.exe or a hexeditor or whatever you used. |
|||
![]() |
|
matefkr
So some TYPE flags in the descriptor depends on the used segment register.
Thank you for the help! |
|||
![]() |
|
f0dder
s/segment register/selector.
You can never write to anything with a CS: override, with other selectors it depends on privilige level and paging too, if paging is enabled. |
|||
![]() |
|
matefkr
k. Thanks again!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.