Re: Elf64_Phdr

2019-06-27 Thread Mark Wielaard
On Wed, 2019-06-26 at 20:01 +, Sasha Da Rocha Pinheiro wrote: > So, I need to write an elf file. I have an open Elf * handle with > read only permission. I then need to update the program headers and > next add a new program header entry. > For that we create an Elf * handle with write permissi

Re: Elf64_Phdr

2019-06-27 Thread Mark Wielaard
On Tue, 2019-06-25 at 22:09 +, Sasha Da Rocha Pinheiro wrote: > > What happens if I call elf64_newphdr() on the same Elf * but with > different size_t __cnt? It creates a new phdr table for the Elf with cnt entries, whether or not the phdr table existed or not. If cnt is zero any existing

Re: Elf64_Phdr

2019-06-26 Thread Sasha Da Rocha Pinheiro
utils-devel@sourceware.org Subject: Re: Elf64_Phdr    What happens if I call elf64_newphdr() on the same Elf * but with different size_t __cnt?  What happens to the previous headers?      Sasha      From: Mark Wielaard  Sent: Tuesday, June 25, 2019 12:56:04 AM  To: Sasha Da Rocha Pinheir

Re: Elf64_Phdr

2019-06-25 Thread Sasha Da Rocha Pinheiro
Subject: Re: Elf64_Phdr   On Tue, 2019-06-25 at 05:22 +, Sasha Da Rocha Pinheiro wrote: >   Oh, of course, that might be it. >    >  Do you know if when it's open with write permission, changes will be > mapped back to the file? That depends on whether it is

Re: Elf64_Phdr

2019-06-24 Thread Mark Wielaard
On Tue, 2019-06-25 at 05:22 +, Sasha Da Rocha Pinheiro wrote: > Oh, of course, that might be it. > > Do you know if when it's open with write permission, changes will be > mapped back to the file? That depends on whether it is opened with mmap MAP_PRIVATE (ELF_C_READ_MMAP_PRIVATE,) or

Re: Elf64_Phdr

2019-06-24 Thread Sasha Da Rocha Pinheiro
Oh, of course, that might be it. Do you know if when it's open with write permission, changes will be mapped back to the file? Thanks, Sasha From: Frank Ch. Eigler Sent: Monday, June 24, 5:06 PM Subject: Re: Elf64_Phdr To: Sasha Da Rocha Pinheiro

Re: Elf64_Phdr

2019-06-24 Thread Frank Ch. Eigler
Hi - > If I have a Elf64_Phdr, why can't I straight change its elements, like, I'm > getting seg fault when trying to do: > (see gdb output) > > ... received signal SIGSEGV, Segmentation fault. > ... > 957 oldPhdr->p_vaddr = 0x1235; > (gdb) p/x oldPhdr > $11 = 0x3ffb4bf0040 The elf_begin(