delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/20/12:54:26

Date: Sun, 20 Jul 1997 09:51:04 -0700 (PDT)
Message-Id: <199707201651.JAA09428@adit.ap.net>
Mime-Version: 1.0
To: muller AT janus DOT u-strasbg DOT fr
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: [Q] Is it possible to write-protect the text section ?
Cc: djgpp AT delorie DOT com

You wrote:
>   I think the title says it all
>
>   Can I use the set_page_attribute function of the DPMI
>to protect the text section against writing ?
>
AFAIK, no. You don't know where the code part ends.
>  (I am debugging a program that is writing in the text part,
>but the problems appear only when the overwritten code is used again
>so it is hard to debug !! )
Try setting a data breakpoint (watchpoint in gdb) at the address that gets
modified.

Does anyone know why the decision was made to have CS and DS refer to the
same region of memory, the program's entire address space? IMHO, CS should
be `text' only, and DS and SS should be `DGROUP' (or whatever it's called)
only. This would keep problems of this sort from occuring, since you can't
write to the CS segment.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019