* refs/heads/tmp-79f138a Linux 4.4.107 ath9k: fix tx99 potential info leak IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop RDMA/cma: Avoid triggering undefined behavior macvlan: Only deliver one copy of the frame to the macvlan interface udf: Avoid overflow when session starts at large offset scsi: bfa: integer overflow in debugfs scsi: sd: change allow_restart to bool in sysfs interface scsi: sd: change manage_start_stop to bool in sysfs interface vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry raid5: Set R5_Expanded on parity devices as well as data. pinctrl: adi2: Fix Kconfig build problem usb: musb: da8xx: fix babble condition handling tty fix oops when rmmod 8250 powerpc/perf/hv-24x7: Fix incorrect comparison in memord scsi: hpsa: destroy sas transport properties before scsi_host scsi: hpsa: cleanup sas_phy structures in sysfs when unloading PCI: Detach driver before procfs & sysfs teardown on device remove xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real xfs: fix log block underflow during recovery cycle verification l2tp: cleanup l2tp_tunnel_delete calls bcache: fix wrong cache_misses statistics bcache: explicitly destroy mutex while exiting GFS2: Take inode off order_write list when setting jdata flag thermal/drivers/step_wise: Fix temperature regulation misbehavior ppp: Destroy the mutex when cleanup clk: tegra: Fix cclk_lp divisor register clk: imx6: refine hdmi_isfr's parent to make HDMI work on i.MX6 SoCs w/o VPU clk: mediatek: add the option for determining PLL source clock mm: Handle 0 flags in _calc_vm_trans() macro crypto: tcrypt - fix buffer lengths in test_aead_speed() arm-ccn: perf: Prevent module unload while PMU is in use target/file: Do not return error for UNMAP if length is zero target:fix condition return in core_pr_dump_initiator_port() iscsi-target: fix memory leak in lio_target_tiqn_addtpg() target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() powerpc/ipic: Fix status get and status clear powerpc/opal: Fix EBUSY bug in acquiring tokens netfilter: ipvs: Fix inappropriate output of procfs powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo PCI/PME: Handle invalid data when reading Root Status dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type rtc: pcf8563: fix output clock rate video: fbdev: au1200fb: Return an error code if a memory allocation fails video: fbdev: au1200fb: Release some resources if a memory allocation fails video: udlfb: Fix read EDID timeout fbdev: controlfb: Add missing modes to fix out of bounds access sfc: don't warn on successful change of MAC target: fix race during implicit transition work flushes target: fix ALUA transition timeout handling target: Use system workqueue for ALUA transitions btrfs: add missing memset while reading compressed inline extents NFSv4.1 respect server's max size in CREATE_SESSION efi/esrt: Cleanup bad memory map log messages perf symbols: Fix symbols__fixup_end heuristic for corner cases net/mlx4_core: Avoid delays during VF driver device shutdown afs: Fix afs_kill_pages() afs: Fix page leak in afs_write_begin() afs: Populate and use client modification time afs: Fix the maths in afs_fs_store_data() afs: Prevent callback expiry timer overflow afs: Migrate vlocation fields to 64-bit afs: Flush outstanding writes when an fd is closed afs: Adjust mode bits processing afs: Populate group ID from vnode status afs: Fix missing put_page() drm/radeon: reinstate oland workaround for sclk mmc: mediatek: Fixed bug where clock frequency could be set wrong sched/deadline: Use deadline instead of period when calculating overflow sched/deadline: Throttle a constrained deadline task activated after the deadline sched/deadline: Make sure the replenishment timer fires in the next period drm/radeon/si: add dpm quirk for Oland fjes: Fix wrong netdevice feature flags scsi: hpsa: limit outstanding rescans scsi: hpsa: update check for logical volume status openrisc: fix issue handling 8 byte get_user calls intel_th: pci: Add Gemini Lake support mlxsw: reg: Fix SPVMLR max record count mlxsw: reg: Fix SPVM max record count net: Resend IGMP memberships upon peer notification. dmaengine: Fix array index out of bounds warning in __get_unmap_pool() net: wimax/i2400m: fix NULL-deref at probe writeback: fix memory leak in wb_queue_work() netfilter: bridge: honor frag_max_size when refragmenting drm/omap: fix dmabuf mmap for dma_alloc'ed buffers Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list NFSD: fix nfsd_reset_versions for NFSv4. NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) net: bcmgenet: Power up the internal PHY before probing the MII net: bcmgenet: power down internal phy if open or resume fails net: bcmgenet: reserved phy revisions must be checked first net: bcmgenet: correct MIB access of UniMAC RUNT counters net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values net: initialize msg.msg_flags in recvfrom userfaultfd: selftest: vm: allow to build in vm/ directory userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE md-cluster: free md_cluster_info if node leave cluster usb: phy: isp1301: Add OF device ID table mac80211: Fix addition of mesh configuration element KEYS: add missing permission check for request_key() destination ext4: fix crash when a directory's i_size is too small ext4: fix fdatasync(2) after fallocate(2) operation dmaengine: dmatest: move callback wait queue to thread context sched/rt: Do not pull from current CPU if only one CPU to pull xhci: Don't add a virt_dev to the devs array before it's fully allocated Bluetooth: btusb: driver to enable the usb-wakeup feature ceph: drop negative child dentries before try pruning inode's alias usbip: fix stub_send_ret_submit() vulnerability to null transfer_buffer USB: core: prevent malicious bNumInterfaces overflow USB: uas and storage: Add US_FL_BROKEN_FUA for another JMicron JMS567 ID tracing: Allocate mask_str buffer dynamically autofs: fix careless error in recent commit crypto: salsa20 - fix blkcipher_walk API usage crypto: hmac - require that the underlying hash algorithm is unkeyed UPSTREAM: arm64: setup: introduce kaslr_offset() UPSTREAM: kcov: fix comparison callback signature UPSTREAM: kcov: support comparison operands collection UPSTREAM: kcov: remove pointless current != NULL check UPSTREAM: kcov: support compat processes UPSTREAM: kcov: simplify interrupt check UPSTREAM: kcov: make kcov work properly with KASLR enabled UPSTREAM: kcov: add more missing includes UPSTREAM: kcov: add missing #include <linux/sched.h> UPSTREAM: kcov: properly check if we are in an interrupt UPSTREAM: kcov: don't profile branches in kcov UPSTREAM: kcov: don't trace the code coverage code BACKPORT: kernel: add kcov code coverage Conflicts: Makefile mm/kasan/Makefile scripts/Makefile.lib Change-Id: Ic19953706ea2e700621b0ba94d1c90bbffa4f471 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
453 lines
12 KiB
C
453 lines
12 KiB
C
/*
|
|
* Based on arch/arm/kernel/setup.c
|
|
*
|
|
* Copyright (C) 1995-2001 Russell King
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/export.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/stddef.h>
|
|
#include <linux/ioport.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/utsname.h>
|
|
#include <linux/initrd.h>
|
|
#include <linux/console.h>
|
|
#include <linux/cache.h>
|
|
#include <linux/bootmem.h>
|
|
#include <linux/screen_info.h>
|
|
#include <linux/init.h>
|
|
#include <linux/kexec.h>
|
|
#include <linux/crash_dump.h>
|
|
#include <linux/root_dev.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/of_iommu.h>
|
|
#include <linux/of_fdt.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/efi.h>
|
|
#include <linux/psci.h>
|
|
#include <linux/dma-mapping.h>
|
|
#include <linux/mm.h>
|
|
|
|
#include <asm/acpi.h>
|
|
#include <asm/fixmap.h>
|
|
#include <asm/cpu.h>
|
|
#include <asm/cputype.h>
|
|
#include <asm/elf.h>
|
|
#include <asm/cpufeature.h>
|
|
#include <asm/cpu_ops.h>
|
|
#include <asm/kasan.h>
|
|
#include <asm/sections.h>
|
|
#include <asm/setup.h>
|
|
#include <asm/smp_plat.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/traps.h>
|
|
#include <asm/memblock.h>
|
|
#include <asm/efi.h>
|
|
#include <asm/xen/hypervisor.h>
|
|
#include <asm/mmu_context.h>
|
|
|
|
unsigned int boot_reason;
|
|
EXPORT_SYMBOL(boot_reason);
|
|
|
|
unsigned int cold_boot;
|
|
EXPORT_SYMBOL(cold_boot);
|
|
|
|
phys_addr_t __fdt_pointer __initdata;
|
|
|
|
const char *machine_name;
|
|
/*
|
|
* Standard memory resources
|
|
*/
|
|
static struct resource mem_res[] = {
|
|
{
|
|
.name = "Kernel code",
|
|
.start = 0,
|
|
.end = 0,
|
|
.flags = IORESOURCE_MEM
|
|
},
|
|
{
|
|
.name = "Kernel data",
|
|
.start = 0,
|
|
.end = 0,
|
|
.flags = IORESOURCE_MEM
|
|
}
|
|
};
|
|
|
|
#define kernel_code mem_res[0]
|
|
#define kernel_data mem_res[1]
|
|
|
|
/*
|
|
* The recorded values of x0 .. x3 upon kernel entry.
|
|
*/
|
|
u64 __cacheline_aligned boot_args[4];
|
|
|
|
void __init smp_setup_processor_id(void)
|
|
{
|
|
u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
|
|
cpu_logical_map(0) = mpidr;
|
|
|
|
/*
|
|
* clear __my_cpu_offset on boot CPU to avoid hang caused by
|
|
* using percpu variable early, for example, lockdep will
|
|
* access percpu variable inside lock_release
|
|
*/
|
|
set_my_cpu_offset(0);
|
|
pr_info("Booting Linux on physical CPU 0x%lx\n", (unsigned long)mpidr);
|
|
}
|
|
|
|
bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
|
|
{
|
|
return phys_id == cpu_logical_map(cpu);
|
|
}
|
|
|
|
struct mpidr_hash mpidr_hash;
|
|
/**
|
|
* smp_build_mpidr_hash - Pre-compute shifts required at each affinity
|
|
* level in order to build a linear index from an
|
|
* MPIDR value. Resulting algorithm is a collision
|
|
* free hash carried out through shifting and ORing
|
|
*/
|
|
static void __init smp_build_mpidr_hash(void)
|
|
{
|
|
u32 i, affinity, fs[4], bits[4], ls;
|
|
u64 mask = 0;
|
|
/*
|
|
* Pre-scan the list of MPIDRS and filter out bits that do
|
|
* not contribute to affinity levels, ie they never toggle.
|
|
*/
|
|
for_each_possible_cpu(i)
|
|
mask |= (cpu_logical_map(i) ^ cpu_logical_map(0));
|
|
pr_debug("mask of set bits %#llx\n", mask);
|
|
/*
|
|
* Find and stash the last and first bit set at all affinity levels to
|
|
* check how many bits are required to represent them.
|
|
*/
|
|
for (i = 0; i < 4; i++) {
|
|
affinity = MPIDR_AFFINITY_LEVEL(mask, i);
|
|
/*
|
|
* Find the MSB bit and LSB bits position
|
|
* to determine how many bits are required
|
|
* to express the affinity level.
|
|
*/
|
|
ls = fls(affinity);
|
|
fs[i] = affinity ? ffs(affinity) - 1 : 0;
|
|
bits[i] = ls - fs[i];
|
|
}
|
|
/*
|
|
* An index can be created from the MPIDR_EL1 by isolating the
|
|
* significant bits at each affinity level and by shifting
|
|
* them in order to compress the 32 bits values space to a
|
|
* compressed set of values. This is equivalent to hashing
|
|
* the MPIDR_EL1 through shifting and ORing. It is a collision free
|
|
* hash though not minimal since some levels might contain a number
|
|
* of CPUs that is not an exact power of 2 and their bit
|
|
* representation might contain holes, eg MPIDR_EL1[7:0] = {0x2, 0x80}.
|
|
*/
|
|
mpidr_hash.shift_aff[0] = MPIDR_LEVEL_SHIFT(0) + fs[0];
|
|
mpidr_hash.shift_aff[1] = MPIDR_LEVEL_SHIFT(1) + fs[1] - bits[0];
|
|
mpidr_hash.shift_aff[2] = MPIDR_LEVEL_SHIFT(2) + fs[2] -
|
|
(bits[1] + bits[0]);
|
|
mpidr_hash.shift_aff[3] = MPIDR_LEVEL_SHIFT(3) +
|
|
fs[3] - (bits[2] + bits[1] + bits[0]);
|
|
mpidr_hash.mask = mask;
|
|
mpidr_hash.bits = bits[3] + bits[2] + bits[1] + bits[0];
|
|
pr_debug("MPIDR hash: aff0[%u] aff1[%u] aff2[%u] aff3[%u] mask[%#llx] bits[%u]\n",
|
|
mpidr_hash.shift_aff[0],
|
|
mpidr_hash.shift_aff[1],
|
|
mpidr_hash.shift_aff[2],
|
|
mpidr_hash.shift_aff[3],
|
|
mpidr_hash.mask,
|
|
mpidr_hash.bits);
|
|
/*
|
|
* 4x is an arbitrary value used to warn on a hash table much bigger
|
|
* than expected on most systems.
|
|
*/
|
|
if (mpidr_hash_size() > 4 * num_possible_cpus())
|
|
pr_warn("Large number of MPIDR hash buckets detected\n");
|
|
}
|
|
|
|
static void __init setup_machine_fdt(phys_addr_t dt_phys)
|
|
{
|
|
void *dt_virt = fixmap_remap_fdt(dt_phys);
|
|
|
|
if (!dt_virt || !early_init_dt_scan(dt_virt)) {
|
|
pr_crit("\n"
|
|
"Error: invalid device tree blob at physical address %pa (virtual address 0x%p)\n"
|
|
"The dtb must be 8-byte aligned and must not exceed 2 MB in size\n"
|
|
"\nPlease check your bootloader.",
|
|
&dt_phys, dt_virt);
|
|
|
|
while (true)
|
|
cpu_relax();
|
|
}
|
|
|
|
machine_name = of_flat_dt_get_machine_name();
|
|
if (machine_name) {
|
|
dump_stack_set_arch_desc("%s (DT)", machine_name);
|
|
pr_info("Machine: %s\n", machine_name);
|
|
}
|
|
}
|
|
|
|
static void __init request_standard_resources(void)
|
|
{
|
|
struct memblock_region *region;
|
|
struct resource *res;
|
|
|
|
kernel_code.start = __pa_symbol(_text);
|
|
kernel_code.end = __pa_symbol(__init_begin - 1);
|
|
kernel_data.start = __pa_symbol(_sdata);
|
|
kernel_data.end = __pa_symbol(_end - 1);
|
|
|
|
for_each_memblock(memory, region) {
|
|
res = alloc_bootmem_low(sizeof(*res));
|
|
res->name = "System RAM";
|
|
res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
|
|
res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
|
|
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
|
|
|
|
request_resource(&iomem_resource, res);
|
|
|
|
if (kernel_code.start >= res->start &&
|
|
kernel_code.end <= res->end)
|
|
request_resource(res, &kernel_code);
|
|
if (kernel_data.start >= res->start &&
|
|
kernel_data.end <= res->end)
|
|
request_resource(res, &kernel_data);
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_BLK_DEV_INITRD
|
|
/*
|
|
* Relocate initrd if it is not completely within the linear mapping.
|
|
* This would be the case if mem= cuts out all or part of it.
|
|
*/
|
|
static void __init relocate_initrd(void)
|
|
{
|
|
phys_addr_t orig_start = __virt_to_phys(initrd_start);
|
|
phys_addr_t orig_end = __virt_to_phys(initrd_end);
|
|
phys_addr_t ram_end = memblock_end_of_DRAM();
|
|
phys_addr_t new_start;
|
|
unsigned long size, to_free = 0;
|
|
void *dest;
|
|
|
|
if (orig_end <= ram_end)
|
|
return;
|
|
|
|
/*
|
|
* Any of the original initrd which overlaps the linear map should
|
|
* be freed after relocating.
|
|
*/
|
|
if (orig_start < ram_end)
|
|
to_free = ram_end - orig_start;
|
|
|
|
size = orig_end - orig_start;
|
|
if (!size)
|
|
return;
|
|
|
|
/* initrd needs to be relocated completely inside linear mapping */
|
|
new_start = memblock_find_in_range(0, PFN_PHYS(max_pfn),
|
|
size, PAGE_SIZE);
|
|
if (!new_start)
|
|
panic("Cannot relocate initrd of size %ld\n", size);
|
|
memblock_reserve(new_start, size);
|
|
|
|
initrd_start = __phys_to_virt(new_start);
|
|
initrd_end = initrd_start + size;
|
|
|
|
pr_info("Moving initrd from [%llx-%llx] to [%llx-%llx]\n",
|
|
orig_start, orig_start + size - 1,
|
|
new_start, new_start + size - 1);
|
|
|
|
dest = (void *)initrd_start;
|
|
|
|
if (to_free) {
|
|
memcpy(dest, (void *)__phys_to_virt(orig_start), to_free);
|
|
dest += to_free;
|
|
}
|
|
|
|
copy_from_early_mem(dest, orig_start + to_free, size - to_free);
|
|
|
|
if (to_free) {
|
|
pr_info("Freeing original RAMDISK from [%llx-%llx]\n",
|
|
orig_start, orig_start + to_free - 1);
|
|
memblock_free(orig_start, to_free);
|
|
}
|
|
}
|
|
#else
|
|
static inline void __init relocate_initrd(void)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
|
|
|
|
void __init __weak init_random_pool(void) { }
|
|
|
|
void __init setup_arch(char **cmdline_p)
|
|
{
|
|
pr_info("Boot CPU: AArch64 Processor [%08x]\n", read_cpuid_id());
|
|
|
|
sprintf(init_utsname()->machine, ELF_PLATFORM);
|
|
init_mm.start_code = (unsigned long) _text;
|
|
init_mm.end_code = (unsigned long) _etext;
|
|
init_mm.end_data = (unsigned long) _edata;
|
|
init_mm.brk = (unsigned long) _end;
|
|
|
|
*cmdline_p = boot_command_line;
|
|
|
|
early_fixmap_init();
|
|
early_ioremap_init();
|
|
|
|
setup_machine_fdt(__fdt_pointer);
|
|
|
|
parse_early_param();
|
|
|
|
/*
|
|
* Unmask asynchronous aborts after bringing up possible earlycon.
|
|
* (Report possible System Errors once we can report this occurred)
|
|
*/
|
|
local_async_enable();
|
|
|
|
/*
|
|
* TTBR0 is only used for the identity mapping at this stage. Make it
|
|
* point to zero page to avoid speculatively fetching new entries.
|
|
*/
|
|
cpu_uninstall_idmap();
|
|
|
|
efi_init();
|
|
arm64_memblock_init();
|
|
|
|
/* Parse the ACPI tables for possible boot-time configuration */
|
|
acpi_boot_table_init();
|
|
|
|
paging_init();
|
|
relocate_initrd();
|
|
|
|
kasan_init();
|
|
|
|
request_standard_resources();
|
|
|
|
early_ioremap_reset();
|
|
|
|
if (acpi_disabled) {
|
|
unflatten_device_tree();
|
|
psci_dt_init();
|
|
} else {
|
|
psci_acpi_init();
|
|
}
|
|
xen_early_init();
|
|
|
|
cpu_read_bootcpu_ops();
|
|
smp_init_cpus();
|
|
smp_build_mpidr_hash();
|
|
|
|
#ifdef CONFIG_ARM64_SW_TTBR0_PAN
|
|
/*
|
|
* Make sure thread_info.ttbr0 always generates translation
|
|
* faults in case uaccess_enable() is inadvertently called by the init
|
|
* thread.
|
|
*/
|
|
#ifdef CONFIG_THREAD_INFO_IN_TASK
|
|
init_task.thread_info.ttbr0 = __pa_symbol(empty_zero_page);
|
|
#else
|
|
init_thread_info.ttbr0 = __pa_symbol(empty_zero_page);
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef CONFIG_VT
|
|
#if defined(CONFIG_VGA_CONSOLE)
|
|
conswitchp = &vga_con;
|
|
#elif defined(CONFIG_DUMMY_CONSOLE)
|
|
conswitchp = &dummy_con;
|
|
#endif
|
|
#endif
|
|
init_random_pool();
|
|
if (boot_args[1] || boot_args[2] || boot_args[3]) {
|
|
pr_err("WARNING: x1-x3 nonzero in violation of boot protocol:\n"
|
|
"\tx1: %016llx\n\tx2: %016llx\n\tx3: %016llx\n"
|
|
"This indicates a broken bootloader or old kernel\n",
|
|
boot_args[1], boot_args[2], boot_args[3]);
|
|
}
|
|
}
|
|
|
|
static int __init arm64_device_init(void)
|
|
{
|
|
if (of_have_populated_dt()) {
|
|
of_iommu_init();
|
|
of_platform_populate(NULL, of_default_bus_match_table,
|
|
NULL, NULL);
|
|
} else if (acpi_disabled) {
|
|
pr_crit("Device tree not populated\n");
|
|
}
|
|
return 0;
|
|
}
|
|
arch_initcall_sync(arm64_device_init);
|
|
|
|
static int __init topology_init(void)
|
|
{
|
|
int i;
|
|
|
|
for_each_possible_cpu(i) {
|
|
struct cpu *cpu = &per_cpu(cpu_data.cpu, i);
|
|
cpu->hotpluggable = 1;
|
|
register_cpu(cpu, i);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
postcore_initcall(topology_init);
|
|
|
|
void arch_setup_pdev_archdata(struct platform_device *pdev)
|
|
{
|
|
pdev->archdata.dma_mask = DMA_BIT_MASK(32);
|
|
pdev->dev.dma_mask = &pdev->archdata.dma_mask;
|
|
}
|
|
|
|
/*
|
|
* Dump out kernel offset information on panic.
|
|
*/
|
|
static int dump_kernel_offset(struct notifier_block *self, unsigned long v,
|
|
void *p)
|
|
{
|
|
const unsigned long offset = kaslr_offset();
|
|
|
|
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && offset > 0) {
|
|
pr_emerg("Kernel Offset: 0x%lx from 0x%lx\n",
|
|
offset, KIMAGE_VADDR);
|
|
} else {
|
|
pr_emerg("Kernel Offset: disabled\n");
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static struct notifier_block kernel_offset_notifier = {
|
|
.notifier_call = dump_kernel_offset
|
|
};
|
|
|
|
static int __init register_kernel_offset_dumper(void)
|
|
{
|
|
atomic_notifier_chain_register(&panic_notifier_list,
|
|
&kernel_offset_notifier);
|
|
return 0;
|
|
}
|
|
__initcall(register_kernel_offset_dumper);
|