mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
arm64: kprobes: check the return value of set_memory_rox()
[ Upstream commit0ec364c0c9] Since commita166563e7e("arm64: mm: support large block mapping when rodata=full"), __change_memory_common has more chance to fail due to memory allocation failure when splitting page table. So check the return value of set_memory_rox(), then bail out if it fails otherwise we may have RW memory mapping for kprobes insn page. Fixes:195a1b7d83("arm64: kprobes: call set_memory_rox() for kprobe page") Reviewed-by: Ryan Roberts <ryan.roberts@arm.com> Reviewed-by: Dev Jain <dev.jain@arm.com> Signed-off-by: Yang Shi <yang@os.amperecomputing.com> Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ccd8af5791
commit
87f2e9ee9d
@@ -49,7 +49,10 @@ void *alloc_insn_page(void)
|
|||||||
addr = execmem_alloc(EXECMEM_KPROBES, PAGE_SIZE);
|
addr = execmem_alloc(EXECMEM_KPROBES, PAGE_SIZE);
|
||||||
if (!addr)
|
if (!addr)
|
||||||
return NULL;
|
return NULL;
|
||||||
set_memory_rox((unsigned long)addr, 1);
|
if (set_memory_rox((unsigned long)addr, 1)) {
|
||||||
|
execmem_free(addr);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user