GNU bug report logs -
#20614
Segmentation fault when building on Power8 Little Endian
Previous Next
Reported by: Petr Hracek <phracek <at> redhat.com>
Date: Wed, 20 May 2015 07:59:01 UTC
Severity: important
Tags: patch
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #144 received at 20614 <at> debbugs.gnu.org (full text, mbox):
On 10/05/2015 11:39 AM, Eli Zaretskii wrote:
>> Cc: 20614 <at> debbugs.gnu.org
>> From: Petr Hracek <phracek <at> redhat.com>
>> Date: Mon, 5 Oct 2015 11:16:32 +0200
>>
>> (gdb) p old_section_names + NEW_SECTION_H (nn).sh_name
>> $2 = 0x4000128ceb51 <Address 0x4000128ceb51 out of bounds>
> We have a function valid_pointer_p in alloc.c. What happens if you
> use the same code in unexec, before the series of calls to strcmp that
> crash, and only proceed to call strcmp if valid_pointer_p returns a
> positive value?
I have no problem to do it.
I have made a this patch against emacs-24.3
diff --git a/src/unexelf.c b/src/unexelf.c
index d365940..677a1af 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -389,6 +389,7 @@ temacs:
#include <unexec.h>
extern void fatal (const char *msgid, ...);
+extern int valid_pointer_p (void *);
#include <sys/types.h>
#include <stdint.h>
@@ -845,8 +846,7 @@ unexec (const char *new_name, const char *old_name)
ElfW (Word) alignment = (NEW_PROGRAM_H (n)).p_align;
if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment)
alignment = OLD_SECTION_H (old_bss_index).sh_addralign;
-
-#ifdef __sgi
+#if defined __sgi || defined __powerpc64__
/* According to r02kar <at> x4u2.desy.de (Karsten Kuenne)
and oliva <at> gnu.org (Alexandre Oliva), on IRIX 5.2, we
always get "Program segment above .bss" when dumping
@@ -866,8 +866,10 @@ unexec (const char *new_name, const char *old_name)
== round_up (old_bss_addr, alignment)))
break;
}
+#ifndef __powerpc64__
if (n < 0)
fatal ("Couldn't find segment next to .bss in %s\n", old_name, 0);
+#endif
/* Make sure that the size includes any padding before the old .bss
section. */
@@ -1251,6 +1253,12 @@ temacs:
be no harm in that provided that r_offset is always the first
member. */
nn = section.sh_info;
+ valid_pointer_p (old_section_names + NEW_SECTION_H (nn).sh_name);
if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name,
".data")
|| !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name),
".sdata")
But if fails with
/home/phracek/rpmbuild/BUILD/emacs-24.3/src/unexelf.c:1263: undefined
reference to `valid_pointer_p'
collect2: error: ld returned 1 exit status
make[2]: *** [temacs] Error 1
make[2]: Leaving directory `/home/phracek/rpmbuild/BUILD/emacs-24.3/src'
make[1]: *** [src] Error 2
make[1]: Leaving directory `/home/phracek/rpmbuild/BUILD/emacs-24.3'
make: *** [bootstrap] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.QoDw34 (%build)
--
Petr Hracek
Software Engineer
Developer Experience
Red Hat, Inc
Mob: +420777056169
email: phracek <at> redhat.com
This bug report was last modified 9 years and 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.