AnsweredAssumed Answered

Unable to handle kernel NULL pointer dereference at virtual address 00000008

Question asked by Santhosh Kumar on Aug 19, 2019
Latest reply on Oct 11, 2019 by Victor Linnik

Hi,

I'm trying to access the register memeory address but Iam getting the error when i try to read IORESOURCE_MEM

Below is the code snippet

   res = platform_get_resource(pdev, IORESOURCE_MEM, 0); // get resource info
   remap_size = res->end - res->start + 1;               // get resource memory size
   base_addr = ioremap(res->start, remap_size);  

 

Kernel boot log

------------------------------------------------------------------------------------------------------------------

[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffff000000000000 - 0xffff000008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffff000008000000 - 0xffff7dffbfff0000   (129022 GB)
[    0.000000]       .text : 0xffff000008080000 - 0xffff000008e60000   ( 14208 KB)
[    0.000000]     .rodata : 0xffff000008e60000 - 0xffff0000094c0000   (  6528 KB)
[    0.000000]       .init : 0xffff0000094c0000 - 0xffff000009600000   (  1280 KB)
[    0.000000]       .data : 0xffff000009600000 - 0xffff0000097ad200   (  1717 KB)
[    0.000000]        .bss : 0xffff0000097ad200 - 0xffff00000981d1c0   (   448 KB)
[    0.000000]     fixed   : 0xffff7dfffe7f9000 - 0xffff7dfffec00000   (  4124 KB)
[    0.000000]     PCI I/O : 0xffff7dfffee00000 - 0xffff7dffffe00000   (    16 MB)
[    0.000000]     vmemmap : 0xffff7e0000000000 - 0xffff800000000000   (  2048 GB maximum)
[    0.000000]               0xffff7e0000000000 - 0xffff7e0002000000   (    32 MB actual)
[    0.000000]     memory  : 0xffff800000000000 - 0xffff800080000000   (  2048 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]     RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4.
[    0.000000]     Tasks RCU enabled.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: no VLPI support, no direct LPI support
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] i.MX8MM clock driver init done

------------------------------------------------------------------------------------------------------------------

 

Error log:

------------------------------------------------------------------------------------------------------------------

 Unable to handle kernel NULL pointer dereference at virtual address 00000008
[   21.901630] Mem abort info:
[   21.904464]   Exception class = DABT (current EL), IL = 32 bits
[   21.910426]   SET = 0, FnV = 0
[   21.913510]   EA = 0, S1PTW = 0
[   21.916689] Data abort info:
[   21.919606]   ISV = 0, ISS = 0x00000006
[   21.923473]   CM = 0, WnR = 0
[   21.926452] user pgtable: 4k pages, 48-bit VAs, pgd = ffff800074970000
[   21.933009] [0000000000000008] *pgd=00000000b4a6e003, *pud=00000000bbf8f003, *pmd=0000000000000000
[   21.942010] Internal error: Oops: 96000006 [#1] PREEMPT SMP
[   21.947584] Modules linked in: imx8mmini_gpio_platformdevice(O+) 8021q garp stp mrp crc32_ce crct10dif_ce qca9377(O) galcore(O)
[   21.959082] CPU: 0 PID: 4008 Comm: insmod Tainted: G           O    4.14.78-imx_4.14.78_1.0.0_ga+g94da7bd #1
[   21.968908] Hardware name: FSL i.MX8MM EVK board (DT)
[   21.973961] task: ffff80007bc8ec00 task.stack: ffff000019580000
[   21.979889] PC is at gpiodriver_probe+0x2c/0x128 [imx8mmini_gpio_platformdevice]
[   21.987286] LR is at gpiodriver_probe+0x28/0x128 [imx8mmini_gpio_platformdevice]
[   21.994681] pc : [<ffff00000145303c>] lr : [<ffff000001453038>] pstate: 40000145
[   22.002076] sp : ffff000019583ad0
[   22.005390] x29: ffff000019583ad0 x28: ffff000009dc5000
[   22.010703] x27: ffff0000014554d0 x26: 00000000014000c0
[   22.016017] x25: 0000000000000124 x24: 000000000000000b
[   22.021332] x23: 0000000000000000 x22: ffff000001455388
[   22.026649] x21: ffff000001455360 x20: ffff000001455030
[   22.031965] x19: ffff000001455780 x18: 0000000000000010
[   22.037279] x17: 000000000042b2c8 x16: ffff00000814d028
[   22.042594] x15: ffffffffffffffff x14: ffff0000897bb55f
[   22.047907] x13: ffff0000097bb56d x12: ffff000009608df8
[   22.053222] x11: ffff00000862b980 x10: ffff0000195837f0
[   22.058536] x9 : 0000000000000006 x8 : 00000000000d8d20
[   22.063851] x7 : 0000000000000000 x6 : 00000000000002b3
[   22.069166] x5 : 0000000000000000 x4 : 0000000000000000
[   22.074479] x3 : 0000000000000000 x2 : 0000000000000001
[   22.079793] x1 : 0000000000000200 x0 : 0000000000000000
[   22.085110] Process insmod (pid: 4008, stack limit = 0xffff000019580000)
[   22.091811] Call trace:
[   22.094259] Exception stack(0xffff000019583990 to 0xffff000019583ad0)
[   22.100701] 3980:                                   0000000000000000 0000000000000200
[   22.108535] 39a0: 0000000000000001 0000000000000000 0000000000000000 0000000000000000
[   22.116364] 39c0: 00000000000002b3 0000000000000000 00000000000d8d20 0000000000000006
[   22.124194] 39e0: ffff0000195837f0 ffff00000862b980 ffff000009608df8 ffff0000097bb56d
[   22.132025] 3a00: ffff0000897bb55f ffffffffffffffff ffff00000814d028 000000000042b2c8
[   22.139856] 3a20: 0000000000000010 ffff000001455780 ffff000001455030 ffff000001455360
[   22.147689] 3a40: ffff000001455388 0000000000000000 000000000000000b 0000000000000124
[   22.155531] 3a60: 00000000014000c0 ffff0000014554d0 ffff000009dc5000 ffff000019583ad0
[   22.163365] 3a80: ffff000001453038 ffff000019583ad0 ffff00000145303c 0000000040000145
[   22.171195] 3aa0: 0000000000000000 ffff80007bc8ec00 0000ffffffffffff ffff80007bb29018
[   22.179025] 3ac0: ffff000019583ad0 ffff00000145303c
[   22.183912] [<ffff00000145303c>] gpiodriver_probe+0x2c/0x128 [imx8mmini_gpio_platformdevice]
[   22.192357] [<ffff0000086d4db0>] platform_drv_probe+0x58/0xb8
[   22.198107] [<ffff0000086d3190>] driver_probe_device+0x210/0x2d0
[   22.204116] [<ffff0000086d330c>] __driver_attach+0xbc/0xc0
[   22.209604] [<ffff0000086d12ec>] bus_for_each_dev+0x4c/0x98
[   22.215176] [<ffff0000086d2aa8>] driver_attach+0x20/0x28                               
[   22.220490] [<ffff0000086d25f8>] bus_add_driver+0x1b8/0x228                            
[   22.226067] [<ffff0000086d3ca8>] driver_register+0x60/0xf8                             
[   22.231555] [<ffff0000086d4d00>] __platform_driver_register+0x40/0x48                  
[   22.238001] [<ffff00000145802c>] gpio_device_init+0x2c/0x1000 [imx8mmini_gpio_platformdevice]
[   22.246530] [<ffff000008083c90>] do_one_initcall+0x38/0x128
[   22.252105] [<ffff00000814da98>] do_init_module+0x58/0x1b0
[   22.257593] [<ffff00000814c6dc>] load_module+0x1a74/0x21c8
[   22.263080] [<ffff00000814d0d0>] SyS_finit_module+0xa8/0xc0
[   22.268654] Exception stack(0xffff000019583ec0 to 0xffff000019584000)
[   22.275094] 3ec0: 0000000000000003 0000000000419fd0 0000000000000000 0000000000000003
[   22.282924] 3ee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   22.290759] 3f00: 0000000000000111 0000ffffbe020700 0101010101010101 0000000000000000
[   22.298588] 3f20: 0000000000000001 000000000000270f 0000ffffbe0332c8 0000ffffbe025de0
[   22.306422] 3f40: 0000ffffbe0ec400 000000000042b2c8 000000000000036c 0000000034b0a740
[   22.314251] 3f60: 0000000000419fd0 0000000000000000 0000000000000000 0000000000000000
[   22.322084] 3f80: 0000ffffc7209eb0 0000000000000000 0000000000000000 0000000000000000
[   22.329915] 3fa0: 0000000000000000 0000ffffc7209250 0000000000410d88 0000ffffc7209250
[   22.337745] 3fc0: 0000ffffbe0ec424 0000000080000000 0000000000000003 0000000000000111
[   22.345575] 3fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   22.353406] [<ffff000008083b18>] __sys_trace_return+0x0/0x4
[   22.358983] Code: 52804001 aa1403e0 95ca059d 58000693 (f9400401)
[   22.365081] ---[ end trace 52116b2cc35197e4 ]---
Segmentation fault

 

Message from syslogd@imx8mmevk at Mon Aug 19 12:55:05 2019 ...
imx8mmevk kernel: [   21.942010] Internal error: Oops: 96000006 [#1] PREEMPT SMP

 

Message from syslogd@imx8mmevk at Mon Aug 19 12:55:05 2019 ...
imx8mmevk kernel: [   22.085110] Process insmod (pid: 4008, stack limit = 0xffff000019580000)

 

Message from syslogd@imx8mmevk at Mon Aug 19 12:55:05 2019 ...
imx8mmevk kernel: [   22.358983] Code: 52804001 aa1403e0 95ca059d 58000693 (f9400401)
root@imx8mmevk:~#

------------------------------------------------------------------------------------------------------------------

Whats the issue... I am not able to understand

 

Regards

Santhosh

Outcomes