staticvoid reset_tod_clock(void)
{ union tod_clock clk;
if (store_tod_clock_ext_cc(&clk) == 0) return; /* TOD clock not running. Set the clock to Unix Epoch. */ if (set_tod_clock(TOD_UNIX_EPOCH) || store_tod_clock_ext_cc(&clk))
disabled_wait();
memset(&tod_clock_base, 0, sizeof(tod_clock_base));
tod_clock_base.tod = TOD_UNIX_EPOCH;
get_lowcore()->last_update_clock = TOD_UNIX_EPOCH;
}
/* * Adjust GOT entries, except for ones for undefined weak symbols * that resolved to zero. This also skips the first three reserved * entries on s390x that are zero.
*/ for (entry = (u64 *)vmlinux.got_start; entry < (u64 *)vmlinux.got_end; entry++) { if (*entry)
*entry += offset;
}
}
/* * Merge information from several sources into a single ident_map_size value. * "ident_map_size" represents the upper limit of physical memory we may ever * reach. It might not be all online memory, but also include standby (offline) * memory or memory areas reserved for other means (e.g., memory devices such as * virtio-mem). * * "ident_map_size" could be lower then actual standby/reserved or even online * memory present, due to limiting factors. We should never go above this limit. * It is the size of our identity mapping. * * Consider the following factors: * 1. max_physmem_end - end of physical memory online, standby or reserved. * Always >= end of the last online memory range (get_physmem_online_end()). * 2. CONFIG_MAX_PHYSMEM_BITS - the maximum size of physical memory the * kernel is able to support. * 3. "mem=" kernel command line option which limits physical memory usage. * 4. OLDMEM_BASE which is a kdump memory limit when the kernel is executed as * crash kernel. * 5. "hsa" size which is a memory limit when the kernel is executed during * zfcp/nvme dump.
*/ staticvoid setup_ident_map_size(unsignedlong max_physmem_end)
{ unsignedlong hsa_size;
/* * Forcing modules and vmalloc area under the ultravisor * secure storage limit, so that any vmalloc allocation * we do could be used to back secure guest storage. * * Assume the secure storage limit always exceeds _REGION2_SIZE, * otherwise asce_limit and rte_size would have been adjusted.
*/
vmax = adjust_to_uv_max(asce_limit);
boot_debug("%d level paging 0x%016lx vmax\n", vmax == _REGION1_SIZE ? 4 : 3, vmax); #ifdef CONFIG_KASAN
BUILD_BUG_ON(__NO_KASLR_END_KERNEL > KASAN_SHADOW_START);
boot_debug("KASAN shadow area: 0x%016lx-0x%016lx\n", KASAN_SHADOW_START, KASAN_SHADOW_END); /* force vmalloc and modules below kasan shadow */
vmax = min(vmax, KASAN_SHADOW_START); #endif
vsize = min(vsize, vmax); if (kaslr_enabled()) { unsignedlong kernel_end, kaslr_len, slots, pos;
/* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */
vsize = (VMALLOC_END - FIXMAP_SIZE) / 2;
vsize = round_down(vsize, _SEGMENT_SIZE);
vmalloc_size = min(vmalloc_size, vsize); if (IS_ENABLED(CONFIG_KMSAN)) { /* take 2/3 of vmalloc area for KMSAN shadow and origins */
vmalloc_size = round_down(vmalloc_size / 3, _SEGMENT_SIZE);
VMALLOC_END -= vmalloc_size * 2;
}
VMALLOC_START = VMALLOC_END - vmalloc_size;
boot_debug("vmalloc area: 0x%016lx-0x%016lx\n", VMALLOC_START, VMALLOC_END);
/* split remaining virtual space between 1:1 mapping & vmemmap array */
pages = __abs_lowcore / (PAGE_SIZE + sizeof(struct page));
pages = SECTION_ALIGN_UP(pages); /* keep vmemmap_start aligned to a top level region table entry */
vmemmap_start = round_down(__abs_lowcore - pages * sizeof(struct page), rte_size); /* make sure identity map doesn't overlay with vmemmap */
ident_map_size = min(ident_map_size, vmemmap_start);
vmemmap_size = SECTION_ALIGN_UP(ident_map_size / PAGE_SIZE) * sizeof(struct page); /* make sure vmemmap doesn't overlay with absolute lowcore area */ if (vmemmap_start + vmemmap_size > __abs_lowcore) {
vmemmap_size = SECTION_ALIGN_DOWN(ident_map_size / PAGE_SIZE) * sizeof(struct page);
ident_map_size = vmemmap_size / sizeof(struct page) * PAGE_SIZE;
}
vmemmap = (struct page *)vmemmap_start; /* maximum address for which linear mapping could be created (DCSS, memory) */
BUILD_BUG_ON(MAX_DCSS_ADDR > (1UL << MAX_PHYSMEM_BITS));
max_mappable = max(ident_map_size, MAX_DCSS_ADDR);
max_mappable = min(max_mappable, vmemmap_start); #ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
__identity_base = round_down(vmemmap_start - max_mappable, rte_size); #endif
boot_debug("identity map: 0x%016lx-0x%016lx\n", __identity_base,
__identity_base + ident_map_size);
return asce_limit;
}
/* * This function clears the BSS section of the decompressed Linux kernel and NOT the decompressor's.
*/ staticvoid clear_bss_section(unsignedlong kernel_start)
{
memset((void *)kernel_start + vmlinux.image_size, 0, vmlinux.bss_size);
}
/* * Set vmalloc area size to an 8th of (potential) physical memory * size, unless size has been set by kernel command line parameter.
*/ staticvoid setup_vmalloc_size(void)
{ unsignedlong size;
/* * Non-randomized kernel physical start address must be _SEGMENT_SIZE * aligned (see blow).
*/
nokaslr_text_lma = ALIGN(mem_safe_offset(), _SEGMENT_SIZE);
safe_addr = PAGE_ALIGN(nokaslr_text_lma + vmlinux_size);
/* * Reserve decompressor memory together with decompression heap, * buffer and memory which might be occupied by uncompressed kernel * (if KASLR is off or failed).
*/
physmem_reserve(RR_DECOMPRESSOR, 0, safe_addr); if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && parmarea.initrd_size)
physmem_reserve(RR_INITRD, parmarea.initrd_start, parmarea.initrd_size);
oldmem_data.start = parmarea.oldmem_base;
oldmem_data.size = parmarea.oldmem_size;
read_ipl_report();
sclp_early_read_info();
sclp_early_detect_machine_features();
detect_facilities();
detect_diag9c();
detect_machine_type(); /* detect_diag288() needs machine type */
detect_diag288();
cmma_init();
sanitize_prot_virt_host();
max_physmem_end = detect_max_physmem_end();
setup_ident_map_size(max_physmem_end);
setup_vmalloc_size();
asce_limit = setup_kernel_memory_layout(kernel_size); /* got final ident_map_size, physmem allocations could be performed now */
physmem_set_usable_limit(ident_map_size);
detect_physmem_online_ranges(max_physmem_end);
save_ipl_cert_comp_list();
rescue_initrd(safe_addr, ident_map_size);
/* * __kaslr_offset_phys must be _SEGMENT_SIZE aligned, so the lower * 20 bits (the offset within a large page) are zero. Copy the last * 20 bits of __kaslr_offset, which is THREAD_SIZE aligned, to * __kaslr_offset_phys. * * With this the last 20 bits of __kaslr_offset_phys and __kaslr_offset * are identical, which is required to allow for large mappings of the * kernel image.
*/
kaslr_large_page_offset = __kaslr_offset & ~_SEGMENT_MASK; if (kaslr_enabled()) { unsignedlong size = vmlinux_size + kaslr_large_page_offset;
/* * [__kaslr_offset_phys..__kaslr_offset_phys + TEXT_OFFSET] region is * never accessed via the kernel image mapping as per the linker script: * * . = TEXT_OFFSET; * * Therefore, this region could be used for something else and does * not need to be reserved. See how it is skipped in setup_vmem().
*/
__kaslr_offset_phys = text_lma - TEXT_OFFSET;
kaslr_adjust_vmlinux_info(__kaslr_offset_phys);
physmem_reserve(RR_VMLINUX, text_lma, vmlinux_size);
deploy_kernel((void *)text_lma);
/* * In case KASLR is enabled the randomized location of .amode31 * section might overlap with .vmlinux.relocs section. To avoid that * the below randomize_within_range() could have been called with * __vmlinux_relocs_64_end as the lower range address. However, * .amode31 section is written to by the decompressed kernel - at * that time the contents of .vmlinux.relocs is not needed anymore. * Conversely, .vmlinux.relocs is read only by the decompressor, even * before the kernel started. Therefore, in case the two sections * overlap there is no risk of corrupting any data.
*/ if (kaslr_enabled()) { unsignedlong amode31_min;
/* * The order of the following operations is important: * * - kaslr_adjust_relocs() must follow clear_bss_section() to establish * static memory references to data in .bss to be used by setup_vmem() * (i.e init_mm.pgd) * * - setup_vmem() must follow kaslr_adjust_relocs() to be able using * static memory references to data in .bss (i.e init_mm.pgd) * * - copy_bootdata() must follow setup_vmem() to propagate changes * to bootdata made by setup_vmem()
*/
clear_bss_section(text_lma);
kaslr_adjust_relocs(text_lma, text_lma + vmlinux.image_size,
__kaslr_offset, __kaslr_offset_phys);
kaslr_adjust_got(__kaslr_offset);
setup_vmem(__kaslr_offset, __kaslr_offset + kernel_size, asce_limit);
dump_physmem_reserved();
copy_bootdata();
__apply_alternatives((struct alt_instr *)_vmlinux_info.alt_instructions,
(struct alt_instr *)_vmlinux_info.alt_instructions_end,
ALT_CTX_EARLY);
/* * Save KASLR offset for early dumps, before vmcore_info is set. * Mark as uneven to distinguish from real vmcore_info pointer.
*/
get_lowcore()->vmcore_info = __kaslr_offset_phys ? __kaslr_offset_phys | 0x1UL : 0;
/* * Jump to the decompressed kernel entry point and switch DAT mode on.
*/
psw.addr = __kaslr_offset + vmlinux.entry;
psw.mask = PSW_KERNEL_BITS;
boot_debug("Starting kernel at: 0x%016lx\n", psw.addr);
jump_to_kernel(&psw);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.