Jump to content
XPEnology Community

Kernel symbols question (module development)


Recommended Posts

Hi guys,

 

I'm having a problem with a module. When trying to load the kernel it complains about a missing symbol, but it exists!:

DiskStation> modprobe sync_file
[   57.291977] sync_file: Unknown symbol anon_inode_getfile (err 0)
modprobe: ERROR: could not insert 'sync_file': Unknown symbol in module, or unknown parameter (see dmesg)
DiskStation> grep anon_inode_getfile /proc/kallsyms 
ffffffff811d07d0 T anon_inode_getfile

 

It exists in Module.symvers:

$ grep anon_inode_getfile Module.symvers
0x00000000      anon_inode_getfile      vmlinux EXPORT_SYMBOL_GPL

 

So I ask for help from those more experienced in linux.

Link to comment
Share on other sites

On 1/20/2023 at 11:09 AM, Orphée said:

Good luck, I'm currently stuck at the point in my topic above.

If you succeed, please tell me :)

Found a solution!!

 

The symbol "anon_inode getfile" is called in the file "drivers/dma-buf/sync_file.c". This file was not created to be compiled as a module, so it does not link with existing symbols.

To resolve this, add the following line to this file, next to "#includes":

 

Quote

#include <linux/module.h>

 

Then add at the end of the file:

 

Quote

MODULE_LICENSE("GPL");

 

Once done, the file will be compiled as a GPL module and can be linked with any other kernel symbol.

 

 

 

  • Thanks 1
Link to comment
Share on other sites

4 hours ago, fbelavenuto said:

Found a solution!!

 

The symbol "anon_inode getfile" is called in the file "drivers/dma-buf/sync_file.c". This file was not created to be compiled as a module, so it does not link with existing symbols.

To resolve this, add the following line to this file, next to "#includes":

 

 

Then add at the end of the file:

 

 

Once done, the file will be compiled as a GPL module and can be linked with any other kernel symbol.

 

 

 

Well played, were you able to build everything ?

 

did you try to build trace_events.ko ?

Link to comment
Share on other sites

  • 1 month later...

Hi !

 

Did you make any progress ?

 

I'm currently stuck there on denverton :

root@DVA3221:/volume1/homes/orphee/i915# insmod i915.ko
Killed

 

dmesg log :

[  136.328456] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[  136.329173] [drm] Driver supports precise vblank timestamp query.
[  136.329812] i915 0000:01:00.0: BAR 6: can't assign [??? 0x00000000 flags 0x20000000] (bogus alignment)
[  136.330824] [drm] Failed to find VBIOS tables (VBT)
[  136.335756] [drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
[  136.335780] BUG: unable to handle kernel NULL pointer dereference at           (null)
[  136.335782] IP: [<          (null)>]           (null)
[  136.335785] PGD 0
[  136.335786] Oops: 0010 [#1] SMP
[  136.335816] Modules linked in: i915(OE+) bitblit(OE) softcursor(OE) video(OE) intel_gtt(OE) drm_kms_helper(OE) syscopyarea(OE) sysfillrect(OE) sysimgblt(OE) fb_sys_fops(OE) drm(OE) sync_file(OE) hdmi(POE) drm_mipi_dsi(OE) drm_panel_orientation_quirks(OE) cfbimgblt(OE) cfbfillrect(OE) cfbcopyarea(OE) fb(OE) fbdev(OE) backlight(OE) fuse 8021q vhost_scsi(O) vhost(O) tcm_loop(O) iscsi_target_mod(O) target_core_user(O) target_core_ep(O) target_core_multi_file(O) target_core_file(O) target_core_iblock(O) target_core_mod(O) syno_extent_pool(PO) rodsp_ep(O) udf isofs synoacl_vfs(PO) btrfs ecryptfs zstd_decompress zstd_compress xxhash raid6_pq xor zram leds_lp3943 denverton_synobios(PO) bnxt_en(O) usblp 
usb_storage bnx2x(O) mdio qede(O) qed(O) mlx5_core(O) mlx4_en(O) mlx4_core(O) mlx_compat(O) atlantic_v2(O)
[  136.335840]  atlantic(O) tn40xx(O) i40e(O) ixgbe(O) be2net(O) i2c_algo_bit igb(O) e1000e(O) sg dm_snapshot dm_bufio crc_itu_t crc_ccitt psnap p8022 llc hfsplus md4 hmac sit tunnel4 ipv6 flashcache_syno(O) flashcache(O) syno_flashcache_control(O) dm_mod arc4 cryptd ecb aes_x86_64 authenc des_generic 
ansi_cprng cts md5 cbc cpufreq_powersave cpufreq_performance cpufreq_stats vxlan ip6_udp_tunnel udp_tunnel ip_tunnel loop sha256_generic synorbd(PO) synofsbd(PO) etxhci_hcd hid_generic usbhid hid virtio_net(OE) atkbd(OE) virtio_pci(OE) virtio(OE) virtio_ring(OE) i8042(OE) processor button(OE) xhci_pci 
xhci_hcd uhci_hcd ehci_pci ehci_hcd usbcore usb_common [last unloaded: denverton_synobios]
[  136.335842] CPU: 1 PID: 13157 Comm: insmod Tainted: P           OE   4.4.180+ #42962
[  136.335843] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
[  136.335844] task: ffff88045a835080 ti: ffff880458e98000 task.ti: ffff880458e98000
[  136.335849] RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
[  136.335849] RSP: 0018:ffff880458e9b8c0  EFLAGS: 00010246
[  136.335850] RAX: ffff8804602f0040 RBX: ffff88045ce1beb8 RCX: 0000000000000000
[  136.335851] RDX: 0000000000000000 RSI: ffff8804602f0340 RDI: ffff8804602f0040
[  136.335851] RBP: ffff880458e9b8e8 R08: ffffffffa0561ef0 R09: ffff8804602f0040
[  136.335852] R10: 00000000fffff000 R11: ffffffffffffffff R12: ffff8804602f0340
[  136.335853] R13: 0000000000000000 R14: ffff88045ce1ba18 R15: ffff8804602f0300
[  136.335854] FS:  00007f0bbeef3740(0000) GS:ffff88047dc40000(0000) knlGS:0000000000000000
[  136.335855] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  136.335855] CR2: 0000000000000000 CR3: 000000045b56c000 CR4: 00000000000006f0
[  136.335858] Stack:
[  136.335860]  ffffffff812fdb11 ffff88045ce1be78 0000000000001000 0000000000001000
[  136.335862]  00000000fffff000 ffff880458e9b8f8 ffffffffa05622c9 ffff880458e9b980
[  136.335863]  ffffffffa0562920 ffff88045ce1b968 ffff8804602f0300 0000000000000000
[  136.335863] Call Trace:
[  136.335871]  [<ffffffff812fdb11>] ? __rb_insert_augmented+0xe1/0x1d0
[  136.335893]  [<ffffffffa05622c9>] drm_mm_interval_tree_add_node+0x99/0xe0 [drm]
[  136.335900]  [<ffffffffa0562920>] drm_mm_insert_node_in_range+0x2a0/0x4e0 [drm]
[  136.336004]  [<ffffffffa0ff5ac6>] i915_gem_gtt_insert+0xb6/0x1c0 [i915]
[  136.336004]  [<ffffffffa100c08e>] __i915_vma_do_pin+0x29e/0x4d0 [i915]
[  136.336004]  [<ffffffffa1012df0>] ? gen8_init_rcs_context+0x50/0x50 [i915]
[  136.336004]  [<ffffffffa1014a41>] logical_render_ring_init+0x2e1/0x3f0 [i915]
[  136.336004]  [<ffffffffa100e6c1>] intel_engines_init+0x51/0xd0 [i915]
[  136.336004]  [<ffffffffa0ffd5dc>] i915_gem_init+0x13c/0x540 [i915]
[  136.336004]  [<ffffffffa0fb7a00>] i915_driver_load+0xbe0/0x16c0 [i915]
[  136.336004]  [<ffffffffa0fc2756>] i915_pci_probe+0x26/0x40 [i915]
[  136.336004]  [<ffffffff8133c246>] pci_device_probe+0x96/0x100
[  136.336004]  [<ffffffff813c4c26>] driver_probe_device+0x1c6/0x280
[  136.336004]  [<ffffffff813c4d5c>] __driver_attach+0x7c/0x80
[  136.336004]  [<ffffffff813c4ce0>] ? driver_probe_device+0x280/0x280
[  136.336004]  [<ffffffff813c2d4b>] bus_for_each_dev+0x6b/0xa0
[  136.336004]  [<ffffffff813c4549>] driver_attach+0x19/0x20
[  136.336004]  [<ffffffff813c4184>] bus_add_driver+0x1a4/0x1e0
[  136.336004]  [<ffffffffa050d000>] ? 0xffffffffa050d000
[  136.336004]  [<ffffffff813c554b>] driver_register+0x6b/0xc0
[  136.336004]  [<ffffffff8133ac37>] __pci_register_driver+0x47/0x50
[  136.336004]  [<ffffffffa050d029>] i915_init+0x29/0x4a [i915]
[  136.336004]  [<ffffffff81000341>] do_one_initcall+0x81/0x130
[  136.336004]  [<ffffffff8116feca>] ? __vunmap+0x9a/0xf0
[  136.336004]  [<ffffffff8117e7d3>] ? kfree+0x143/0x160
[  136.336004]  [<ffffffff810c509b>] do_init_module+0x5b/0x1d0
[  136.336004]  [<ffffffff810c6eb6>] load_module+0x1c26/0x20e0
[  136.336004]  [<ffffffff810c3b30>] ? __symbol_put+0x40/0x40
[  136.336004]  [<ffffffff811992dd>] ? kernel_read+0x3d/0x50
[  136.336004]  [<ffffffff810c7541>] SYSC_finit_module+0x81/0xa0
[  136.336004]  [<ffffffff810c7579>] SyS_finit_module+0x9/0x10
[  136.336004]  [<ffffffff8156dd8a>] entry_SYSCALL_64_fastpath+0x1e/0x8e
[  136.336004] Code:  Bad RIP value.
[  136.336004] RIP  [<          (null)>]           (null)
[  136.336004]  RSP <ffff880458e9b8c0>
[  136.336004] CR2: 0000000000000000
[  136.336411] ---[ end trace d124925a2143c787 ]---

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...