Re: [PATCH 5/5] Use seek+read instead of pread to read from /dev/$$/mem files.

2015-10-05 Thread Mark Wielaard
On Mon, Oct 05, 2015 at 05:36:34PM +0200, Jose E. Marchesi wrote: > pread[64] always returns EINVAL when negative offsets are used. > read+seek allows us to read in-memory vdso objects mapped high in the > address space. Nice find. > { >const int fd = *(const int *) arg; > - ssize_t nread

Re: [PATCH 4/5] sparc: fix the extraction of relocation IDs from r_type fields.

2015-10-05 Thread Mark Wielaard
On Mon, Oct 05, 2015 at 05:36:33PM +0200, Jose E. Marchesi wrote: > This patch adds support for a RELOC_TYPE_ID transform macros that > backends can use before including common-reloc.c. The sparc backend > uses this in order to extract the relocation IDs from r_type fields. > In this target the mo

Re: [PATCH 3/5] sparc: add some missing relocation types.

2015-10-05 Thread Mark Wielaard
On Mon, Oct 05, 2015 at 05:36:32PM +0200, Jose E. Marchesi wrote: > This adds three missing relocation types in sparc targets: WDISP10, > JMP_IREL and IRELATIVE. Thanks, pushed to master.

Re: [PATCH 2/5] sparc: support for the check_object_attribute ebl hook.

2015-10-05 Thread Mark Wielaard
On Mon, Oct 05, 2015 at 05:36:31PM +0200, Jose E. Marchesi wrote: > This makes elfutils based utilities to be aware of the ELF attribute > tags defined in sparc targets. Are the hwcap values specified somewhere? If so it would be good to add an URL to the specification. > +bool > +sparc_check_obj

Re: [PATCH 1/5] Use -fPIC instead of -fpic when generating PIC code.

2015-10-05 Thread Jose E. Marchesi
> This avoids relocation overflows in sparc/sparc64 targets while > linking, where the reachable data using -fpic is only 4kb. I think this is OK. -fpic/-fPIC only changes things on m68k, PowerPC and SPARC. So the only other arch we currently support that this might impa

Re: [PATCH 1/5] Use -fPIC instead of -fpic when generating PIC code.

2015-10-05 Thread Mark Wielaard
On Mon, Oct 05, 2015 at 05:36:30PM +0200, Jose E. Marchesi wrote: > This avoids relocation overflows in sparc/sparc64 targets while > linking, where the reachable data using -fpic is only 4kb. I think this is OK. -fpic/-fPIC only changes things on m68k, PowerPC and SPARC. So the only other arch

Re: [PATCH] Do without union of variable length arrays.

2015-10-05 Thread Chih-hung Hsieh
Please review attached 0006*patch with the new changed I mentioned previously. Thanks. On Mon, Oct 5, 2015 at 12:04 PM, Chih-hung Hsieh wrote: > I will prepare a new patch with the suggested changes: > > (a) more efficient overflow check like > if (num > SIZE_MAX / elem_size) > > (b) r

Re: [PATCH] unstrip: Update sh_info when SH_INFO_LINK_P, not just when SHF_INFO_LINK set.

2015-10-05 Thread Mark Wielaard
On Fri, Oct 02, 2015 at 11:05:28AM -0700, Roland McGrath wrote: > OK Thanks. Pushed to master.

Re: [PATCH] Handle merged strtab/shstrtab string tables in strip and unstrip.

2015-10-05 Thread Mark Wielaard
On Fri, Oct 02, 2015 at 11:05:06AM -0700, Roland McGrath wrote: > The description sounds sensible but I have not tried to follow the code. Thanks, pushed to master. The logic changes to the code aren't too deep. They really just depend on the change tracking already being correct and just add the

Re: [PATCH] libelf: Always update e_version and e_shentsize in elf_update.

2015-10-05 Thread Mark Wielaard
On Tue, Sep 29, 2015 at 05:13:30PM +0200, Mark Wielaard wrote: > When e_version is EV_NONE we should set it to EV_CURRENT like we do for > the EI_VERSION and like we set EI_DATA to the correct byte order when set > to ELFDATANONE. Likewise we should always set e_shentsize like we do for > e_phents

Re: [PATCH] Do without union of variable length arrays.

2015-10-05 Thread Chih-hung Hsieh
I will prepare a new patch with the suggested changes: (a) more efficient overflow check like if (num > SIZE_MAX / elem_size) (b) replacing union of VLA with pointers to arrays like void *data = malloc (...); T32 (*a32)[n] = data; T64 (*a64)[n] = data; Please f

Re: [PATCH] Do without union of variable length arrays.

2015-10-05 Thread Mark Wielaard
On Fri, Oct 02, 2015 at 04:17:43PM +0200, Florian Weimer wrote: > On 09/08/2015 11:08 PM, Chih-Hung Hsieh wrote: > > +void *phdrs = malloc (phnum * sizeof (phdr_u)); > > If you change this code anyway, it's sensible to check for integer > overflow in the size computation. This is now done in

Re: [PATCH] Do without union of variable length arrays.

2015-10-05 Thread Mark Wielaard
On Fri, Oct 02, 2015 at 12:10:47AM +0300, Alexander Cherepanov wrote: > On 2015-09-16 18:25, Mark Wielaard wrote: > >On Fri, 2015-09-11 at 12:22 -0700, Roland McGrath wrote: > >>It looks fine to me from a quick skim, but Mark should review and test it > >>too. > > > >I am not super enthusiastic ab

Re: [PATCH] Do without union of variable length arrays.

2015-10-05 Thread Mark Wielaard
On 01.10.2015 23:45, Alexander Cherepanov wrote: >On 2015-09-17 12:40, Mark Wielaard wrote: >>>* Now const size_t is used instead of const int for malloc argument >>>type. >> >>Thanks. I am still interested in the overflow issue. I believe since we >>are using unsigned arithmetic and we know the si

[PATCH] Improve AM_SILENT_RULES coverage

2015-10-05 Thread Josh Stone
Note, elfutils does not explicitly enable AM_SILENT_RULES. It's only available starting from automake 1.11, but starting from automake 1.13 silent rules are always generated, defaulting to verbose. $(AM_V_foo) additions should be no-ops on systems that don't support silent rules. To be silent, u

[PATCH] libelf: Only use posix_fallocate when using mmap. Ignore unsupported errno.

2015-10-05 Thread Mark Wielaard
When not using mmap it is enough the just ftruncate the file to the right size. pwrite will report an error if there is no disk space left. And on file systems that don't support fallocate it might duplicate writes. When using posix_fallocate do ignore errors indicating the file system doesn't supp

[PATCH 2/5] sparc: support for the check_object_attribute ebl hook.

2015-10-05 Thread Jose E. Marchesi
This makes elfutils based utilities to be aware of the ELF attribute tags defined in sparc targets. Signed-off-by: Jose E. Marchesi --- backends/ChangeLog | 6 backends/Makefile.am | 2 +- backends/sparc_attrs.c | 75 ++ backends/sparc

[PATCH 4/5] sparc: fix the extraction of relocation IDs from r_type fields.

2015-10-05 Thread Jose E. Marchesi
This patch adds support for a RELOC_TYPE_ID transform macros that backends can use before including common-reloc.c. The sparc backend uses this in order to extract the relocation IDs from r_type fields. In this target the most significative 24 bits of r_type are used to store an additional addend

[PATCH 0/5] A few sparc fixes

2015-10-05 Thread Jose E. Marchesi
Hello. This small patch series fixes several issues in sparc-*-* and sparc64-*-* targets. Jose E. Marchesi (5): Use -fPIC instead of -fpic when generating PIC code. sparc: support for the check_object_attribute ebl hook. sparc: add some missing relocation types. sparc: fix the extraction

[PATCH 5/5] Use seek+read instead of pread to read from /dev/$$/mem files.

2015-10-05 Thread Jose E. Marchesi
pread[64] always returns EINVAL when negative offsets are used. read+seek allows us to read in-memory vdso objects mapped high in the address space. Signed-off-by: Jose E. Marchesi --- libdwfl/ChangeLog | 5 + libdwfl/linux-proc-maps.c | 14 -- 2 files changed, 17 insert

[PATCH 3/5] sparc: add some missing relocation types.

2015-10-05 Thread Jose E. Marchesi
This adds three missing relocation types in sparc targets: WDISP10, JMP_IREL and IRELATIVE. Signed-off-by: Jose E. Marchesi --- backends/ChangeLog | 5 + backends/sparc_reloc.def | 3 +++ 2 files changed, 8 insertions(+) diff --git a/backends/ChangeLog b/backends/ChangeLog index b5e19

[PATCH 1/5] Use -fPIC instead of -fpic when generating PIC code.

2015-10-05 Thread Jose E. Marchesi
This avoids relocation overflows in sparc/sparc64 targets while linking, where the reachable data using -fpic is only 4kb. Signed-off-by: Jose E. Marchesi --- ChangeLog | 5 + config/ChangeLog | 5 + config/eu.am | 4 ++-- configure.ac | 2 +- lib/ChangeLog |

Re: [PATCH] Move 4 libdwfl nested functions.

2015-10-05 Thread Mark Wielaard
On Fri, 2015-09-18 at 11:25 -0700, Chih-Hung Hsieh wrote: > Now they should compile with clang. > > Used local variables are passed to new file scope functions > as constant parameters, or pointers, or embedded in a > 'state' structure. > > One simple function "report" is changed to a macro. > It