flat assembler
Message board for the users of flat assembler.
Index
> Windows > How to write-protect memory regions? |
Author |
|
f0dder 28 Feb 2005, 20:33
Hmmm... I guess the best solution would be read-only pages (iirc guard pages are NT-only), then write a SEH that traps GPF's, and checks whether the range is "protected", looks at the opcode that caused the GPF, etc... would probably be some good hours of work
|
|||
28 Feb 2005, 20:33 |
|
vid 01 Mar 2005, 13:20
how does it looks with using debugging register in ring3 under windoze? Maybe they could be used for such purpose...
|
|||
01 Mar 2005, 13:20 |
|
ronware 01 Mar 2005, 16:11
vid wrote: how does it looks with using debugging register in ring3 under windoze? Maybe they could be used for such purpose... That's apparently the only way, but I don't think you can write the debug registers in ring3 at all. What I'm doing is using 'canary' values and checking them in an idle loop. This is probably good enough but it's wasteful and not as accurate as trapping a write. |
|||
01 Mar 2005, 16:11 |
|
MazeGen 01 Mar 2005, 19:28
You can write them easily, but I'm not sure whether in works on all versions of windows.
When you install exception handler via fs:[0] and raise an exception, you get access to CONTEXT structure in the handler, where you can overwrite probably all registers, including debug registers. You also rewrite the EIP to some safe place and resume the execution. For more see http://www.jorgon.freeserve.co.uk/ExceptFrame.htm This method also use exe protectors to fool the debugger. BTW, MOV from/to DRn registers is in ring3 normally prohibited, of course. |
|||
01 Mar 2005, 19:28 |
|
mike.dld 01 Mar 2005, 22:33
I have another question.. How can I FULLY protect some memory region so either write or read memory operations in this region will cause #GP?
And another one: how fast would be tracing app (doing nothing at debugger side, just stopping and resuming on every instruction) comparing to simple execution? |
|||
01 Mar 2005, 22:33 |
|
S.T.A.S. 02 Mar 2005, 01:19
In ring 3 it takes approx from 2500 to 7000 tics to raise execution of ExeptionHandler with no user mode debugger active. It *depends* on hardware, OS, etc.
If debugger is active, then this time runs up. Here is some test with sources. And related discussion (in Russian) |
|||
02 Mar 2005, 01:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.