From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2308afbbe4ecec0b X-Google-Attributes: gid103376,public From: Mark Biggar Subject: Re: Subverting 'Access for Sub-programs Date: 1999/08/09 Message-ID: <37AEF748.42C0E7F0@gte.net>#1/1 X-Deja-AN: 510634653 Distribution: world Content-Transfer-Encoding: 7bit References: <37A71EF1.2201@dera.gov.uk> <37A7FDE8.4F5@dera.gov.uk> <7o9vrv$qgt$1@wanadoo.fr> <7oc5ih$6mb$1@wanadoo.fr> <7occq3$g9v$1@nnrp1.deja.com> <7ocrji$scl$1@nnrp1.deja.com> <7of1ju$d0m$1@nnrp1.deja.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Abuse-Info: Otherwise we will be unable to process your complaint properly X-Complaints-To: abuse@gte.net X-Trace: /bdhN9V+Zf6hO1GccoAh5ukN7jtnyoH8/0i13wROS20p24qtY0wagkD3dSQ5iFRwu/DhbJiLlWGa!IGHgNM3cms+Q0xw+CykZ3Q4JukDjYa7bPRl0pqb+In8HmqtQLeg= MIME-Version: 1.0 NNTP-Posting-Date: Mon, 09 Aug 1999 15:46:05 GMT Newsgroups: comp.lang.ada Date: 1999-08-09T00:00:00+00:00 List-Id: > After I wrote the above post, I actually did think of a simple way > that this type of runtime check could be implemented efficiently. > Suppose you have a subprogram P that contains nested subprograms Q1, > Q2, etc. If Q1'ACCESS is used, the compiler allocates a global counter > for P (Q1's parent); the access value for Q1'ACCESS would contain the > address of P's global counter, and the current value of the counter. > When P exits, it increments the global counter just before returning. > Now, any access-subprogram type that has this property will have a > counter address (possibly null) and a current counter value; so when > dereferencing, the program would look up the pointed-to counter and see > if its value matches the value stored in the access-subprogram type. If > not, the dereference is illegal. (A null counter address would indicate > a global subprogram, or perhaps any subprogram that is statically not > deeper than the type, so that the check would be unnecessary.) > > P's counter would also have to be incremented when its execution is > abandoned due to an exception; this may add a little complication in > some implementations, but not too much. Tasking probably complicates > things. This scheme fails if P is recursive. Exiting recursive invocations of P would invalidate the function pointer even though the frame it depends on was still valid. -- Mark Biggar mark.a.biggar@lmco.com