From owner-freebsd-current@FreeBSD.ORG Fri Aug 30 21:16:07 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1FAA429A; Fri, 30 Aug 2013 21:16:07 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E13492FE1; Fri, 30 Aug 2013 21:16:06 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A1EB9B988; Fri, 30 Aug 2013 17:16:05 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Subject: Re: Default kern.ipc.shm_allow_removed to 1 Date: Fri, 30 Aug 2013 17:02:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p28; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201308301702.24465.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 30 Aug 2013 17:16:05 -0400 (EDT) Cc: Alan Cox , George Liaskos X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Aug 2013 21:16:07 -0000 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