Re: how to turn off NX bit in assembly?



"Alexei A. Frounze" <alexfrunews@xxxxxxxxx> wrote in message
news:87c2ffd3-d6b9-4d33-98f6-0458a793a28f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Nov 17, 12:24 pm, "Rod Pemberton" <do_not_h...@xxxxxxxxxxxxx>
wrote:
Hey, anyone ever think about using NX to ensure running code can be
stopped?
I guess you could use a PF on an unmapped page too? I.e., instead of
using
interrupts or instead of waiting for the code to return, one could
selectively enable execution on one code segment or map only one page of
code using the faults to stop execution in an additional controlled
manor.
E.g., a sliding execution window, if the application starts to runaway,
slam
into the wall...

That's the mechanism behind the virtual memory: you use fewer physical
pages to execute the code than the code needs. Upon a page fault some
page is unmapped and flushed to the disk and another one is brought in
from the disk and mapped.

Does NX only apply to pages?... If so, which is easire to do and undo:
map/unmap pages or set/clear NX? I'd think that keeping as many pages
mapped as possible would be a benefit to the OSes speed, wouldn't it? But,
if it's more complicated to set/clear NX...

Instead of unmapping and flush a page upon a page fault and loading another
to continue execution, one could terminate the program at that point.

That's the mechanism for CPU/PC
virtualization -- you catch accesses to the regions where memory-
mapped hardware is expected to be. It's harder with "runaway" apps,
since generally it's nontrivial to detect such an app.

If it executes across a unmapped page boundary or into a page or area that's
been marked NX, you have the option to terminate at that point. Of course,
the granularity isn't really there if it's executing a tight loop. I should
probably look at the debug registers to see what control of code they
offer... IIRC, they could interrupt on flow control.

And even if you
do detect it, what's the next useful step other than termination,
possibly logging an error and restarting the app from the beginning?

Yes, terminate. :) I'm sort of interested at the moment (and was a while
ago...) with the ability to start and stop code execution at whim under
control of another program (OS kernel). The "at whim" part is the problem.
It requires the control program to regain control. While the newer cpu's
have more features that could be used/abused for the purpose, older ones
don't. If there is an existing method with timers, interrupts, NMI, I've
overlooked it. Perhaps ACPI? One could... always rework the compiler
generate code which forfits control, but then you still have the problem of
applications not produced with the modified compiler.


RP

.



Relevant Pages

  • Re: Debugging Challenge - no source available
    ... transparent backgrounds - I previously noticed some bizarre behavior when I ... tried to set a control's background to a transparent bitmap (the transparent ... I've decided to derive my own control from the label control I'm ... >> In both cases, the debugger catches execution at the same point, just ...
    (microsoft.public.dotnet.general)
  • Re: how to turn off NX bit in assembly?
    ... code using the faults to stop execution in an additional controlled ... one could terminate the program at that point. ... probably look at the debug registers to see what control of code they ... the ACPI doesn't distinguish apps ...
    (alt.lang.asm)
  • Re: Can I overwrite a calculated query field?
    ... click on the textbox control that you want to do this ... > for "execution" which was linked to a default rate times ... > charge" in your table) ... >>which could be a calculation based on what type of trade ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Odd error trapping
    ... > No. Application.Exit just signals the message loop for the current ... The loop can't terminate until you return ... > control back to the caller. ... >> params") is executed from the next block of code and execution continues ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem getting screen controls to to populate
    ... The DoEvents instruction tells VB to pass control of execution to ... I would use a recordset variable. ... > The problem is that I have to open a msgbox (something else may ...
    (microsoft.public.vb.general.discussion)