]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 8650/1: module: handle negative R_ARM_PREL31 addends correctly
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 30 Jan 2017 17:29:28 +0000 (18:29 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Tue, 28 Feb 2017 11:06:15 +0000 (11:06 +0000)
commit1702c3dbd1f766c01531c7b52dd9ca4982508cba
tree3838ef2e90645c428ba3d35bb989f1d18f3eff61
parent8ddb6cd2bdd2b80ccbc6cba629ddb38e06dafb74
ARM: 8650/1: module: handle negative R_ARM_PREL31 addends correctly

According to the spec 'ELF for the ARM Architecture' (IHI 0044E),
addends for R_ARM_PREL31 relocations are 31-bit signed quantities,
so we need to sign extend the value to 32 bits before it can be used
as an offset in the calculation of the relocated value.

We have not been bitten by this because these relocations are usually
emitted against the start of a section, which means the addends never
assume negative values in practice. But it is a bug nonetheless, so fix
it.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/kernel/module.c