[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tmpfs loses unlinked files
From: |
Richard Braun |
Subject: |
Re: tmpfs loses unlinked files |
Date: |
Sat, 28 Feb 2015 13:05:07 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sat, Feb 28, 2015 at 12:22:47PM +0100, Samuel Thibault wrote:
> For instance the X server crashes on fvwm startup, or mupdf crashes,
> when /run is served by a tmpfs.
>
> What happens is that they create an shm (shmget, thus a file in
> /run/shm/, backed by tmpfs), then map it (shmat, i.e. open/mmap/close of
> the file), then remove access to it (shmctl(IPC_RMID), i.e. unlink the
> file).
>
> The issue is that even if the file is still mapped, unlinking it from
> tmpfs makes tmpfs mach_port_deallocate the memobj, which apparently
> drops the object completely, and subsequent accesses to the mmap thus
> fail with SIGBUS. Would there be a way for tmpfs to know about the
> mappings of the pager object, to avoid shutting it down? Or a way to
> keep the object alive even if tmpfs has deallocated its port to it?
> I don't know memory management enough to answer it.
I'd say that glibc (in mmap) should add a reference to the file. On
munmap or process termination, all references are dropped.
--
Richard Braun