Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!ames!ucbcad!ucbvax!jade!lapis.berkeley.edu!oster From: oster@lapis.berkeley.edu.UUCP Newsgroups: comp.lang.fortran Subject: Re: Changing constants (was Re: Collecting favorite bug stories) Message-ID: <2334@jade.BERKELEY.EDU> Date: Sat, 24-Jan-87 05:48:28 EST Article-I.D.: jade.2334 Posted: Sat Jan 24 05:48:28 1987 Date-Received: Sun, 25-Jan-87 14:44:25 EST References: <3669@curly.ucla-cs.UCLA.EDU> <2722@udenva.UUCP> <494@gec-mi-at.co.uk> <11754@sun.uucp> <32add81d.71d0@apollo.uucp> Sender: usenet@jade.BERKELEY.EDU Reply-To: oster@lapis.berkeley.edu.UUCP (David Phillip Oster) Organization: University of California, Berkeley Lines: 34 My favorite "job security" hack in Fortran is done as follows: 1.) Take a routine that is called from only one or two places in the code, compile it separately, at make a file of the pure machine bits that result. 2.) Express that bit pattern as the result of a series of floating point operations. Ideally, you'd like a matrix of floating point numbers that when inverted has the same bit pattern as the code routine in <1.)>. 3.) use DATA //... to make that an array of initialized data in your program. 4.) At some inconspicuous point in the running of the program, apply the transform, so the array now holds the correct bit pattern for machine code. (A really clever programmer will do the transform in widely scattered pieces.) 5.) pass the array as an argument to a procedure. (Say the third argument of FOO.) 6.) Declare the third argument of FOO as a procedural parameter. That way step 5 will run it. To anyone who comes after you, this will be completely opaque. Note: Although many machines have non-writable code space, almost all machines will execute out of data space. If your machine won't, a refinement of this technique is to write a p-code interpreter, (where say, each byte does a different operation) and pass your inverse of an initialized floating point matrix to your p-code interpreter. Anyone see the Apple ][ game based on the reference in my signature? According to a review I read, there was a sequence of operations you could do to make it crash back to Apple's ROM Basic. But, you couldn't REALLY crash it, you were in an illusion of ROM Basic created by the program to make you think you had gotten out. --- David Phillip Oster -- "We live in a Global Village." Arpa: oster@lapis.berkeley.edu -- Uucp: ucbvax!ucblapis!oster -- "You are Number Six." pro