Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1300063
| From | Manfred Spraul <manfred@colorfullife.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH, RESEND] ipc/shm: handle removed segments gracefully in shm_mmap() |
| Date | 2016-01-02 12:50 +0100 |
| Message-ID | <qMsR4-7AW-19@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <qtH4e-5Cm-11@gated-at.bofh.it> <qtJIK-79T-21@gated-at.bofh.it> <quffA-2hL-3@gated-at.bofh.it> <quiGt-4vC-9@gated-at.bofh.it> <quscN-24Q-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 11/13/2015 08:23 PM, Davidlohr Bueso wrote:
>
> So considering EINVAL, even your approach to bumping up nattach by
> calling
> _shm_open earlier isn't enough. Races exposed to user called rmid can
> still
> occur between dropping the lock and doing ->mmap(). Ultimately this
> leads to
> all ipc_valid_object() checks, as we totally ignore SHM_DEST segments
> nowadays
> since we forbid mapping previously removed segments.
>
> I think this is the first thing we must decide before going forward
> with this
> mess. ipc currently defines invalid objects by merely checking the
> deleted flag.
>
> Manfred, any thoughts?
>
With regards to locking: Sorry, shm is too different to msg/sem/mqueue.
With regards to EIDRM / EINVAL:
When all kernel memory was released, then the kernel cannot find out if
the ID was valid at one time or not.
Thus EIDRM can only be a hint, the OS (kernel/libc) cannot guarantee
that user space will never see something else.
(trivial example: user space sleeps just before the syscall)
So I would not create special code to optimize EIDRM handling for races.
If we sometimes report EINVAL, it would be probably ok as well.
--
Manfred
--
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 | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH, RESEND] ipc/shm: handle removed segments gracefully in shm_mmap() Manfred Spraul <manfred@colorfullife.com> - 2016-01-02 12:50 +0100 Re: [PATCH, RESEND] ipc/shm: handle removed segments gracefully in shm_mmap() "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-01-04 15:20 +0100
csiph-web