]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: KASLR: Correct valid bits in apply_r_mips_26_rel()
authorJinyang He <hejinyang@loongson.cn>
Wed, 25 Nov 2020 10:07:18 +0000 (18:07 +0800)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Fri, 27 Nov 2020 09:19:12 +0000 (10:19 +0100)
commitda8e02955287885684c3f28303f8d2f34fb2d270
tree948869d60c1ad0024b8a4bbe6260782b7346b7e1
parentaf52384945d1fda7caccd1bf4cebfbb854b8d71d
MIPS: KASLR: Correct valid bits in apply_r_mips_26_rel()

Apply_r_mips_26_rel() relocates instructions like j, jal and etc. These
instructions consist of 6bits function field and 26bits address field.
The value of target_addr as follows,
=================================================================
|     high 4bits           |            low 28bits              |
=================================================================
|the high 4bits of this PC | the low 26bits of instructions << 2|
=================================================================
Thus, loc_orig and log_new both need high 4bits rather than high 6bits.

Signed-off-by: Jinyang He <hejinyang@loongson.cn>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/kernel/relocate.c