forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s390/kprobes: move insn_page to text segment
Move the in-kernel kprobes insn page to text segment. Rationale: having that page in rw data segment is suboptimal, since as soon as a kprobe is set, this will split the 1:1 kernel mapping for a single page which get new permissions. Note: there is always at least one kprobe present for the kretprobe trampoline; so the mapping will always be split into smaller 4k mappings because of this. Moving the kprobes insn page into text segment makes sure that the page is mapped RO/X in any case, and avoids that the 1:1 mapping is split. The kprobe insn_page is defined as a dummy function which is filled with "br %r14" instructions. Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
- Loading branch information
Showing
4 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#include <linux/linkage.h> | ||
|
||
/* | ||
* insn_page is a special 4k aligned dummy function for kprobes. | ||
* It will contain all kprobed instructions that are out-of-line executed. | ||
* The page must be within the kernel image to guarantee that the | ||
* out-of-line instructions are within 2GB distance of their original | ||
* location. Using a dummy function ensures that the insn_page is within | ||
* the text section of the kernel and mapped read-only/executable from | ||
* the beginning on, thus avoiding to split large mappings if the page | ||
* would be in the data section instead. | ||
*/ | ||
.section .kprobes.text, "ax" | ||
.align 4096 | ||
ENTRY(kprobes_insn_page) | ||
.rept 2048 | ||
.word 0x07fe | ||
.endr | ||
ENDPROC(kprobes_insn_page) | ||
.previous |