Messages in this thread | | | Date | Wed, 22 Sep 2010 12:31:05 -0700 (PDT) | From | Hugh Dickins <> | Subject | Re: [PATCH 1/2] sysfs: Fail bin file mmap if vma close is implemented. |
| |
On Mon, 20 Sep 2010, Eric W. Biederman wrote: > > It is not reasonably possible to wrap vma->close(). To correctly > wrap close would imply calling close on any vmas that remain when > sysfs_remove_bin_file is called. Finding the proper lists walking > them getting the locking right etc, requires deep knowledge of the > mm subsystem and as such would require assistence from the mm > subsystem to implement. That assistence does not currently exist.
Isn't it fair to assume that the call to sysfs_remove_bin_file() would come from the module (or whatever) that would be handling the ->mmap, ->open, ->close, ->fault etc. calls?
In which case, it has been kept up to date with the reference counting so far: and if it judges that it's apppropriate now to remove bin file, despite having received more mmaps and opens than closes, then I think it should be allowed to make that decision (knowing that your sysfs end will take care not to call it further), even though it wanted to support close while the sysfs bin file was still there.
I think it would be nicer to leave the bin_vma_close() handling as you had it before (but repositioning its sysfs_get_active more carefully, as in your 2/2).
Hugh
| |