[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] [PATCH] Check mapped ELF file headers

From: Zach Welch
Subject: Re: [Libunwind-devel] [PATCH] Check mapped ELF file headers
Date: Mon, 29 Nov 2010 20:00:08 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20101026 Lightning/1.0b3pre Thunderbird/3.1.5

On 11/29/2010 11:13 AM, Arun Sharma wrote:
> On Wed, Nov 17, 2010 at 9:14 PM, Zachary T Welch
> <address@hidden> wrote:
>> +  ehdr = ei->image;
>> +  if (strncmp(ehdr->e_ident, "\x7f" "ELF", 4) != 0)
>> +    return -1;
> This seems to cause a lot of compiler warnings that look like:
> ./elfxx.h: In function ‘elf_map_image’:
> ./elfxx.h:70: warning: pointer targets in passing argument 1 of
> ‘strlen’ differ in signedness
> /usr/include/string.h:397: note: expected ‘const char *’ but argument
> is of type ‘unsigned char *’

Oops! I somehow sent the wrong version of the patch and didn't notice.
Since I have continued to dig around the code, I revisited this patch
again today and made some additional improvements.

First, I improved _UelfXX_valid_object() to add the ELF header version
check therein; then, I made elf_map_image() call it. As a consequence of
this second change, elf_map_image() needed to be moved out-of-line,
because test-setjmp failed to resolve the newly added call to
valid_object() when linking against However, the
occurrence of a link failure seems to demonstrate that the compiler
previously was ignoring the inline directive, so I expect this change
makes no real difference.

I will send these changes as a new series momentarily.

Zach Welch
(650) 331-3385 x743

reply via email to

[Prev in Thread] Current Thread [Next in Thread]