I have added c++ support to the linux kernel and compiled it successfully. Tried booting the kernel using the command qemu-system-x86_64 -nographic -kernel arch/x86/boot/bzImage -initrd /boot/initrd.img-4.14.41+ -m 512M -append console=ttyS0
but the following erorr occurs
[ 0.000000] Linux version 4.14.41+ (root@boss) (gcc version 4.4.5 (GCC)) #7 SMP Wed Jun 27 14:08:06 IST 2018
[ 0.000000] Command line: console=ttyS0
[ 0.000000] x86/fpu: x87 FPU will use FXSAVE
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001ffdffff] usable
[ 0.000000] BIOS-e820: [mem 0x000000001ffe0000-0x000000001fffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] SMBIOS 2.8 present.
[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[ 0.000000] tsc: Fast TSC calibration using PIT
[ 0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[ 0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
[ 0.000000] e820: last_pfn = 0x1ffe0 max_arch_pfn = 0x400000000
[ 0.000000] MTRR default type: write-back
[ 0.000000] MTRR fixed ranges enabled:
[ 0.000000] 00000-9FFFF write-back
[ 0.000000] A0000-BFFFF uncachable
[ 0.000000] C0000-FFFFF write-protect
[ 0.000000] MTRR variable ranges enabled:
[ 0.000000] 0 base 0080000000 mask FF80000000 uncachable
[ 0.000000] 1 disabled
[ 0.000000] 2 disabled
[ 0.000000] 3 disabled
[ 0.000000] 4 disabled
[ 0.000000] 5 disabled
[ 0.000000] 6 disabled
[ 0.000000] 7 disabled
[ 0.000000] x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
[ 0.000000] found SMP MP-table at [mem 0x000f0ed0-0x000f0edf] mapped at [ffffffffff200ed0]
[ 0.000000] Scanning 1 areas for low memory corruption
[ 0.000000] Base memory trampoline at [ffff916d40099000] 99000 size 24576
[ 0.000000] BRK [0x19c9f000, 0x19c9ffff] PGTABLE
[ 0.000000] BRK [0x19ca0000, 0x19ca0fff] PGTABLE
[ 0.000000] BRK [0x19ca1000, 0x19ca1fff] PGTABLE
[ 0.000000] BRK [0x19ca2000, 0x19ca2fff] PGTABLE
[ 0.000000] BRK [0x19ca3000, 0x19ca3fff] PGTABLE
[ 0.000000] RAMDISK: [mem 0x1f69e000-0x1ffd7fff]
[ 0.000000] ACPI: Early table checksum verification disabled
[ 0.000000] ACPI: RSDP 0x00000000000F0CF0 000014 (v00 BOCHS )
[ 0.000000] ACPI: RSDT 0x000000001FFE1854 000034 (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: FACP 0x000000001FFE0B37 000074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001)
[ 0.000000] ACPI: DSDT 0x000000001FFE0040 000AF7 (v01 BOCHS BXPCDSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: FACS 0x000000001FFE0000 000040
[ 0.000000] ACPI: SSDT 0x000000001FFE0BAB 000BF9 (v01 BOCHS BXPCSSDT 00000001 BXPC 00000001)
[ 0.000000] ACPI: APIC 0x000000001FFE17A4 000078 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001)
[ 0.000000] ACPI: HPET 0x000000001FFE181C 000038 (v01 BOCHS BXPCHPET 00000001 BXPC 00000001)
[ 0.000000] ACPI: Local APIC address 0xfee00000
[ 0.000000] No NUMA configuration found
[ 0.000000] Faking a node at [mem 0x0000000000000000-0x000000001ffdffff]
[ 0.000000] NODE_DATA(0) allocated [mem 0x1ffdc000-0x1ffdffff]
[ 0.000000] Zone ranges:
[ 0.000000] DMA [mem 0x0000000000001000-0x0000000000ffffff]
[ 0.000000] DMA32 [mem 0x0000000001000000-0x000000001ffdffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000000001000-0x000000000009efff]
[ 0.000000] node 0: [mem 0x0000000000100000-0x000000001ffdffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000001ffdffff]
[ 0.000000] On node 0 totalpages: 130942
[ 0.000000] DMA zone: 64 pages used for memmap
[ 0.000000] DMA zone: 21 pages reserved
[ 0.000000] DMA zone: 3998 pages, LIFO batch:0
[ 0.000000] DMA32 zone: 1984 pages used for memmap
[ 0.000000] DMA32 zone: 126944 pages, LIFO batch:31
[ 0.000000] ACPI: PM-Timer IO Port: 0x608
[ 0.000000] ACPI: Local APIC address 0xfee00000
[ 0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[ 0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[ 0.000000] ACPI: IRQ0 used by override.
[ 0.000000] ACPI: IRQ5 used by override.
[ 0.000000] ACPI: IRQ9 used by override.
[ 0.000000] ACPI: IRQ10 used by override.
[ 0.000000] ACPI: IRQ11 used by override.
[ 0.000000] Using ACPI (MADT) for SMP configuration information
[ 0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[ 0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[ 0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[ 0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[ 0.000000] e820: [mem 0x20000000-0xfffbffff] available for PCI devices
[ 0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[ 0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 nr_node_ids:1
[ 0.000000] percpu: Embedded 43 pages/cpu @ffff916d5f400000 s137624 r8192 d30312 u2097152
[ 0.000000] pcpu-alloc: s137624 r8192 d30312 u2097152 alloc=1*2097152
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 128873
[ 0.000000] Policy zone: DMA32
[ 0.000000] Kernel command line: console=ttyS0
[ 0.000000] PID hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.000000] Calgary: detecting Calgary via BIOS EBDA area
[ 0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing!
[ 0.000000] Memory: 480520K/523768K available (12300K kernel code, 1266K rwdata, 3016K rodata, 1252K init, 732K bss, 43248K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 4352, nr_irqs: 256, preallocated irqs: 16
[ 0.000000] Console: colour VGA+ 80x25
[ 0.000000] console [ttyS0] enabled
[ 0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
[ 0.000000] hpet clockevent registered
[ 0.000000] tsc: Fast TSC calibration using PIT
[ 0.002000] tsc: Detected 3491.973 MHz processor
[ 0.003000] Calibrating delay loop (skipped), value calculated using timer frequency.. 6983.94 BogoMIPS (lpj=3491973)
[ 0.003000] pid_max: default: 32768 minimum: 301
[ 0.003000] ACPI: Core revision 20170728
[ 0.029083] ACPI: 2 ACPI AML tables successfully acquired and loaded
[ 0.029709] Security Framework initialized
[ 0.029919] SELinux: Initializing.
[ 0.030194] SELinux: Starting in permissive mode
[ 0.031403] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes)
[ 0.031877] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes)
[ 0.032109] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.032331] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.042265] mce: CPU supports 10 MCE banks
[ 0.043166] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[ 0.043342] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[ 0.043559] Spectre V2 : Spectre mitigation: LFENCE not serializing, switching to generic retpoline
[ 0.043827] Spectre V2 : Vulnerable: Minimal generic ASM retpoline
[ 0.044034] Spectre V2 : Spectre v2 mitigation: Filling RSB on context switch
[ 0.256246] random: fast init done
[ 0.351594] Freeing SMP alternatives memory: 36K
[ 0.363413] smpboot: Max logical packages: 1
[ 0.367826] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[ 0.378000] smpboot: CPU0: AMD QEMU Virtual CPU version 2.1.2 (family: 0x6, model: 0x6, stepping: 0x3)
[ 0.382812] Performance Events: PMU not available due to virtualization, using software events only.
[ 0.385214] Hierarchical SRCU implementation.
[ 0.389325] Huh? What family is it: 0x6?!
[ 0.390415] smp: Bringing up secondary CPUs ...
[ 0.390701] smp: Brought up 1 node, 1 CPU
[ 0.391103] smpboot: Total of 1 processors activated (6983.94 BogoMIPS)
[ 0.402427] devtmpfs: initialized
[ 0.408000] random: get_random_u32 called from bucket_table_alloc+0x103/0x220 with crng_init=1
[ 0.412484] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[ 0.413053] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.415338] RTC time: 8:55:47, date: 06/27/18
[ 0.424302] NET: Registered protocol family 16
[ 0.426587] BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
[ 0.427000] IP: 0x1
[ 0.427000] PGD 0 P4D 0
[ 0.427000] Oops: 0010 [#1] SMP NOPTI
[ 0.427000] Modules linked in:
[ 0.427000] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.41+ #7
[ 0.427000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[ 0.427000] task: ffff916d5e280000 task.stack: ffff97b4800d0000
[ 0.427000] RIP: 0010:0x1
[ 0.427000] RSP: 0018:ffff97b4800d3e70 EFLAGS: 00000296
[ 0.427000] RAX: 0000000000000001 RBX: ffffffff827a95d8 RCX: 0000000000000000
[ 0.427000] RDX: 00000000ffffffff RSI: ffffffff8289d380 RDI: ffffffff8273aeb8
[ 0.427000] RBP: 00000000ffffffff R08: 00000000010d00ff R09: 0000000000000000
[ 0.427000] R10: ffff916d5e25b800 R11: 0000000000000001 R12: 0000000080000000
[ 0.427000] R13: ffffffff827d1ce8 R14: 0000000000000000 R15: 0000000000000000
[ 0.427000] FS: 0000000000000000(0000) GS:ffff916d5f400000(0000) knlGS:0000000000000000
[ 0.427000] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 0.427000] CR2: 0000000000000001 CR3: 000000001960a000 CR4: 00000000000006f0
[ 0.427000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 0.427000] DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000
[ 0.427000] Call Trace:
[ 0.427000] ? __do_global_ctors_aux+0x24/0x1fe0
[ 0.427000] ? radix_tree_init+0xba/0xba
[ 0.427000] ? call___do_global_ctors_aux+0x9/0xd
[ 0.427000] ? do_one_initcall+0x44/0x160
[ 0.427000] ? kernel_init_freeable+0x146/0x1d8
[ 0.427000] ? kernel_init_freeable+0x1d8/0x1d8
[ 0.427000] ? rest_init+0xb0/0xb0
[ 0.427000] ? kernel_init+0x9/0x100
[ 0.427000] ? rest_init+0xb0/0xb0
[ 0.427000] ? ret_from_fork+0x35/0x40
[ 0.427000] Code: Bad RIP value.
[ 0.427000] RIP: 0x1 RSP: ffff97b4800d3e70
[ 0.427000] CR2: 0000000000000001
[ 0.427000] ---[ end trace 4de93c672bab1b43 ]---
[ 0.431175] kworker/u2:0 (15) used greatest stack depth: 13600 bytes left
[ 0.432000] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[ 0.432000]
[ 0.432000] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[ 0.432000]
[ 0.432000] general protection fault: fff2 [#2] SMP NOPTI
[ 0.432000] Modules linked in:
[ 0.432000] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G D 4.14.41+ #7
[ 0.432000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[ 0.432000] task: ffff916d5e280000 task.stack: ffff97b4800d0000
[ 0.432000] RIP: 0010:panic+0x1db/0x219
[ 0.432000] RSP: 0018:ffff97b4800d3c28 EFLAGS: 00000246
[ 0.432000] RAX: 0000000000000051 RBX: 0000000000000000 RCX: ffffffff822460c8
[ 0.432000] RDX: 0000000000000001 RSI: 0000000000000082 RDI: ffffffff828017a0
[ 0.432000] RBP: 0000000000000000 R08: 0000000000000020 R09: 0000000000000020
[ 0.432000] R10: 0000000000000000 R11: 206c656e72654b20 R12: 0000000000000000
[ 0.432000] R13: ffff916d5e280000 R14: 00007ffffffff000 R15: 0000000000000001
[ 0.432000] FS: 0000000000000000(0000) GS:ffff916d5f400000(0000) knlGS:0000000000000000
[ 0.432000] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 0.432000] CR2: ffffffffffffffd6 CR3: 000000001960a000 CR4: 00000000000006f0
[ 0.432000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 0.432000] DR3: 0000000000000000 DR6: 0000000000000000 DR7: 0000000000000000
[ 0.432000] Call Trace:
[ 0.432000] ? __switch_to_asm+0x30/0x60
[ 0.432000] ? __switch_to_asm+0x24/0x60
[ 0.432000] ? __switch_to_asm+0x24/0x60
[ 0.432000] forget_original_parent+0x404/0x410
[ 0.432000] ? __switch_to_asm+0x24/0x60
[ 0.432000] ? __switch_to_asm+0x24/0x60
[ 0.432000] ? __switch_to_asm+0x30/0x60
[ 0.432000] ? __switch_to_asm+0x24/0x60
[ 0.432000] ? __switch_to_asm+0x24/0x60
[ 0.432000] ? __switch_to_asm+0x30/0x60
[ 0.432000] ? __switch_to_asm+0x24/0x60
[ 0.432000] ? perf_pin_task_context+0xf/0x40
[ 0.432000] ? perf_event_exit_task+0x3ac/0x3e0
[ 0.432000] ? rtnl_bridge_getlink+0x1b0/0x1b0
[ 0.432000] exit_notify+0x31/0x1c0
[ 0.432000] ? task_work_run+0x2e/0x90
[ 0.432000] ? cgroup_exit+0x72/0xc0
[ 0.432000] do_exit+0x2ff/0x6a0
[ 0.432000] ? __do_global_ctors_aux+0x24/0x1fe0
[ 0.432000] ? radix_tree_init+0xba/0xba
[ 0.432000] ? call___do_global_ctors_aux+0x9/0xd
[ 0.432000] ? do_one_initcall+0x44/0x160
[ 0.432000] ? kernel_init_freeable+0x146/0x1d8
[ 0.432000] ? kernel_init_freeable+0x1d8/0x1d8
[ 0.432000] rewind_stack_do_exit+0x17/0x20
[ 0.432000] Code: 39 e0 7f b4 83 3d 32 07 7a 01 00 74 05 e8 07 11 02 00 48 c7 c6 e0 db 7f 82 48 c7 c7 28 12 fd 81 31 c0 e8 a4 f0 04 00 fb 45 31 e4 <49> 39 dc 7c 16 83 f5 01 89 ef ff 15 1e 07 7a 01 49 01 c4 49 8d
[ 0.432000] RIP: panic+0x1db/0x219 RSP: ffff97b4800d3c28
[ 0.432000] ---[ end trace 4de93c672bab1b44 ]---
[ 0.432000] Fixing recursive fault but reboot is needed!
What might be the cause of the error? There are two different call traces here along with the offsets.So, I tried gdb
on object files that are calling these functions. But, gdb says No symbol table is loaded. Use the "file" command.
If this is not the right way, what are other alternatives for debugging?
User contributions licensed under CC BY-SA 3.0