Re: OS stopping stack buffer overflow exploits

From: Florian Weimer (fw@deneb.cygnus.argh.org)
Date: Sun Jun 04 2000 - 09:49:57 EST


ingo.oeser@informatik.tu-chemnitz.de (Ingo Oeser) writes:

> No code shown either. And no reason deployed, why we couldn't
> code this without trampolines in the old threads.

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

with GNAT.Heap_Sort_A;

procedure Show_Trampolines is

   Numbers : array (0 .. 16) of Natural;

   procedure Move (From : Natural; To : Natural) is
   begin
      Numbers (To) := Numbers (From);
   end Move;

   function Lt (Op1, Op2 : Natural) return Boolean is
   begin
      return Numbers (Op1) < Numbers (Op2);
   end Lt;

begin
   Numbers (1 .. 16) := (10, 2, 3, 14, 12, 9, 15, 6,
                         16, 11, 1, 5, 14, 4, 8, 7);

   GNAT.Heap_Sort_A.Sort (N => 16,
                          Move => Move'Unrestricted_Access,
                          Lt => Lt'Unrestricted_Access);

   for J in Numbers'First + 1 .. Numbers'Last loop
      Put (Numbers (J), 0);
      New_Line;
   end loop;

end Show_Trampolines;

Although the Unrestricted_Access attribute is a GNAT extension, you
get the idea, I think. (In fact, Unrestricted_Access is expected
to give you a standard subprogram access value, and I don't think
there other ways to achieve that, at least they aren't as efficient as
trampolines.)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:18 EST