![]() |
|
Can you expand the size of a section in ELF? - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: C, C++, & Obj-C (https://sinister.li/Forum-C-C-Obj-C) +--- Thread: Can you expand the size of a section in ELF? (/Thread-Can-you-expand-the-size-of-a-section-in-ELF) |
Can you expand the size of a section in ELF? - Cr3aTor - 10-16-2018 Hello everybody, I studied a time ago the ELF file format and now I got back into it. The question that raises in my head is the next: Can you make a section larger than it is (e.g the .text section). I know that it might be some ways around this but I'm not pretty sure how to do it. I think that this kind of operation against a binary can be really tedious, and probably I'm going to need to recompile it or patch it. Because if I change something directly in memory without repatching some offsets, sizes, etc. the sections will not be loaded correctly by the loader. The main goal is to do all of this by mapping the binary in memory with a C++ program, increase the size of the .text section, and repatch the stuff needed so the binary can run normally. Any help, ideas, clarification or discussion on this subject will be much appreciated. Cheers ! RE: Can you expand the size of a section in ELF? - sunjester - 12-30-2018 LD_PRELOAD at runtime? https://www.youtube.com/watch?v=iFXUnCGIrcc RE: Can you expand the size of a section in ELF? - Cr3aTor - 12-30-2018 (12-30-2018, 05:15 PM)sunjester Wrote: LD_PRELOAD at runtime?Not really I was wondering if you can change the size of a section (e.g .data, .text) dynamically. Let's say the .text section has a size of 1024 bytes and I want to increase that to 2048 bytes dynamically. Therefore, I think I need to repatch the binary somehow because if I only change that in the ELF header the loader will get confused. |