flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
AlexP 22 Jan 2008, 02:02
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 22 Jan 2008, 02:04
i think it's not problem of segmentation, it's elsewhere. can you post example code that demonstrates your problem?
|
|||
![]() |
|
matefkr 23 Jan 2008, 11:24
A little later, now i don't have the file and i can't remember the exact code.
|
|||
![]() |
|
f0dder 23 Jan 2008, 11:50
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 23 Jan 2008, 13:29
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 23 Jan 2008, 14:45
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 24 Jan 2008, 13:35
So some TYPE flags in the descriptor depends on the used segment register.
Thank you for the help! |
|||
![]() |
|
f0dder 24 Jan 2008, 15:46
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 28 Jan 2008, 07:15
k. Thanks again!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.