emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Heap corruption?


From: Gerd Moellmann
Subject: Re: Heap corruption?
Date: 22 Aug 2003 19:16:13 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

> First let's see if there is a way to find a block of more than 90mb
> continuous memory in FreeBSD, and put the Lisp memory there.
> That would be much easier.

Not a bad idea :).

I've tried the following with a small C program:

  gcc -o test test.c \
    -Wl,--section-start -Wl,.interp=0x070480f4 \
    -Wl,--section-start -Wl,.note.ABI-tag=0x07048110 \
    -Wl,--section-start -Wl,.hash=0x07048128 \
    -Wl,--section-start -Wl,.dynsym=0x0704817c \
    -Wl,--section-start -Wl,.dynstr=0x0704827c \
    -Wl,--section-start -Wl,.rel.plt=0x07048318 \
    -Wl,--section-start -Wl,.init=0x07048330 \
    -Wl,--section-start -Wl,.plt=0x0704833c \
    -Wl,--section-start -Wl,.text=0x0704837c \
    -Wl,--section-start -Wl,.fini=0x070484e8 \
    -Wl,--section-start -Wl,.rodata=0x070484ee \
    -Wl,--section-start -Wl,.data=0x070494f0 \
    -Wl,--section-start -Wl,.eh_frame=0x070494fc \
    -Wl,--section-start -Wl,.dynamic=0x07049500 \
    -Wl,--section-start -Wl,.ctors=0x07049598 \
    -Wl,--section-start -Wl,.dtors=0x070495a0 \
    -Wl,--section-start -Wl,.got=0x070495a8 \
    -Wl,--section-start -Wl,.bss=0x070495c0 

The section names and addresses are from `objdump -h' of a normally
compiled test program, subtracting 0x01000000 in this case.  Changing
the adresses of only some sections, .data or .text and .data only lead
to either link errors or a program that could not be run (SIGABRT).

Then I modified unexelf.c for a test, and that worked too, sort of,
because debug symbol addresses are apparently wrong.  Elf expert
needed.

--- unexelf.c.~1.54.~   Mon Aug 11 13:16:37 2003
+++ unexelf.c   Fri Aug 22 18:39:43 2003
@@ -1254,6 +1254,17 @@
        }
     }
 
+#if defined __FreeBSD__
+
+  for (nn = new_file_h->e_shnum - 1; nn; nn--)
+    {
+      ElfW(Shdr) *section = &NEW_SECTION_H (nn);
+      if (section->sh_addr)
+       section->sh_addr -= 0x1000000;
+    }
+  
+#endif /* __FreeBSD__ */
+
   /* Write out new_file, and free the buffers.  */
 
   if (write (new_file, new_base, new_file_size) != new_file_size)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]