elfio-info Mailing List for ELFIO
A header-only C++ library for accessing files in ELF binary format
Brought to you by:
to_serge
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Flavio T. <fla...@gm...> - 2015-01-14 12:58:28
|
Hi Serge, As he suggested me the problem was resolved in the one of the last commit of master branch. Thank you for your help. 2014-12-31 16:50 GMT+01:00 Serge Lamikhov-Center <to_...@ho...>: > Hi Flavio, > > This problem was resolved recently, but there is no releases which contain > the change. > Would you please give a try to ELFIO library version in the 'master' > branch of the Git repository? > > Please let me know if you still observe misfunctionality. > > Thank you, > Serge > > > ------------------------------ > From: fla...@gm... > Date: Tue, 23 Dec 2014 19:41:21 +0100 > To: elf...@li... > Subject: [ELFIO-info] problem with load and save > > > Hi everyone! :) > > I'm using Elfio 2.3 version. > > I'm try to load and re-save the same file, like the issue in this link: > > http://sourceforge.net/p/elfio/mailman/message/29442136/ > > I find the same problem, i try this: > > elfio e; > e.load("foo"); > e.save("foo2"); > > > But foo2 don't run. > > The size of foo is 8K and the size of foo2 is 4M. > > If i try "use readelf -l foo2" i've the same problem with segment. > > Mappatura da sezione a segmento: > Sezioni del segmento... > 00 > 01 > 02 > 03 .bss > 04 > 05 > 06 > 07 > 08 > > > Exuse me, my language is Italian :) > > > I tried with the attachment "elfio_seciton.hpp", but if i replace the file > still dose not work. > > I found only 2 differents > - my library version is 2.3 > - i'm working on x86-64. > > Ask me everything :) > > I hope in your help :) > > > -- > Flavio Toffalini > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming! The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. http://goparallel.sourceforge.net > _______________________________________________ ELFIO-info mailing list > ELF...@li... > https://lists.sourceforge.net/lists/listinfo/elfio-info > -- Flavio Toffalini |
|
From: Serge Lamikhov-C. <to_...@ho...> - 2014-12-31 15:50:46
|
Hi Flavio, This problem was resolved recently, but there is no releases which contain the change.Would you please give a try to ELFIO library version in the 'master' branch of the Git repository? Please let me know if you still observe misfunctionality. Thank you,Serge From: fla...@gm... Date: Tue, 23 Dec 2014 19:41:21 +0100 To: elf...@li... Subject: [ELFIO-info] problem with load and save Hi everyone! :) I'm using Elfio 2.3 version. I'm try to load and re-save the same file, like the issue in this link: http://sourceforge.net/p/elfio/mailman/message/29442136/ I find the same problem, i try this: elfio e; e.load("foo"); e.save("foo2"); But foo2 don't run. The size of foo is 8K and the size of foo2 is 4M. If i try "use readelf -l foo2" i've the same problem with segment. Mappatura da sezione a segmento: Sezioni del segmento... 00 01 02 03 .bss 04 05 06 07 08 Exuse me, my language is Italian :) I tried with the attachment "elfio_seciton.hpp", but if i replace the file still dose not work. I found only 2 differents - my library version is 2.3 - i'm working on x86-64. Ask me everything :) I hope in your help :) -- Flavio Toffalini ------------------------------------------------------------------------------ Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net _______________________________________________ ELFIO-info mailing list ELF...@li... https://lists.sourceforge.net/lists/listinfo/elfio-info |
|
From: Flavio T. <fla...@gm...> - 2014-12-23 18:41:58
|
Hi everyone! :) I'm using Elfio 2.3 version. I'm try to load and re-save the same file, like the issue in this link: http://sourceforge.net/p/elfio/mailman/message/29442136/ I find the same problem, i try this: > elfio e; > e.load("foo"); > e.save("foo2"); > > But foo2 don't run. The size of foo is 8K and the size of foo2 is 4M. If i try "use readelf -l foo2" i've the same problem with segment. Mappatura da sezione a segmento: > Sezioni del segmento... > 00 > 01 > 02 > 03 .bss > 04 > 05 > 06 > 07 > 08 > Exuse me, my language is Italian :) I tried with the attachment "elfio_seciton.hpp", but if i replace the file still dose not work. I found only 2 differents - my library version is 2.3 - i'm working on x86-64. Ask me everything :) I hope in your help :) -- Flavio Toffalini |
|
From: Serge B. <ser...@he...> - 2012-06-22 07:03:32
|
Hi Serge,
Thank you very much for the fix !
Cheers,
Serge.
Le 20. 06. 12 07:58, Serge Lamikhov-Center a écrit :
> Hi Serge,
>
> Thank you for reporting this issue.
>
> The problem was related to lack of section data size initializing at
> 'load' time.
> Please find attached the fixed file.
>
> Best regards,
> Serge
>
>
> ------------------------------------------------------------------------
> Date: Tue, 19 Jun 2012 11:34:00 +0200
> From: ser...@he...
> To: to_...@ho...
> CC: elf...@li...
> Subject: Re: [ELFIO-info] ELF not executable anymore after load/save
>
> Hi,
>
> One more thing : it seems that I can't add a section to an existing ELF :
>
> / elfio e;
> e.load("foo");
> e.sections.add("new");
> e.save("foo");/
>
> When running this code, it crashes with a seg fault when calling
> "add()". Am I misusing it ?
>
> Thank you for your answer.
>
> Cheers,
>
> Serge.
>
>
> Le 14. 06. 12 10:20, Serge Burdet a écrit :
>
> Hi,
>
> Sure : my goal is to develop a simple packer. It would be able to
> encrypt the .text section of an ELF and add a new executable
> section to it (let's call it .new). .new would be able to decrypt
> .text. Then modify the entry point to jump directly to .new, so
> when you run the file, the .new decrypts .text and jumps to it.
> The original .text then executes (I hope I'm clear, don't hesitate
> to ask if not ;) ). This is part of a project we're doing here at
> HEIG-VD.
>
> So far I've been able to add my own section with my own machine
> code to an ELF using the /objcopy --add-section/ tool. Now, with
> ELFIO, I'd like to modify the entry point and flag the new section
> as executable. That works, by the way, my only trouble is the
> "sections-segments" thing.
>
> Thank you for your workaround, I'm gonna try it today.
>
> What I tried already is to re-add manually the sections to the
> segments, using the a segment's /add_section_index/ function (
> targetSegment->add_section_index(sectionToAdd->get_index(),
> sectionToAdd->get_addr_align()); ). After that, I try to run the
> modified ELF, and I think it launches but crashes instantly, and
> the shell says "Processus arrêté" (it's french) which literally
> means "Process stopped", could be "Process killed".
> And a weird fact about this is that the size of the ELF hugely
> increases : from 8kB to 4MB !
>
> Thank you very much for your help and explanations.
>
> Cheers,
>
> Serge.
>
>
> Le 13. 06. 12 16:25, Serge Lamikhov-Center a écrit :
>
> Hi Serge,
>
> I have at looked at the issue and here are the results concluded:
>
> You are right - ELFIO's 'load' function does not automatically
> relate sections to the containing segments. That is by design
> though. Data content for segments and sections is still valid.
>
> While segments are usually built from sections by linker (and
> in case of ELFIO library usage, it is the only option), it is
> not always possible to process ELF file in reverse order
> (restore sections from segment content). Some segments may not
> contain child sections and in generic case, no sections at all
> may exist in executable file.
>
> I have checked that your proposed method working fine for
> relocatable files (object files), but not for executable
> files. (The example program elfcopy.c is attached with this
> email.)
>
> As a workaround, you may try (I didn't check it by myself) the
> following method:
>
> -process input file
>
> -for each _/segment/_ in input file create new _/section/_
> with the same content in another output file
>
> -build new segment that would contain this, just created, section
>
> -Properly set sections/segments attributes and entry address
>
> Probably, it will be better if you could explain your
> intention first.
>
> Best regards,
>
> Serge
>
>
>
>
> ------------------------------------------------------------------------
> From: to_...@ho... <mailto:to_...@ho...>
> To: ser...@he... <mailto:ser...@he...>
> CC: elf...@li...
> <mailto:elf...@li...>
> Subject: RE: [ELFIO-info] ELF not executable anymore after
> load/save
> Date: Mon, 11 Jun 2012 17:08:17 +0300
>
> Hi Serge,
>
> I had never tried to use the library in such flow. Please let
> me look at this.
>
> Best regards,
> Serge
>
> ------------------------------------------------------------------------
> Date: Mon, 11 Jun 2012 13:58:37 +0200
> From: ser...@he... <mailto:ser...@he...>
> To: to_...@ho... <mailto:to_...@ho...>
> CC: elf...@li...
> <mailto:elf...@li...>
> Subject: Re: [ELFIO-info] ELF not executable anymore after
> load/save
>
> Hi Serge,
>
> Thank you for your answer, I'm new to the ELF format and I
> really appreciate your help.
>
> I feel like I'm missing something with ELFIO (2.0.0), because
> as soon as I save an ELF, all its sections get un-mapped from
> the segments, even if I don't modify it. For example this
> trivial code :
>
> / elfio e;
> e.load("foo");
> e.save("foo2");/
>
> After running it, /foo2/ isn't executable, as sections doesn't
> seem to be mapped to segments anymore (excerpt of /readelf -l
> foo2/) :
>
> / Section to Segment mapping:
> Segment Sections...
> 00
> 01
> 02
> 03
> 04
> 05
> 06
> 07
> 08 /
>
> Is there a function that I have to call after loading /foo/ so
> its mapping stays untouched ?
>
> Thank you for your answer.
>
> Best regards,
>
> Serge.
>
>
> Le 11. 06. 12 13:27, Serge Lamikhov-Center a écrit :
>
>
> Hi Serge,
>
>
> The answer depends on the purpose of the section you are
> adding. There is no problem to add a section outside
> segment, but, loader usually works with segments only.
> Therefore, in case the intention is to load a section and
> execute it, most probably, you need to add it into
> existing or new segment.
>
>
> Best regards,
>
> Serge
>
> ------------------------------------------------------------------------
> Date: Fri, 8 Jun 2012 10:33:00 +0200
> From: ser...@he... <mailto:ser...@he...>
> To: elf...@li...
> <mailto:elf...@li...>
> Subject: [ELFIO-info] ELF not executable anymore after
> load/save
>
> Hi everyone,
>
> I'm using ELFIO to try and add a new section to ELF files.
> This is my problem : as soon as I load and save an ELF, it
> stops to be executable. /readelf -l/ shows that sections
> aren't mapped to segments anymore.
>
> Is this a normal behaviour ? Do I have to manually add the
> sections to the segments ?
>
> Thank you for your answers !
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference Exclusive live event will
> cover all the ways today's security and threat landscape
> has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________ ELFIO-info
> mailing list ELF...@li...
> <mailto:ELF...@li...>
> https://lists.sourceforge.net/lists/listinfo/elfio-info
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference Exclusive live event will cover all
> the ways today's security and threat landscape has changed and how IT
> managers can respond. Discussions will include endpoint security,
> mobile security and the latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________ ELFIO-info mailing
> list ELF...@li...
> https://lists.sourceforge.net/lists/listinfo/elfio-info
|
|
From: Serge B. <ser...@he...> - 2012-06-19 09:34:13
|
Hi,
One more thing : it seems that I can't add a section to an existing ELF :
/ elfio e;
e.load("foo");
e.sections.add("new");
e.save("foo");/
When running this code, it crashes with a seg fault when calling
"add()". Am I misusing it ?
Thank you for your answer.
Cheers,
Serge.
Le 14. 06. 12 10:20, Serge Burdet a écrit :
> Hi,
>
> Sure : my goal is to develop a simple packer. It would be able to
> encrypt the .text section of an ELF and add a new executable section
> to it (let's call it .new). .new would be able to decrypt .text. Then
> modify the entry point to jump directly to .new, so when you run the
> file, the .new decrypts .text and jumps to it. The original .text then
> executes (I hope I'm clear, don't hesitate to ask if not ;) ). This is
> part of a project we're doing here at HEIG-VD.
>
> So far I've been able to add my own section with my own machine code
> to an ELF using the /objcopy --add-section/ tool. Now, with ELFIO, I'd
> like to modify the entry point and flag the new section as executable.
> That works, by the way, my only trouble is the "sections-segments" thing.
>
> Thank you for your workaround, I'm gonna try it today.
>
> What I tried already is to re-add manually the sections to the
> segments, using the a segment's /add_section_index/ function (
> targetSegment->add_section_index(sectionToAdd->get_index(),
> sectionToAdd->get_addr_align()); ). After that, I try to run the
> modified ELF, and I think it launches but crashes instantly, and the
> shell says "Processus arrêté" (it's french) which literally means
> "Process stopped", could be "Process killed".
> And a weird fact about this is that the size of the ELF hugely
> increases : from 8kB to 4MB !
>
> Thank you very much for your help and explanations.
>
> Cheers,
>
> Serge.
>
>
> Le 13. 06. 12 16:25, Serge Lamikhov-Center a écrit :
>>
>> Hi Serge,
>>
>> I have at looked at the issue and here are the results concluded:
>>
>> You are right - ELFIO's 'load' function does not automatically relate
>> sections to the containing segments. That is by design though. Data
>> content for segments and sections is still valid.
>>
>> While segments are usually built from sections by linker (and in case
>> of ELFIO library usage, it is the only option), it is not always
>> possible to process ELF file in reverse order (restore sections from
>> segment content). Some segments may not contain child sections and in
>> generic case, no sections at all may exist in executable file.
>>
>> I have checked that your proposed method working fine for relocatable
>> files (object files), but not for executable files. (The example
>> program elfcopy.c is attached with this email.)
>>
>> As a workaround, you may try (I didn't check it by myself) the
>> following method:
>>
>> -process input file
>>
>> -for each _/segment/_ in input file create new _/section/_ with the
>> same content in another output file
>>
>> -build new segment that would contain this, just created, section
>>
>> -Properly set sections/segments attributes and entry address
>>
>> Probably, it will be better if you could explain your intention first.
>>
>> Best regards,
>>
>> Serge
>>
>>
>>
>> ------------------------------------------------------------------------
>> From: to_...@ho...
>> To: ser...@he...
>> CC: elf...@li...
>> Subject: RE: [ELFIO-info] ELF not executable anymore after load/save
>> Date: Mon, 11 Jun 2012 17:08:17 +0300
>>
>> Hi Serge,
>>
>> I had never tried to use the library in such flow. Please let me look
>> at this.
>>
>> Best regards,
>> Serge
>>
>> ------------------------------------------------------------------------
>> Date: Mon, 11 Jun 2012 13:58:37 +0200
>> From: ser...@he...
>> To: to_...@ho...
>> CC: elf...@li...
>> Subject: Re: [ELFIO-info] ELF not executable anymore after load/save
>>
>> Hi Serge,
>>
>> Thank you for your answer, I'm new to the ELF format and I really
>> appreciate your help.
>>
>> I feel like I'm missing something with ELFIO (2.0.0), because as soon
>> as I save an ELF, all its sections get un-mapped from the segments,
>> even if I don't modify it. For example this trivial code :
>>
>> / elfio e;
>> e.load("foo");
>> e.save("foo2");/
>>
>> After running it, /foo2/ isn't executable, as sections doesn't seem
>> to be mapped to segments anymore (excerpt of /readelf -l foo2/) :
>>
>> / Section to Segment mapping:
>> Segment Sections...
>> 00
>> 01
>> 02
>> 03
>> 04
>> 05
>> 06
>> 07
>> 08 /
>>
>> Is there a function that I have to call after loading /foo/ so its
>> mapping stays untouched ?
>>
>> Thank you for your answer.
>>
>> Best regards,
>>
>> Serge.
>>
>>
>> Le 11. 06. 12 13:27, Serge Lamikhov-Center a écrit :
>>
>>
>> Hi Serge,
>>
>>
>> The answer depends on the purpose of the section you are adding.
>> There is no problem to add a section outside segment, but, loader
>> usually works with segments only. Therefore, in case the
>> intention is to load a section and execute it, most probably, you
>> need to add it into existing or new segment.
>>
>>
>> Best regards,
>>
>> Serge
>>
>> ------------------------------------------------------------------------
>> Date: Fri, 8 Jun 2012 10:33:00 +0200
>> From: ser...@he... <mailto:ser...@he...>
>> To: elf...@li...
>> <mailto:elf...@li...>
>> Subject: [ELFIO-info] ELF not executable anymore after load/save
>>
>> Hi everyone,
>>
>> I'm using ELFIO to try and add a new section to ELF files.
>> This is my problem : as soon as I load and save an ELF, it stops
>> to be executable. /readelf -l/ shows that sections aren't mapped
>> to segments anymore.
>>
>> Is this a normal behaviour ? Do I have to manually add the
>> sections to the segments ?
>>
>> Thank you for your answers !
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference Exclusive live event will cover
>> all the ways today's security and threat landscape has changed
>> and how IT managers can respond. Discussions will include
>> endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________ ELFIO-info
>> mailing list ELF...@li...
>> <mailto:ELF...@li...>
>> https://lists.sourceforge.net/lists/listinfo/elfio-info
>>
|
|
From: Serge B. <ser...@he...> - 2012-06-14 08:20:46
|
Hi,
Sure : my goal is to develop a simple packer. It would be able to
encrypt the .text section of an ELF and add a new executable section to
it (let's call it .new). .new would be able to decrypt .text. Then
modify the entry point to jump directly to .new, so when you run the
file, the .new decrypts .text and jumps to it. The original .text then
executes (I hope I'm clear, don't hesitate to ask if not ;) ). This is
part of a project we're doing here at HEIG-VD.
So far I've been able to add my own section with my own machine code to
an ELF using the /objcopy --add-section/ tool. Now, with ELFIO, I'd like
to modify the entry point and flag the new section as executable. That
works, by the way, my only trouble is the "sections-segments" thing.
Thank you for your workaround, I'm gonna try it today.
What I tried already is to re-add manually the sections to the segments,
using the a segment's /add_section_index/ function (
targetSegment->add_section_index(sectionToAdd->get_index(),
sectionToAdd->get_addr_align()); ). After that, I try to run the
modified ELF, and I think it launches but crashes instantly, and the
shell says "Processus arrêté" (it's french) which literally means
"Process stopped", could be "Process killed".
And a weird fact about this is that the size of the ELF hugely increases
: from 8kB to 4MB !
Thank you very much for your help and explanations.
Cheers,
Serge.
Le 13. 06. 12 16:25, Serge Lamikhov-Center a écrit :
>
> Hi Serge,
>
> I have at looked at the issue and here are the results concluded:
>
> You are right - ELFIO's 'load' function does not automatically relate
> sections to the containing segments. That is by design though. Data
> content for segments and sections is still valid.
>
> While segments are usually built from sections by linker (and in case
> of ELFIO library usage, it is the only option), it is not always
> possible to process ELF file in reverse order (restore sections from
> segment content). Some segments may not contain child sections and in
> generic case, no sections at all may exist in executable file.
>
> I have checked that your proposed method working fine for relocatable
> files (object files), but not for executable files. (The example
> program elfcopy.c is attached with this email.)
>
> As a workaround, you may try (I didn't check it by myself) the
> following method:
>
> -process input file
>
> -for each _/segment/_ in input file create new _/section/_ with the
> same content in another output file
>
> -build new segment that would contain this, just created, section
>
> -Properly set sections/segments attributes and entry address
>
> Probably, it will be better if you could explain your intention first.
>
> Best regards,
>
> Serge
>
>
>
> ------------------------------------------------------------------------
> From: to_...@ho...
> To: ser...@he...
> CC: elf...@li...
> Subject: RE: [ELFIO-info] ELF not executable anymore after load/save
> Date: Mon, 11 Jun 2012 17:08:17 +0300
>
> Hi Serge,
>
> I had never tried to use the library in such flow. Please let me look
> at this.
>
> Best regards,
> Serge
>
> ------------------------------------------------------------------------
> Date: Mon, 11 Jun 2012 13:58:37 +0200
> From: ser...@he...
> To: to_...@ho...
> CC: elf...@li...
> Subject: Re: [ELFIO-info] ELF not executable anymore after load/save
>
> Hi Serge,
>
> Thank you for your answer, I'm new to the ELF format and I really
> appreciate your help.
>
> I feel like I'm missing something with ELFIO (2.0.0), because as soon
> as I save an ELF, all its sections get un-mapped from the segments,
> even if I don't modify it. For example this trivial code :
>
> / elfio e;
> e.load("foo");
> e.save("foo2");/
>
> After running it, /foo2/ isn't executable, as sections doesn't seem to
> be mapped to segments anymore (excerpt of /readelf -l foo2/) :
>
> / Section to Segment mapping:
> Segment Sections...
> 00
> 01
> 02
> 03
> 04
> 05
> 06
> 07
> 08 /
>
> Is there a function that I have to call after loading /foo/ so its
> mapping stays untouched ?
>
> Thank you for your answer.
>
> Best regards,
>
> Serge.
>
>
> Le 11. 06. 12 13:27, Serge Lamikhov-Center a écrit :
>
>
> Hi Serge,
>
>
> The answer depends on the purpose of the section you are adding.
> There is no problem to add a section outside segment, but, loader
> usually works with segments only. Therefore, in case the intention
> is to load a section and execute it, most probably, you need to
> add it into existing or new segment.
>
>
> Best regards,
>
> Serge
>
> ------------------------------------------------------------------------
> Date: Fri, 8 Jun 2012 10:33:00 +0200
> From: ser...@he... <mailto:ser...@he...>
> To: elf...@li...
> <mailto:elf...@li...>
> Subject: [ELFIO-info] ELF not executable anymore after load/save
>
> Hi everyone,
>
> I'm using ELFIO to try and add a new section to ELF files.
> This is my problem : as soon as I load and save an ELF, it stops
> to be executable. /readelf -l/ shows that sections aren't mapped
> to segments anymore.
>
> Is this a normal behaviour ? Do I have to manually add the
> sections to the segments ?
>
> Thank you for your answers !
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference Exclusive live event will cover
> all the ways today's security and threat landscape has changed and
> how IT managers can respond. Discussions will include endpoint
> security, mobile security and the latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________ ELFIO-info mailing
> list ELF...@li...
> <mailto:ELF...@li...>
> https://lists.sourceforge.net/lists/listinfo/elfio-info
>
|
|
From: Serge Lamikhov-C. <to_...@ho...> - 2012-06-13 14:25:19
|
#include <iostream>
#include "elfio.hpp"
using namespace ELFIO;
int main( int argc, char* argv[] )
{
if ( argc != 3 ) {
std::cout << "Usage: elfcopy <orig_file> <out_file>" << std::endl;
return 1;
}
elfio e;
e.load( argv[1] );
e.save( argv[2] );
return 0;
}
|
|
From: Serge Lamikhov-C. <to_...@ho...> - 2012-06-11 14:08:27
|
Hi Serge, I had never tried to use the library in such flow. Please let me look at this. Best regards,Serge
Date: Mon, 11 Jun 2012 13:58:37 +0200
From: ser...@he...
To: to_...@ho...
CC: elf...@li...
Subject: Re: [ELFIO-info] ELF not executable anymore after load/save
Hi Serge,
Thank you for your answer, I'm new to the ELF format and I really
appreciate your help.
I feel like I'm missing something with ELFIO (2.0.0), because as
soon as I save an ELF, all its sections get un-mapped from the
segments, even if I don't modify it. For example this trivial code :
elfio e;
e.load("foo");
e.save("foo2");
After running it, foo2 isn't executable, as sections doesn't
seem to be mapped to segments anymore (excerpt of readelf -l
foo2) :
Section to Segment mapping:
Segment Sections...
00
01
02
03
04
05
06
07
08
Is there a function that I have to call after loading foo so
its mapping stays untouched ?
Thank you for your answer.
Best regards,
Serge.
Le 11. 06. 12 13:27, Serge Lamikhov-Center a écrit :
Hi Serge,
The answer depends on the
purpose of the section you are
adding. There is no problem to add a section outside
segment, but, loader usually
works with segments only. Therefore, in case the intention
is to load a section
and execute it, most probably, you need to add it into
existing or new segment.
Best regards,
Serge
Date: Fri, 8 Jun 2012 10:33:00 +0200
From: ser...@he...
To: elf...@li...
Subject: [ELFIO-info] ELF not executable anymore after
load/save
Hi everyone,
I'm using ELFIO to try and add a new section to ELF files.
This is my problem : as soon as I load and save an ELF, it
stops to be executable. readelf -l shows that
sections aren't mapped to segments anymore.
Is this a normal behaviour ? Do I have to manually add the
sections to the segments ?
Thank you for your answers !
------------------------------------------------------------------------------
Live
Security Virtual Conference
Exclusive live event will cover all the ways today's security
and threat landscape has changed and how IT managers can
respond. Discussions will include endpoint security, mobile
security and the latest in malware threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
ELFIO-info mailing list
ELF...@li...
https://lists.sourceforge.net/lists/listinfo/elfio-info
|
|
From: Serge B. <ser...@he...> - 2012-06-11 11:58:56
|
Hi Serge,
Thank you for your answer, I'm new to the ELF format and I really
appreciate your help.
I feel like I'm missing something with ELFIO (2.0.0), because as soon as
I save an ELF, all its sections get un-mapped from the segments, even if
I don't modify it. For example this trivial code :
/ elfio e;
e.load("foo");
e.save("foo2");/
After running it, /foo2/ isn't executable, as sections doesn't seem to
be mapped to segments anymore (excerpt of /readelf -l foo2/) :
/ Section to Segment mapping:
Segment Sections...
00
01
02
03
04
05
06
07
08 /
Is there a function that I have to call after loading /foo/ so its
mapping stays untouched ?
Thank you for your answer.
Best regards,
Serge.
Le 11. 06. 12 13:27, Serge Lamikhov-Center a e'crit :
>
> Hi Serge,
>
>
> The answer depends on the purpose of the section you are adding. There
> is no problem to add a section outside segment, but, loader usually
> works with segments only. Therefore, in case the intention is to load
> a section and execute it, most probably, you need to add it into
> existing or new segment.
>
>
> Best regards,
>
> Serge
>
> ------------------------------------------------------------------------
> Date: Fri, 8 Jun 2012 10:33:00 +0200
> From: ser...@he...
> To: elf...@li...
> Subject: [ELFIO-info] ELF not executable anymore after load/save
>
> Hi everyone,
>
> I'm using ELFIO to try and add a new section to ELF files.
> This is my problem : as soon as I load and save an ELF, it stops to be
> executable. /readelf -l/ shows that sections aren't mapped to segments
> anymore.
>
> Is this a normal behaviour ? Do I have to manually add the sections to
> the segments ?
>
> Thank you for your answers !
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference Exclusive live event will cover all
> the ways today's security and threat landscape has changed and how IT
> managers can respond. Discussions will include endpoint security,
> mobile security and the latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________ ELFIO-info mailing
> list ELF...@li...
> https://lists.sourceforge.net/lists/listinfo/elfio-info
|
|
From: Serge Lamikhov-C. <to_...@ho...> - 2012-06-11 11:27:23
|
Hi Serge,
The answer depends on the purpose of the section you are
adding. There is no problem to add a section outside segment, but, loader usually
works with segments only. Therefore, in case the intention is to load a section
and execute it, most probably, you need to add it into existing or new segment.
Best regards,
Serge
Date: Fri, 8 Jun 2012 10:33:00 +0200
From: ser...@he...
To: elf...@li...
Subject: [ELFIO-info] ELF not executable anymore after load/save
Hi everyone,
I'm using ELFIO to try and add a new section to ELF files.
This is my problem : as soon as I load and save an ELF, it
stops to be executable. readelf -l shows that sections
aren't mapped to segments anymore.
Is this a normal behaviour ? Do I have to manually add the
sections to the segments ?
Thank you for your answers !
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
ELFIO-info mailing list
ELF...@li...
https://lists.sourceforge.net/lists/listinfo/elfio-info |
|
From: Serge B. <ser...@he...> - 2012-06-08 08:33:11
|
Hi everyone, I'm using ELFIO to try and add a new section to ELF files. This is my problem : as soon as I load and save an ELF, it stops to be executable. /readelf -l/ shows that sections aren't mapped to segments anymore. Is this a normal behaviour ? Do I have to manually add the sections to the segments ? Thank you for your answers ! |
|
From: Rajat K. <raj...@gm...> - 2011-05-25 06:31:28
|
I have been trying to install ELFIO on my computer as it is required by another package. I have tried installing ELFIO-1.0.2 and ELFIO-1.0.3. But in both cases the build fails as a 'buffer overflow is detected' Here is the output of ELFIO-1.0.3 configure and make ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for g++... g++ checking for C++ compiler default output file name... a.out checking whether the C++ compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++... gcc3 checking for ranlib... ranlib checking for a BSD-compatible install... /usr/bin/install -c configure: creating ./config.status config.status: creating Makefile config.status: creating ELFIO/Makefile config.status: creating Examples/Makefile config.status: creating Examples/ELFDump/Makefile config.status: creating Examples/RelocationTable/Makefile config.status: creating Examples/Writer/Makefile config.status: creating Examples/WriteObj/Makefile config.status: creating Examples/WriteObj2/Makefile config.status: creating Examples/tutorial/Makefile config.status: creating doc/Makefile config.status: executing depfiles commands $ make Making all in ELFIO make[1]: Entering directory `/home/rajat/Documents/Summer_Project/tars/ELFIO-1.0.3/ELFIO' if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFIDynamic.o -MD -MP -MF ".deps/ELFIDynamic.Tpo" -c -o ELFIDynamic.o ELFIDynamic.cpp; \ then mv -f ".deps/ELFIDynamic.Tpo" ".deps/ELFIDynamic.Po"; else rm -f ".deps/ELFIDynamic.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFIImpl.o -MD -MP -MF ".deps/ELFIImpl.Tpo" -c -o ELFIImpl.o ELFIImpl.cpp; \ then mv -f ".deps/ELFIImpl.Tpo" ".deps/ELFIImpl.Po"; else rm -f ".deps/ELFIImpl.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFINote.o -MD -MP -MF ".deps/ELFINote.Tpo" -c -o ELFINote.o ELFINote.cpp; \ then mv -f ".deps/ELFINote.Tpo" ".deps/ELFINote.Po"; else rm -f ".deps/ELFINote.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFIO.o -MD -MP -MF ".deps/ELFIO.Tpo" -c -o ELFIO.o ELFIO.cpp; \ then mv -f ".deps/ELFIO.Tpo" ".deps/ELFIO.Po"; else rm -f ".deps/ELFIO.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFIOUtils.o -MD -MP -MF ".deps/ELFIOUtils.Tpo" -c -o ELFIOUtils.o ELFIOUtils.cpp; \ then mv -f ".deps/ELFIOUtils.Tpo" ".deps/ELFIOUtils.Po"; else rm -f ".deps/ELFIOUtils.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFIRelocation.o -MD -MP -MF ".deps/ELFIRelocation.Tpo" -c -o ELFIRelocation.o ELFIRelocation.cpp; \ then mv -f ".deps/ELFIRelocation.Tpo" ".deps/ELFIRelocation.Po"; else rm -f ".deps/ELFIRelocation.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFISection.o -MD -MP -MF ".deps/ELFISection.Tpo" -c -o ELFISection.o ELFISection.cpp; \ then mv -f ".deps/ELFISection.Tpo" ".deps/ELFISection.Po"; else rm -f ".deps/ELFISection.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFISegment.o -MD -MP -MF ".deps/ELFISegment.Tpo" -c -o ELFISegment.o ELFISegment.cpp; \ then mv -f ".deps/ELFISegment.Tpo" ".deps/ELFISegment.Po"; else rm -f ".deps/ELFISegment.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFIStrings.o -MD -MP -MF ".deps/ELFIStrings.Tpo" -c -o ELFIStrings.o ELFIStrings.cpp; \ then mv -f ".deps/ELFIStrings.Tpo" ".deps/ELFIStrings.Po"; else rm -f ".deps/ELFIStrings.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFISymbols.o -MD -MP -MF ".deps/ELFISymbols.Tpo" -c -o ELFISymbols.o ELFISymbols.cpp; \ then mv -f ".deps/ELFISymbols.Tpo" ".deps/ELFISymbols.Po"; else rm -f ".deps/ELFISymbols.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFODynamic.o -MD -MP -MF ".deps/ELFODynamic.Tpo" -c -o ELFODynamic.o ELFODynamic.cpp; \ then mv -f ".deps/ELFODynamic.Tpo" ".deps/ELFODynamic.Po"; else rm -f ".deps/ELFODynamic.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFOImpl.o -MD -MP -MF ".deps/ELFOImpl.Tpo" -c -o ELFOImpl.o ELFOImpl.cpp; \ then mv -f ".deps/ELFOImpl.Tpo" ".deps/ELFOImpl.Po"; else rm -f ".deps/ELFOImpl.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFONote.o -MD -MP -MF ".deps/ELFONote.Tpo" -c -o ELFONote.o ELFONote.cpp; \ then mv -f ".deps/ELFONote.Tpo" ".deps/ELFONote.Po"; else rm -f ".deps/ELFONote.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFORelocation.o -MD -MP -MF ".deps/ELFORelocation.Tpo" -c -o ELFORelocation.o ELFORelocation.cpp; \ then mv -f ".deps/ELFORelocation.Tpo" ".deps/ELFORelocation.Po"; else rm -f ".deps/ELFORelocation.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFOSection.o -MD -MP -MF ".deps/ELFOSection.Tpo" -c -o ELFOSection.o ELFOSection.cpp; \ then mv -f ".deps/ELFOSection.Tpo" ".deps/ELFOSection.Po"; else rm -f ".deps/ELFOSection.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFOSegment.o -MD -MP -MF ".deps/ELFOSegment.Tpo" -c -o ELFOSegment.o ELFOSegment.cpp; \ then mv -f ".deps/ELFOSegment.Tpo" ".deps/ELFOSegment.Po"; else rm -f ".deps/ELFOSegment.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFOString.o -MD -MP -MF ".deps/ELFOString.Tpo" -c -o ELFOString.o ELFOString.cpp; \ then mv -f ".deps/ELFOString.Tpo" ".deps/ELFOString.Po"; else rm -f ".deps/ELFOString.Tpo"; exit 1; fi if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ELFIO\" -DVERSION=\"1.0.3\" -I. -I. -g -O2 -MT ELFOSymbols.o -MD -MP -MF ".deps/ELFOSymbols.Tpo" -c -o ELFOSymbols.o ELFOSymbols.cpp; \ then mv -f ".deps/ELFOSymbols.Tpo" ".deps/ELFOSymbols.Po"; else rm -f ".deps/ELFOSymbols.Tpo"; exit 1; fi rm -f libELFIO.a ar cru libELFIO.a ELFIDynamic.o ELFIImpl.o ELFINote.o ELFIO.o ELFIOUtils.o ELFIRelocation.o ELFISection.o ELFISegment.o ELFIStrings.o ELFISymbols.o ELFODynamic.o ELFOImpl.o ELFONote.o ELFORelocation.o ELFOSection.o ELFOSegment.o ELFOString.o ELFOSymbols.o *** buffer overflow detected ***: ar terminated ======= Backtrace: ========= /lib/libc.so.6(__fortify_fail+0x50)[0x40124980] /lib/libc.so.6(+0xe487a)[0x4012387a] /lib/libc.so.6(+0xe3fb8)[0x40122fb8] /lib/libc.so.6(_IO_default_xsputn+0x9e)[0x400a9a2e] /lib/libc.so.6(_IO_padn+0xd8)[0x4009d3b8] /lib/libc.so.6(_IO_vfprintf+0x2b17)[0x4007ed27] /lib/libc.so.6(__vsprintf_chk+0xad)[0x4012306d] /lib/libc.so.6(__sprintf_chk+0x2d)[0x40122fad] ar[0x8050355] ar[0x804e6d3] ar[0x8050cfe] ar[0x8053a88] ar[0x804b5cf] ar[0x804c236] /lib/libc.so.6(__libc_start_main+0xe7)[0x40055ce7] ar[0x8049351] ======= Memory map: ======== 08048000-080aa000 r-xp 00000000 08:07 214688 /usr/local/bin/ar 080aa000-080ab000 r--p 00061000 08:07 214688 /usr/local/bin/ar 080ab000-080ac000 rw-p 00062000 08:07 214688 /usr/local/bin/ar 09b4f000-09c3c000 rw-p 00000000 00:00 0 [heap] 40000000-4001c000 r-xp 00000000 08:07 496 /lib/ld-2.12.1.so 4001c000-4001d000 r--p 0001b000 08:07 496 /lib/ld-2.12.1.so 4001d000-4001e000 rw-p 0001c000 08:07 496 /lib/ld-2.12.1.so 4001e000-4001f000 r-xp 00000000 00:00 0 [vdso] 4001f000-40021000 rw-p 00000000 00:00 0 40021000-40022000 r--p 0029c000 08:07 262293 /usr/lib/locale/locale-archive 40022000-40029000 r--s 00000000 08:07 159193 /usr/lib/gconv/gconv-modules.cache 40029000-40033000 rw-p 00000000 00:00 0 4003f000-40196000 r-xp 00000000 08:07 821 /lib/libc-2.12.1.so 40196000-40197000 ---p 00157000 08:07 821 /lib/libc-2.12.1.so 40197000-40199000 r--p 00157000 08:07 821 /lib/libc-2.12.1.so 40199000-4019a000 rw-p 00159000 08:07 821 /lib/libc-2.12.1.so 4019a000-4019e000 rw-p 00000000 00:00 0 4019e000-4039e000 r--p 00000000 08:07 262293 /usr/lib/locale/locale-archive 403bc000-403d6000 r-xp 00000000 08:07 885 /lib/libgcc_s.so.1 403d6000-403d7000 r--p 00019000 08:07 885 /lib/libgcc_s.so.1 403d7000-403d8000 rw-p 0001a000 08:07 885 /lib/libgcc_s.so.1 bfb47000-bfb68000 rw-p 00000000 00:00 0 [stack] make[1]: *** [libELFIO.a] Aborted make[1]: *** Deleting file `libELFIO.a' make[1]: Leaving directory `/home/rajat/Documents/Summer_Project/tars/ELFIO-1.0.3/ELFIO' make: *** [all-recursive] Error 1 I urgently need to install the package. Please assist. If this is of any use, I had installed it once before (less than 2 days ago). Trying to build again, is causing a problem. Also, over the two days, I had installed older versions of gcc,glibc, etc (alongwith the latest) as the older versions were needed specifically by another package (crosstool) . |
|
From: Serge Lamikhov-C. <to_...@ho...> - 2001-05-29 00:43:46
|
Hi, ELFIO-0.2.0 released. You can download it from SourceForge by following this link: <http://sourceforge.net/project/showfiles.php?group_id=19959&release_id=37037> or browse Release Notes and ChangeLog by visiting this link: <http://sourceforge.net/project/shownotes.php?release_id=37037> Serge _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. |
|
From: Serge Lamikhov-C. <Ser...@mo...> - 2001-05-19 23:32:02
|
Please see "http://sourceforge.net/projects/elfio/" file releases. Serge |