Commit 3091f5fc authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc: Mark .opd section read-only

.opd section contains function descriptors used to locate
functions in the kernel. If someone is able to modify a
function descriptor he will be able to run arbitrary
kernel function instead of another.

To avoid that, move .opd section inside read-only memory.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/3cd40b682fb6f75bb40947b55ca0bac20cb3f995.1634136222.git.christophe.leroy@csgroup.eu
parent 8f6aca0e
...@@ -143,6 +143,12 @@ SECTIONS ...@@ -143,6 +143,12 @@ SECTIONS
SOFT_MASK_TABLE(8) SOFT_MASK_TABLE(8)
RESTART_TABLE(8) RESTART_TABLE(8)
.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
__start_opd = .;
KEEP(*(.opd))
__end_opd = .;
}
. = ALIGN(8); . = ALIGN(8);
__stf_entry_barrier_fixup : AT(ADDR(__stf_entry_barrier_fixup) - LOAD_OFFSET) { __stf_entry_barrier_fixup : AT(ADDR(__stf_entry_barrier_fixup) - LOAD_OFFSET) {
__start___stf_entry_barrier_fixup = .; __start___stf_entry_barrier_fixup = .;
...@@ -339,12 +345,6 @@ SECTIONS ...@@ -339,12 +345,6 @@ SECTIONS
*(.branch_lt) *(.branch_lt)
} }
.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
__start_opd = .;
KEEP(*(.opd))
__end_opd = .;
}
. = ALIGN(256); . = ALIGN(256);
.got : AT(ADDR(.got) - LOAD_OFFSET) { .got : AT(ADDR(.got) - LOAD_OFFSET) {
__toc_start = .; __toc_start = .;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment