sstrip patch for x86-64 kernel

10 views
Skip to first unread message

pera

unread,
Aug 15, 2010, 2:39:14 PM8/15/10
to Demo Research
Hello guys, I made some little changes on ELF Kickers sstrip for
compile it on 64bits linux machines. Here is the patch:

--- ../sstrip.c 2001-03-24 09:18:52.000000000 -0300
+++ sstrip.c 2010-08-15 15:29:17.029367450 -0300
@@ -9,7 +9,16 @@
#include <unistd.h>
#include <fcntl.h>
#include <elf.h>
-#include <asm/elf.h>
+
+#ifdef __i386__
+#define ELF_CLASS ELFCLASS32
+#define ELF_DATA ELFDATA2LSB
+#define ELF_ARCH EM_386
+#else
+#define ELF_CLASS ELFCLASS64
+#define ELF_DATA ELFDATA2LSB
+#define ELF_ARCH EM_X86_64
+#endif

#ifndef TRUE
#define TRUE 1
@@ -121,7 +130,11 @@
static int getmemorysize(Elf_Ehdr const *ehdr, Elf_Phdr const *phdrs,
unsigned long *newsize)
{
+#ifdef __i386__
Elf32_Phdr const *phdr;
+#else
+ Elf64_Phdr const *phdr;
+#endif
unsigned long size, n;
int i;

@@ -185,7 +198,11 @@
static int modifyheaders(Elf_Ehdr *ehdr, Elf_Phdr *phdrs,
unsigned long newsize)
{
+#ifdef __i386__
Elf32_Phdr *phdr;
+#else
+ Elf64_Phdr *phdr;
+#endif
int i;

/* If the section header table is gone, then remove all
references
Reply all
Reply to author
Forward
0 new messages