Unverified Commit 9c0286bc authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6238 [sync] PR-6186: Fixed CVE-2023-52504

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/6186 
 
PR sync from: Zheng Zengkai <zhengzengkai@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/TUT7U6RMB6GQGVECVSIMCDAW2WBJCHGJ/ 
Considering that CONFIG_X86_5LEVEL is enabled in openEuler 5.10,
Backport patch from 5.10.199 LTS to fix CVE-2023-52504.

https://nvd.nist.gov/vuln/detail/CVE-2023-52504

Kirill A. Shutemov (1):
  x86/alternatives: Disable KASAN in apply_alternatives()


-- 
2.20.1
 
https://gitee.com/src-openeuler/kernel/issues/I95AT0 
 
Link:https://gitee.com/openeuler/kernel/pulls/6238

 

Reviewed-by: default avatarWei Li <liwei391@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents d04190e7 126cf4b9
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -424,6 +424,17 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
	u8 insn_buff[MAX_PATCH_LEN];

	DPRINTK("alt table %px, -> %px", start, end);

	/*
	 * In the case CONFIG_X86_5LEVEL=y, KASAN_SHADOW_START is defined using
	 * cpu_feature_enabled(X86_FEATURE_LA57) and is therefore patched here.
	 * During the process, KASAN becomes confused seeing partial LA57
	 * conversion and triggers a false-positive out-of-bound report.
	 *
	 * Disable KASAN until the patching is complete.
	 */
	kasan_disable_current();

	/*
	 * The scan order should be from start to end. A later scanned
	 * alternative code can overwrite previously scanned alternative code.
@@ -491,6 +502,8 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
next:
		optimize_nops(instr, a->instrlen);
	}

	kasan_enable_current();
}

#if defined(CONFIG_RETPOLINE) && defined(CONFIG_STACK_VALIDATION)