powerpc/64/module: REL32 relocation range check
authorNicholas Piggin <npiggin@gmail.com>
Wed, 29 Aug 2018 11:56:56 +0000 (21:56 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 20 Oct 2018 02:26:47 +0000 (13:26 +1100)
commitb851ba02a6f3075f0f99c60c4bc30a4af80cf428
tree249ea33c51fff3d0220c994c2e7f2e883e9e017f
parentdd76ff5af35350fd6d5bb5b069e73b6017f66893
powerpc/64/module: REL32 relocation range check

The recent module relocation overflow crash demonstrated that we
have no range checking on REL32 relative relocations. This patch
implements a basic check, the same kernel that previously oopsed
and rebooted now continues with some of these errors when loading
the module:

  module_64: x_tables: REL32 527703503449812 out of range!

Possibly other relocations (ADDR32, REL16, TOC16, etc.) should also have
overflow checks.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/module_64.c