1 --- elfutils-0.137/libdwfl/ChangeLog
2 +++ elfutils-0.137/libdwfl/ChangeLog
4 +2008-08-28 Roland McGrath <roland@redhat.com>
6 + * segment.c (reify_segments): Fix last change.
8 +2008-08-27 Roland McGrath <roland@redhat.com>
10 + * linux-proc-maps.c (read_proc_memory): Return 0 for EINVAL or EPERM
11 + failure from pread64.
13 2008-08-26 Roland McGrath <roland@redhat.com>
15 * segment.c (reify_segments): Insert a trailing segment for a module
16 --- elfutils-0.137/libdwfl/linux-proc-maps.c
17 +++ elfutils-0.137/libdwfl/linux-proc-maps.c
18 @@ -267,6 +267,9 @@ read_proc_memory (void *arg, void *data,
20 const int fd = *(const int *) arg;
21 ssize_t nread = pread64 (fd, data, maxread, (off64_t) address);
22 + /* Some kernels don't actually let us do this read, ignore those errors. */
23 + if (nread < 0 && (errno == EINVAL || errno == EPERM))
25 if (nread > 0 && (size_t) nread < minread)
28 --- elfutils-0.137/libdwfl/segment.c
29 +++ elfutils-0.137/libdwfl/segment.c
30 @@ -175,9 +175,17 @@ reify_segments (Dwfl *dwfl)
34 + else if (dwfl->lookup_addr[idx] < start)
36 + /* The module starts past the end of this segment.
38 + if (unlikely (insert (dwfl, idx + 1, start, end, -1)))
43 - if (((size_t) idx + 1 == dwfl->lookup_elts
44 - || end < dwfl->lookup_addr[idx + 1])
45 + if ((size_t) idx + 1 < dwfl->lookup_elts
46 + && end < dwfl->lookup_addr[idx + 1]
47 /* The module ends in the middle of this segment. Split it. */
48 && unlikely (insert (dwfl, idx + 1,
49 end, dwfl->lookup_addr[idx + 1], -1)))
50 --- elfutils-0.137/libelf/ChangeLog
51 +++ elfutils-0.137/libelf/ChangeLog
53 +2008-08-27 Roland McGrath <roland@redhat.com>
55 + * elf_begin.c (get_shnum): Avoid misaligned reads for matching endian.
57 + * libelfP.h [!ALLOW_UNALIGNED] (__libelf_type_align): Fix CLASS index.
59 2008-08-25 Roland McGrath <roland@redhat.com>
61 * Makefile.am (libelf_so_LDLIBS): New variable.
62 --- elfutils-0.137/libelf/elf_begin.c
63 +++ elfutils-0.137/libelf/elf_begin.c
64 @@ -110,8 +110,14 @@ get_shnum (void *map_address, unsigned c
66 bool is32 = e_ident[EI_CLASS] == ELFCLASS32;
70 /* Make the ELF header available. */
71 - if (e_ident[EI_DATA] == MY_ELFDATA)
72 + if (e_ident[EI_DATA] == MY_ELFDATA
74 + || (((size_t) e_ident
75 + & ((is32 ? __alignof__ (Elf32_Ehdr) : __alignof__ (Elf64_Ehdr))
80 @@ -130,8 +136,11 @@ get_shnum (void *map_address, unsigned c
82 memcpy (&ehdr_mem, e_ident, sizeof (Elf32_Ehdr));
84 - CONVERT (ehdr_mem.e32.e_shnum);
85 - CONVERT (ehdr_mem.e32.e_shoff);
86 + if (e_ident[EI_DATA] != MY_ELFDATA)
88 + CONVERT (ehdr_mem.e32.e_shnum);
89 + CONVERT (ehdr_mem.e32.e_shoff);
94 @@ -143,8 +152,11 @@ get_shnum (void *map_address, unsigned c
96 memcpy (&ehdr_mem, e_ident, sizeof (Elf64_Ehdr));
98 - CONVERT (ehdr_mem.e64.e_shnum);
99 - CONVERT (ehdr_mem.e64.e_shoff);
100 + if (e_ident[EI_DATA] != MY_ELFDATA)
102 + CONVERT (ehdr_mem.e64.e_shnum);
103 + CONVERT (ehdr_mem.e64.e_shoff);
108 --- elfutils-0.137/libelf/libelfP.h
109 +++ elfutils-0.137/libelf/libelfP.h
110 @@ -460,7 +460,7 @@ extern const uint_fast8_t __libelf_type_
111 version, binary class, and type. */
112 extern const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] attribute_hidden;
113 # define __libelf_type_align(class, type) \
114 - (__libelf_type_aligns[LIBELF_EV_IDX][class][type] ?: 1)
115 + (__libelf_type_aligns[LIBELF_EV_IDX][class - 1][type] ?: 1)
117 # define __libelf_type_align(class, type) 1