Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Aug 2013 17:02:24 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org
Cc:        Alan Cox <alc@freebsd.org>, George Liaskos <geo.liaskos@gmail.com>
Subject:   Re: Default kern.ipc.shm_allow_removed to 1
Message-ID:  <201308301702.24465.jhb@freebsd.org>
In-Reply-To: <CANcjpOAnBjKdwNJQzMnxJ2TPo4318snH0MSqvrzbLveN_qBm-g@mail.gmail.com>
References:  <CANcjpOAnBjKdwNJQzMnxJ2TPo4318snH0MSqvrzbLveN_qBm-g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, August 30, 2013 9:30:09 am George Liaskos wrote:
> Would it be feasible to change the default for 10?
> 
> There is a lot of code that depends on the following behavior:
> 
> void* address = shmat(shmkey, NULL /* desired address */, 0 /* flags */);
> // Here we mark the shared memory for deletion. Since we attached it in the
> // line above, it doesn't actually get deleted but, if we crash, this means
> // that the kernel will automatically clean it up for us.
> shmctl(shmkey, IPC_RMID, 0);
> if (address == kInvalidAddress)
>   return NULL;
> 
> The above snip is from Google Chrome, under FreeBSD with the current
> defaults that memory becomes unusable. If you don't follow that route
> it becomes extremely difficult to cleanup especially in a beast like
> Chrome.
> 
> From what I understand PC-BSD defaults to 1, OpenBSD and Linux also
> allow this behavior.
> 
> Am I missing something obvious here? It seems to me that the pragmatic
> approach is to change this.

Hmm, I can see why that is useful though it seems to violate POSIX.  This 
claims that IPC_RMID should delete the segment immediately (which does not 
seem useful):

http://pubs.opengroup.org/onlinepubs/007904975/functions/shmctl.html

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308301702.24465.jhb>