Re: forcibly unmap pages in driver?

2001-06-06 Thread Dan Maas
Just an update to my situation... I've implemented my idea of clearing the associated PTE's when I need to free the DMA buffer, then re-filling them in nopage(). This seems to work fine; if the user process tries anything fishy, it gets a SIGBUS instead of accessing the old mapping. I

Re: forcibly unmap pages in driver?

2001-06-06 Thread Martin Diehl
On Tue, 5 Jun 2001, Pete Wyckoff wrote: > [EMAIL PROTECTED] said: > > user-space program is still running. I need to remove the user-space > > mapping -- otherwise the user process would still have access to the > > now-freed pages. I need an inverse of remap_page_range(). > > That seems a bit

Re: forcibly unmap pages in driver?

2001-06-06 Thread Martin Diehl
On Tue, 5 Jun 2001, Pete Wyckoff wrote: [EMAIL PROTECTED] said: user-space program is still running. I need to remove the user-space mapping -- otherwise the user process would still have access to the now-freed pages. I need an inverse of remap_page_range(). That seems a bit perverse.

Re: forcibly unmap pages in driver?

2001-06-06 Thread Dan Maas
Just an update to my situation... I've implemented my idea of clearing the associated PTE's when I need to free the DMA buffer, then re-filling them in nopage(). This seems to work fine; if the user process tries anything fishy, it gets a SIGBUS instead of accessing the old mapping. I

Re: forcibly unmap pages in driver?

2001-06-05 Thread Dan Maas
>> Later, the program calls the ioctl() again to set a smaller >> buffer size, or closes the file descriptor. At this point >> I'd like to shrink the buffer or free it completely. But I >> can't assume that the program will be nice and munmap() the >> region for me > Look at drivers/char/drm,

Re: forcibly unmap pages in driver?

2001-06-05 Thread Pete Wyckoff
[EMAIL PROTECTED] said: > My driver uses a variable-size DMA buffer that it shares with user-space; I > provide an ioctl() to choose the buffer size and allocate the buffer. Say > the user program chooses a large buffer size, and mmap()s the entire buffer. > Later, the program calls the ioctl()

Re: forcibly unmap pages in driver?

2001-06-05 Thread Dan Maas
> That seems a bit perverse. How will the poor userspace program know > not to access the pages you have yanked away from it? If you plan > to kill it, better to do that directly. If you plan to signal it > that the mapping is gone, it can just call munmap() itself. Thanks Pete. I will

Re: forcibly unmap pages in driver?

2001-06-05 Thread Pete Wyckoff
[EMAIL PROTECTED] said: > I am writing a device driver that, like many others, exposes a shared memory > region to user-space via mmap(). The region is allocated with vmalloc(), the > pages are marked reserved, and the user-space mapping is implemented with > remap_page_range(). > > In my

Re: forcibly unmap pages in driver?

2001-06-05 Thread Pete Wyckoff
[EMAIL PROTECTED] said: I am writing a device driver that, like many others, exposes a shared memory region to user-space via mmap(). The region is allocated with vmalloc(), the pages are marked reserved, and the user-space mapping is implemented with remap_page_range(). In my driver, I

Re: forcibly unmap pages in driver?

2001-06-05 Thread Dan Maas
That seems a bit perverse. How will the poor userspace program know not to access the pages you have yanked away from it? If you plan to kill it, better to do that directly. If you plan to signal it that the mapping is gone, it can just call munmap() itself. Thanks Pete. I will explain

Re: forcibly unmap pages in driver?

2001-06-05 Thread Pete Wyckoff
[EMAIL PROTECTED] said: My driver uses a variable-size DMA buffer that it shares with user-space; I provide an ioctl() to choose the buffer size and allocate the buffer. Say the user program chooses a large buffer size, and mmap()s the entire buffer. Later, the program calls the ioctl() again

Re: forcibly unmap pages in driver?

2001-06-05 Thread Dan Maas
Later, the program calls the ioctl() again to set a smaller buffer size, or closes the file descriptor. At this point I'd like to shrink the buffer or free it completely. But I can't assume that the program will be nice and munmap() the region for me Look at drivers/char/drm, for example.

forcibly unmap pages in driver?

2001-06-04 Thread Dan Maas
I am writing a device driver that, like many others, exposes a shared memory region to user-space via mmap(). The region is allocated with vmalloc(), the pages are marked reserved, and the user-space mapping is implemented with remap_page_range(). In my driver, I may have to free the underlying

forcibly unmap pages in driver?

2001-06-04 Thread Dan Maas
I am writing a device driver that, like many others, exposes a shared memory region to user-space via mmap(). The region is allocated with vmalloc(), the pages are marked reserved, and the user-space mapping is implemented with remap_page_range(). In my driver, I may have to free the underlying