arm64 fixes:
- Limit the linear region to 51-bit when KVM is running in nVHE mode otherwise, depending on the placement of the ID map, kernel-VA to hyp-VA translations may produce addresses that either conflict with other HYP mappings or generate addresses outside of the 52-bit addressable range. - Instruct kmemleak not to scan the memory reserved for kdump as this range is removed from the kernel linear map and therefore not accessible. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE5RElWfyWxS+3PLO2a9axLQDIXvEFAmE7ldgACgkQa9axLQDI XvEIJRAAm6upVb+1mMtDrCpWBBc24PCfJctJruKpckH10JkfiSHZxPUGGbWH4gx6 1eb9QuVRQ5KwanZp7J/ugqYfQlWH7JQqViV5NPRX7dL/aeR/xvCem1LpcgOMP6XY 0z0LkJAqK6ayxtvhxHnG57SaCbLAE/8Ctok1pPKDOBeXqBlV1tOgpPOA2+PB9Vs6 +r4kspW/tgk4wRIl+xNjOmPxz+Ej6Y7cgzhmVnByqW0Aaer0bTUYcBNgXf0959rG cqZybW1ugdtOP8js1BsUDGJyjF05V77beyC/8h0x5bF/8tfscuxTDfMdbdlCNnpj PG/z3fnoPRzXj4hZkcMdVkwtj1CcarRkgZLIDyIOf7nlBbOlGvWsjV9SK2wsADcq 4pYMT36rv4RXs2bt1ET58a6eFWXTsC31hX+IUaIMRI7BwlJvh4JEekT7DpLvpLvJ 4qdP8KoBPRgm1b5XjRqOF7XBpLoJHSPcLQ6VvatYZcfZaUXyyAfwTpLi7CGqD+Qs rqAtMjLFYZ+vUM8clhAlLsUhAZH1JH6am+qOE8qjUGdKGqFfECv2ViB8PMRgk1MH YxHot6VhemzKre9U7aVjlHBjrxPP/zRhmLzIQ1/SrP6x6kxxF2JUR45NfUMQO810 yPW52qoSSk6P4ld6ka7jDGE0bZE2up2mkO15H6WcgML4dSoBvHQ= =7RDb -----END PGP SIGNATURE----- Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux Pull arm64 fixes from Catalin Marinas: - Limit the linear region to 51-bit when KVM is running in nVHE mode. Otherwise, depending on the placement of the ID map, kernel-VA to hyp-VA translations may produce addresses that either conflict with other HYP mappings or generate addresses outside of the 52-bit addressable range. - Instruct kmemleak not to scan the memory reserved for kdump as this range is removed from the kernel linear map and therefore not accessible. * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: kdump: Skip kmemleak scan reserved memory for kdump arm64: mm: limit linear region to 51 bits for KVM in nVHE mode
This commit is contained in:
Коммит
e99f23c5bf
|
@ -30,6 +30,7 @@
|
|||
#include <linux/crash_dump.h>
|
||||
#include <linux/hugetlb.h>
|
||||
#include <linux/acpi_iort.h>
|
||||
#include <linux/kmemleak.h>
|
||||
|
||||
#include <asm/boot.h>
|
||||
#include <asm/fixmap.h>
|
||||
|
@ -101,6 +102,11 @@ static void __init reserve_crashkernel(void)
|
|||
pr_info("crashkernel reserved: 0x%016llx - 0x%016llx (%lld MB)\n",
|
||||
crash_base, crash_base + crash_size, crash_size >> 20);
|
||||
|
||||
/*
|
||||
* The crashkernel memory will be removed from the kernel linear
|
||||
* map. Inform kmemleak so that it won't try to access it.
|
||||
*/
|
||||
kmemleak_ignore_phys(crash_base);
|
||||
crashk_res.start = crash_base;
|
||||
crashk_res.end = crash_base + crash_size - 1;
|
||||
}
|
||||
|
@ -222,7 +228,21 @@ early_param("mem", early_mem);
|
|||
|
||||
void __init arm64_memblock_init(void)
|
||||
{
|
||||
const s64 linear_region_size = PAGE_END - _PAGE_OFFSET(vabits_actual);
|
||||
s64 linear_region_size = PAGE_END - _PAGE_OFFSET(vabits_actual);
|
||||
|
||||
/*
|
||||
* Corner case: 52-bit VA capable systems running KVM in nVHE mode may
|
||||
* be limited in their ability to support a linear map that exceeds 51
|
||||
* bits of VA space, depending on the placement of the ID map. Given
|
||||
* that the placement of the ID map may be randomized, let's simply
|
||||
* limit the kernel's linear map to 51 bits as well if we detect this
|
||||
* configuration.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_KVM) && vabits_actual == 52 &&
|
||||
is_hyp_mode_available() && !is_kernel_in_hyp_mode()) {
|
||||
pr_info("Capping linear region to 51 bits for KVM in nVHE mode on LVA capable hardware.\n");
|
||||
linear_region_size = min_t(u64, linear_region_size, BIT(51));
|
||||
}
|
||||
|
||||
/* Remove memory above our supported physical address size */
|
||||
memblock_remove(1ULL << PHYS_MASK_SHIFT, ULLONG_MAX);
|
||||
|
|
Загрузка…
Ссылка в новой задаче