|
|
Subscribe / Log in / New account

Retrying revoke()

Retrying revoke()

Posted Apr 11, 2013 2:42 UTC (Thu) by nybble41 (subscriber, #55106)
In reply to: Retrying revoke() by butlerm
Parent article: Retrying revoke()

I would think SIGBUS would make more sense than SIGSEGV. IIRC that is the signal you get when the underlying device reports an I/O error. Simply unmapping the memory could still lead to the wrong data being read (or written!) if a later mmap call reuses the now-free address space.


to post comments

Retrying revoke()

Posted Apr 14, 2013 12:54 UTC (Sun) by Karellen (subscriber, #67644) [Link]

How about, if a process has a mapping on a revoke()d fd, it gets a SIGBUS as a notification *at the time revoke() happens*. If it tries to access the mapping, it gets a SIGSEGV.

Processes could then try to catch SIGBUS and internally mark any mmap()ed regions as invalid if they want. Or mremap() them? Which could return EINVAL rather than EFAULT for revoked mappings?

There will presumably still be race conditions where one thread might access the mapped region before the signal handler completes, but presumably that's still better than the alternative - no notice, guaranteed segv.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds