Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1301673

Does vm_operations_struct require a .owner field?

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Does vm_operations_struct require a .owner field?
Date 2016-01-05 17:30 +0100
Message-ID <qNCEG-5ih-1@gated-at.bofh.it> (permalink)
References <qNCEG-5ih-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Does vm_operations_struct require a .owner field? Alan Stern <stern@rowland.harvard.edu> - 2016-01-05 17:30 +0100
  Re: Does vm_operations_struct require a .owner field? "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-01-05 22:00 +0100
    Re: Does vm_operations_struct require a .owner field? Alan Stern <stern@rowland.harvard.edu> - 2016-01-05 22:40 +0100
      Re: Does vm_operations_struct require a .owner field? "Steinar H. Gunderson" <sesse@google.com> - 2016-01-06 01:00 +0100
      [PATCH] Add support for usbfs zerocopy. "Steinar H. Gunderson" <sesse@google.com> - 2016-01-06 01:00 +0100
        Re: [PATCH] Add support for usbfs zerocopy. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-01-06 01:20 +0100
          Re: [PATCH] Add support for usbfs zerocopy. "Steinar H. Gunderson" <sesse@google.com> - 2016-01-06 01:30 +0100
          [PATCH v2] Add support for usbfs zerocopy. "Steinar H. Gunderson" <sesse@google.com> - 2016-01-06 01:30 +0100
            Re: [PATCH v2] Add support for usbfs zerocopy. Lingzhu Xiang <lingzhu.xiang@mail.utoronto.ca> - 2016-01-07 03:40 +0100
              Re: [PATCH v2] Add support for usbfs zerocopy. Alan Stern <stern@rowland.harvard.edu> - 2016-01-07 16:50 +0100
                Re: [PATCH v2] Add support for usbfs zerocopy. Oliver Neukum <oneukum@suse.com> - 2016-01-11 12:20 +0100
                Re: [PATCH v2] Add support for usbfs zerocopy. Oliver Neukum <oneukum@suse.com> - 2016-01-12 11:10 +0100
            Re: [PATCH v2] Add support for usbfs zerocopy. Lingzhu Xiang <lingzhu.xiang@mail.utoronto.ca> - 2016-01-09 05:20 +0100
              Re: [PATCH v2] Add support for usbfs zerocopy. "Steinar H. Gunderson" <sesse@google.com> - 2016-01-09 12:00 +0100
        Re: [PATCH] Add support for usbfs zerocopy. Christoph Hellwig <hch@infradead.org> - 2016-01-06 07:50 +0100
          Re: [PATCH] Add support for usbfs zerocopy. "Steinar H. Gunderson" <sesse@google.com> - 2016-01-06 15:50 +0100
            Re: [PATCH] Add support for usbfs zerocopy. Peter Stuge <peter@stuge.se> - 2016-01-06 16:30 +0100
              Re: [PATCH] Add support for usbfs zerocopy. "Steinar H. Gunderson" <sesse@google.com> - 2016-01-06 16:40 +0100
              Re: [PATCH] Add support for usbfs zerocopy. Alan Stern <stern@rowland.harvard.edu> - 2016-01-06 16:40 +0100
            Re: [PATCH] Add support for usbfs zerocopy. Alan Stern <stern@rowland.harvard.edu> - 2016-01-06 16:40 +0100
              Re: [PATCH] Add support for usbfs zerocopy. Christoph Hellwig <hch@infradead.org> - 2016-01-08 10:50 +0100
                RE: [PATCH] Add support for usbfs zerocopy. David Laight <David.Laight@ACULAB.COM> - 2016-01-08 11:30 +0100
                Re: [PATCH] Add support for usbfs zerocopy. Oliver Neukum <oneukum@suse.com> - 2016-01-08 17:10 +0100
                Re: [PATCH] Add support for usbfs zerocopy. "Steinar H. Gunderson" <sesse@google.com> - 2016-01-12 22:30 +0100
                Re: [PATCH] Add support for usbfs zerocopy. Alan Stern <stern@rowland.harvard.edu> - 2016-01-12 23:10 +0100
                Re: [PATCH] Add support for usbfs zerocopy. Lingzhu Xiang <lingzhu.xiang@mail.utoronto.ca> - 2016-01-13 08:10 +0100
                Re: [PATCH] Add support for usbfs zerocopy. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-01-13 18:30 +0100
            Re: [PATCH] Add support for usbfs zerocopy. Christoph Hellwig <hch@infradead.org> - 2016-01-08 10:50 +0100

csiph-web