* grub-core/kern/ia64/dl.c (grub_arch_dl_relocate_symbols): Add checks
for relocation range.
This commit is contained in:
parent
979742bc7e
commit
30d0053799
2 changed files with 14 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-12-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/kern/ia64/dl.c (grub_arch_dl_relocate_symbols): Add checks
|
||||||
|
for relocation range.
|
||||||
|
|
||||||
2013-12-11 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-12-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/ia64/dl.c (grub_arch_dl_relocate_symbols): Handle
|
* grub-core/kern/ia64/dl.c (grub_arch_dl_relocate_symbols): Handle
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <grub/ia64/reloc.h>
|
#include <grub/ia64/reloc.h>
|
||||||
|
|
||||||
#define MASK19 ((1 << 19) - 1)
|
#define MASK19 ((1 << 19) - 1)
|
||||||
|
#define MASK20 ((1 << 20) - 1)
|
||||||
|
|
||||||
/* Check if EHDR is a valid ELF header. */
|
/* Check if EHDR is a valid ELF header. */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
|
@ -104,6 +105,10 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
*(grub_uint64_t *) addr += value - addr;
|
*(grub_uint64_t *) addr += value - addr;
|
||||||
break;
|
break;
|
||||||
case R_IA64_GPREL22:
|
case R_IA64_GPREL22:
|
||||||
|
if ((value - (grub_addr_t) mod->base) & ~MASK20)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"gprel offset too big (%lx)",
|
||||||
|
value - (grub_addr_t) mod->base);
|
||||||
grub_ia64_add_value_to_slot_21 (addr, value - (grub_addr_t) mod->base);
|
grub_ia64_add_value_to_slot_21 (addr, value - (grub_addr_t) mod->base);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -115,6 +120,10 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||||
{
|
{
|
||||||
grub_uint64_t *gpptr = mod->gotptr;
|
grub_uint64_t *gpptr = mod->gotptr;
|
||||||
*gpptr = value;
|
*gpptr = value;
|
||||||
|
if (((grub_addr_t) gpptr - (grub_addr_t) mod->base) & ~MASK20)
|
||||||
|
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||||
|
"gprel offset too big (%lx)",
|
||||||
|
(grub_addr_t) gpptr - (grub_addr_t) mod->base);
|
||||||
grub_ia64_add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) mod->base);
|
grub_ia64_add_value_to_slot_21 (addr, (grub_addr_t) gpptr - (grub_addr_t) mod->base);
|
||||||
mod->gotptr = gpptr + 1;
|
mod->gotptr = gpptr + 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue