Project

General

Profile

Actions

Bug #7704

closed

loader: Fix EFI self relocation code for rela architectures

Added by Toomas Soome over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
bootloader
Start date:
2016-12-29
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

Update from FreeBSD:

MFC r306812 (andrew):

The bootloader self relocation code was slightly wrong for the
R_AARCH64_RELATIVE relocation found on arm64. It would try to add the
contents of the memory location being relocated to the base address and
the relocation addend. This worked when the contents was zero, however
this now seems to be set to the value of the addend so we add this twice.
Fix this by just setting the memory to the computed value.

MFC r309360: EFI loaders: parse rela relocations on amd64

Prior to this change the loader self relocation code interpreted amd64's
rela relocations as if they were rel relocations, discarding the addend.
This "works" because GNU ld 2.17.50 stores the addend value in both the
r_addend field of the relocation (as expected) and at the target of the
relocation.

Other linkers, and possibly other versions of GNU ld, won't have this
behaviour, so interpret the relocations correctly.

https://svnweb.freebsd.org/base?view=revision&revision=310725

Actions #1

Updated by Electric Monk over 5 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 066242363458fbf87291daff9454b6f2ac9ebd8b

commit  066242363458fbf87291daff9454b6f2ac9ebd8b
Author: Toomas Soome <tsoome@me.com>
Date:   2017-01-03T21:59:04.000Z

    7704 loader: Fix EFI self relocation code for rela architectures
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Actions

Also available in: Atom PDF