LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-08-2012, 02:56 AM   #1
truboy
Member
 
Registered: Oct 2010
Location: Switzerland
Posts: 84

Rep: Reputation: 9
Trouble using Libelf/Elfio libraries : ELF not executable anymore


Hi everyone,

I'm using Libelf and Elfio to try and add a new section to ELF files. I would like it to be executable, just like .text.

This is my problem : with Libelf, as soon as I load (elf_begin()), update (elf_update()) and release (elf_end()) my ELF, it stops to be executable (seg fault when launching). readelf -S displays the sections but returns also the error : readelf: Warning: the .dynamic section is not contained within the dynamic segment. I didn't find any function in Libelf to "add" the .dynamic section to the DYNAMIC segment.

But I can do that with Elfio (with the segment->add_section_index() function), but then I have to manually add every other section to every other segment, as Elfio seems to overwrite them when loading the ELF. After doing that and trying to execute the ELF, the process crashes with exit code 137. Shell says "Processus arrêté" (it's french) which literally means "Process stopped", could be "Process killed".

Has anyone any experience with those libraries ?

My final goal is to be able to create a new executable section in the ELF, and modify its entry point to jump and execute directly that new section, in order to create a packer.

Any suggestions/other way to do so appreciated !
Thank you for your answers !
 
  


Reply

Tags
add, elf, section



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read the content of an ELF executable? karthickk02 Linux - Software 1 12-03-2011 07:45 AM
ELF format (Self Extractable Executable) Creation tank junior Linux - Newbie 2 10-29-2010 04:23 PM
Urgent !!! rpm: error while loading shared libraries: libelf.so.1: cannot open shared tinaa Linux - Software 5 12-02-2008 03:19 PM
elf executable size problem magham_rajesh Programming 3 06-27-2006 12:31 PM
Accessing ELF of the executable file ? vishalbutte Programming 3 12-30-2005 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration