[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] don't crash on overflow on hppa64
From: |
Mikulas Patocka |
Subject: |
[PATCH] don't crash on overflow on hppa64 |
Date: |
Wed, 27 Jul 2011 00:53:07 +0200 (CEST) |
User-agent: |
Alpine 2.00 (DEB 1167 2008-08-23) |
Hi
This patch fixes crash that happens if we build too big linux kernel so
that offsets overflow. There are several bugs in elf64-hppa.c:
1. offset is 64-bit, but 32-bit format "%lx" is used. This causes
parameters mismatch
2. eh may be NULL. If it is NULL, I changed the code to print "unknown".
Someone who understands the code better can change it to print something
more descriptive
3. returning bfd_reloc_notsupported causes abort() in
elf64_hppa_relocate_section. Change it to return bfd_reloc_overflow.
With these changes, ld writese error messages on overflow and doesn't
crash anymore.
Mikulas
---
--- bfd/elf64-hppa.c_ 2011-07-26 23:41:27.000000000 +0200
+++ bfd/elf64-hppa.c 2011-07-26 23:57:41.000000000 +0200
@@ -3296,13 +3296,13 @@ elf_hppa_final_link_relocate (Elf_Intern
&& value + addend + max_branch_offset >= 2*max_branch_offset)
{
(*_bfd_error_handler)
- (_("%B(%A+0x%lx): cannot reach %s"),
+ (_("%B(%A+0x%llx): cannot reach %s"),
input_bfd,
input_section,
- offset,
- eh->root.root.string);
+ (unsigned long long)offset,
+ eh ? eh->root.root.string : "unknown");
bfd_set_error (bfd_error_bad_value);
- return bfd_reloc_notsupported;
+ return bfd_reloc_overflow;
}
/* Adjust for any field selectors. */
- [PATCH] don't crash on overflow on hppa64,
Mikulas Patocka <=