lkml.org 
[lkml]   [2016]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectDoes vm_operations_struct require a .owner field?
    Hello:

    Question: The vm_operations_struct structure contains lots of callback
    pointers. Is there any mechanism to prevent the callback routines and
    the structure itself being unloaded from memory (if they are built into
    modules) while the relevant VMAs are still in use?

    Consider a simple example: A user program calls mmap(2) on a device
    file. Later on, the file is closed and the device driver's module is
    unloaded. But until munmap(2) is called or the user program exits, the
    memory mapping and the corresponding VMA will remain in existence.
    (The man page for munmap specifically says "closing the file descriptor
    does not unmap the region".) Thus when the user program does do an
    munmap(), the callback to vma->vm_ops->close will reference nonexistent
    memory and cause an oops.

    Normally this sort of thing is prevented by try_module_get(...->owner).
    But vm_operations_struct doesn't include a .owner field.

    Am I missing something here?

    Alan Stern



    \
     
     \ /
      Last update: 2016-01-05 17:41    [W:4.140 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site