alkhimey / Ada_Kernel_Module_Framework

Framework for writing Linux kernel modules in Ada
http://www.nihamkin.com/tag/kernel.html
27 stars 2 forks source link

Exception when initing the template module #7

Open alkhimey opened 6 years ago

alkhimey commented 6 years ago

This exception occurs randomly when inserting the examples/template kernel module:

[ 6992.867495] Init module.
[ 6992.867687] Hello Ada.
[ 6992.867919]  42
[ 6992.867920] PURPLE_BLUE
[ 6992.867920] TRUE
[ 6992.867921]  4.0
[ 6992.867921] -42
[ 6992.867921]  42
[ 6992.867922]  4.24242E+02
[ 6992.867922] C Bindings are working.
[ 6992.867923] Registering character device number...
[ 6992.867925] Registered character device number 249
[ 6992.867926] Creating class...
[ 6992.868085] Created class, check /sys/class/classname
[ 6992.868086] Creating device...
[ 6992.868089] ------------[ cut here ]------------
[ 6992.868094] WARNING: CPU: 0 PID: 11265 at /build/linux-EAZfyE/linux-4.9.51/lib/kobject.c:210 kobject_add_internal+0x25a/0x320
[ 6992.868094] kobject: (ffff9e0a056fe300): attempted to be registered with empty name!
[ 6992.868095] Modules linked in: hello(O+) vboxsf(O) vboxguest(O) nls_utf8 isofs loop ppdev parport_pc parport crct10dif_pclmul evdev pcspkr serio_raw sg crc32_pclmul ghash_clmulni_intel battery video button ac ip_tables x_tables autofs4 ext4 crc16 jbd2 crc32c_generic fscrypto ecb mbcache sd_mod crc32c_intel floppy ahci libahci aesni_intel aes_x86_64 glue_helper lrw gf128mul ablk_helper cryptd e1000 libata scsi_mod psmouse i2c_piix4 [last unloaded: hello]
[ 6992.868114] CPU: 0 PID: 11265 Comm: insmod Tainted: G        W  O    4.9.0-4-amd64 #1 Debian 4.9.51-1
[ 6992.868115] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 6992.868116]  0000000000000000 ffffffffa9129974 ffffb64700ec78b0 0000000000000000
[ 6992.868118]  ffffffffa8e76eae ffff9e0a056fe300 ffffb64700ec7908 0000000000000000
[ 6992.868119]  00000000ffffffea 0000000000000000 000000000f90000d ffffffffa8e76f2f
[ 6992.868121] Call Trace:
[ 6992.868123]  [<ffffffffa9129974>] ? dump_stack+0x5c/0x78
[ 6992.868125]  [<ffffffffa8e76eae>] ? __warn+0xbe/0xe0
[ 6992.868126]  [<ffffffffa8e76f2f>] ? warn_slowpath_fmt+0x5f/0x80
[ 6992.868127]  [<ffffffffa912c7da>] ? kobject_add_internal+0x25a/0x320
[ 6992.868128]  [<ffffffffa912c915>] ? kobject_add+0x75/0xd0
[ 6992.868129]  [<ffffffffa8eb8934>] ? __wake_up+0x34/0x50
[ 6992.868131]  [<ffffffffa92727e7>] ? get_device_parent.isra.20+0x177/0x1c0
[ 6992.868132]  [<ffffffffa9273464>] ? device_add+0xd4/0x620
[ 6992.868134]  [<ffffffffa8f9e6b3>] ? kstrdup+0x43/0x60
[ 6992.868135]  [<ffffffffa9273b99>] ? device_create_groups_vargs+0xd9/0xf0
[ 6992.868136]  [<ffffffffa9273c21>] ? device_create+0x51/0x70
[ 6992.868139]  [<ffffffffc0691ed6>] ? linux__device__device_create+0x5c/0x78 [hello]
[ 6992.868141]  [<ffffffffc06918b1>] ? ada_foo+0x581/0x660 [hello]
[ 6992.868143]  [<ffffffffc06915c8>] ? ada_foo+0x298/0x660 [hello]
[ 6992.868144]  [<ffffffffc06914cd>] ? ada_foo+0x19d/0x660 [hello]
[ 6992.868146]  [<ffffffffc0691434>] ? ada_foo+0x104/0x660 [hello]
[ 6992.868148]  [<ffffffffc0694001>] ? interfaces__c__to_ada__9+0x237/0x27e [hello]
[ 6992.868149]  [<ffffffffa8ffffff>] ? do_dentry_open+0xef/0x300
[ 6992.868151]  [<ffffffffc0691010>] ? init_thread+0x10/0x10 [hello]
[ 6992.868152]  [<ffffffffc0691037>] ? init_module+0x27/0x40 [hello]
[ 6992.868154]  [<ffffffffa8e0218b>] ? do_one_initcall+0x4b/0x180
[ 6992.868155]  [<ffffffffa8fc499d>] ? __vunmap+0x6d/0xc0
[ 6992.868156]  [<ffffffffa8f7b25c>] ? do_init_module+0x5b/0x1ed
[ 6992.868157]  [<ffffffffa8effca2>] ? load_module+0x2602/0x2a50
[ 6992.868158]  [<ffffffffa8efc400>] ? __symbol_put+0x60/0x60
[ 6992.868160]  [<ffffffffa8f00336>] ? SYSC_finit_module+0xc6/0xf0
[ 6992.868162]  [<ffffffffa94085bb>] ? system_call_fast_compare_end+0xc/0x9b
[ 6992.868162] ---[ end trace e1d96bcd1e7e4b5c ]---
[ 6992.868404] Created device, check /dev
[ 6992.868404] After Ada
[ 6992.934611] Will destroy device
[ 6992.934891] Will destroy class
[ 6992.935085] Will unregister device number 249
[ 6992.935088] Goodbye Ada.
alkhimey commented 6 years ago

Looks like the problem is with creating the device.