Note that there are some explanatory texts on larger screens.

plurals
  1. POkernel paging request fails in try_module_get()
    primarykey
    data
    text
    <p>The following code fails in one of my linux-kernel modules</p> <pre><code>printk("This module: %p\n",THIS_MODULE); DEBUG_USE_COUNT(p); printk("This module refcount: %d\n", module_refcount(THIS_MODULE)); DEBUG_USE_COUNT(p); if (!try_module_get(THIS_MODULE)) { printk_stderr("can't get module\n"); return -EFAULT; } </code></pre> <p>The code itself works in usual environment, but when I try to execute it in the function called from within another module, it fails with paging error. (another module is passed the pointer to the function in question during initialization) Any ideas why module can't increment its reference count being called from another module? Are there any special limitations that apply to try_get_module call?</p> <pre><code>[ 7888.065029] BUG: unable to handle kernel paging request at fa69206 8 [ 7888.067470] IP: [&lt;f926a2b6&gt;] _ZL18open_station_sharePKcP23__camac_ kernel_open_argP4file+0x84/0x8ec [camac_k0607_lsi6] //function in question, calling try_module_get() [ 7888.069014] Call Trace: [ 7888.069014] [&lt;c10ac2b7&gt;] ? __kmalloc+0x104/0x110 [ 7888.069014] [&lt;c12518f5&gt;] ? printk+0xe/0x11 [ 7888.069014] [&lt;f90fae79&gt;] ? T.633+0x46/0x4b [camac_mx] [ 7888.069014] [&lt;f90fb07e&gt;] ? camac_mx_ioctl+0x200/0x228 [camac_mx] //function of another module that calls the one in question [ 7888.069014] [&lt;c10ba415&gt;] ? vfs_ioctl+0x58/0x72 [ 7888.069014] [&lt;c10ba966&gt;] ? do_vfs_ioctl+0x492/0x4d6 [ 7888.069014] [&lt;c109007b&gt;] ? shmem_parse_options+0x167/0x281 [ 7888.069014] [&lt;c10ae69e&gt;] ? fd_install+0x1b/0x38 [ 7888.069014] [&lt;c10ae88b&gt;] ? do_sys_open+0xc8/0xdd [ 7888.069014] [&lt;c10ba9ee&gt;] ? sys_ioctl+0x44/0x64 [ 7888.069014] [&lt;c100305b&gt;] ? sysenter_do_call+0x12/0x28 </code></pre> <p>I would also be great if someone explains the garbage on the top of the printed stack. There should not be any functions in cross-module call. Top three functions on the stack are meaningless for me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload