lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <a7a35416ddab4b42617e2c81fe5816c7f8d0c63f.1632558672.git.christophe.leroy@csgroup.eu> Date: Sat, 25 Sep 2021 10:31:42 +0200 From: Christophe Leroy <christophe.leroy@...roup.eu> To: Benjamin Herrenschmidt <benh@...nel.crashing.org>, Paul Mackerras <paulus@...ba.org>, Michael Ellerman <mpe@...erman.id.au> Cc: Christophe Leroy <christophe.leroy@...roup.eu>, linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org, Michael Neuling <mikey@...ling.org> Subject: [PATCH v2 1/3] powerpc/code-patching: Improve verification of patchability Today, patch_instruction() assumes that is called exclusively on valid addresses, and only checks that it is not called on an init address after init section has been freed. Improve verification by calling kernel_text_address() instead. kernel_text_address() already includes a verification of initmem release. Cc: Michael Neuling <mikey@...ling.org> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu> --- arch/powerpc/lib/code-patching.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c index f9a3019e37b4..20ec6648aacc 100644 --- a/arch/powerpc/lib/code-patching.c +++ b/arch/powerpc/lib/code-patching.c @@ -190,10 +190,9 @@ static int do_patch_instruction(u32 *addr, struct ppc_inst instr) int patch_instruction(u32 *addr, struct ppc_inst instr) { /* Make sure we aren't patching a freed init section */ - if (init_mem_is_free && init_section_contains(addr, 4)) { - pr_debug("Skipping init section patching addr: 0x%px\n", addr); + if (!kernel_text_address((unsigned long)addr)) return 0; - } + return do_patch_instruction(addr, instr); } NOKPROBE_SYMBOL(patch_instruction); -- 2.31.1
Powered by blists - more mailing lists