Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1158140

Re: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock
Date Thu, 04 Jun 2015 02:30:01 +0200
Message-ID <pxrcJ-BE-9@gated-at.bofh.it> (permalink)
References <pvCvD-2XX-1@gated-at.bofh.it> <pwGQy-7tv-21@gated-at.bofh.it>
X-Original-To Andrew Morton <akpm@linux-foundation.org>
Content-Type text/plain; charset="UTF-8"
X-Mailer Evolution 3.12.11
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 49
Organization linux.* mail to news gateway
X-Original-Cc Manfred Spraul <manfred@colorfullife.com>, linux-kernel@vger.kernel.org
X-Original-Date Wed, 03 Jun 2015 17:25:23 -0700
X-Original-Message-ID <1433377523.2320.10.camel@stgolabs.net>
X-Original-References <1432944186-7305-1-git-send-email-dave@stgolabs.net> <20150601155223.d919df461c92ff82e3fafd20@linux-foundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1158140

Show key headers only | View raw


On Mon, 2015-06-01 at 15:52 -0700, Andrew Morton wrote:
> On Fri, 29 May 2015 17:03:05 -0700 Davidlohr Bueso <dave@stgolabs.net> wrote:
> 
> > Upon every shm_lock call, we BUG_ON if an error was returned,
> > indicating racing either in idr or in RMID. Move this logic
> > into the locking.
> > 
> > ...
> >
> > --- a/ipc/shm.c
> > +++ b/ipc/shm.c
> > @@ -155,8 +155,14 @@ static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
> >  {
> >  	struct kern_ipc_perm *ipcp = ipc_lock(&shm_ids(ns), id);
> >  
> > -	if (IS_ERR(ipcp))
> > +	if (IS_ERR(ipcp)) {
> > +		/*
> > +		 * We raced in the idr lookup or with RMID,
> > +		 * either way, the ID is busted.
> > +		 */
> > +		BUG_ON(1);
> >  		return (struct shmid_kernel *)ipcp;
> > +	}
> >  
> 
> That's a bit odd.  Why not
> 
> --- a/ipc/shm.c~ipcshm-move-bug_on-check-into-shm_lock-fix-2
> +++ a/ipc/shm.c
> @@ -160,7 +160,7 @@ static inline struct shmid_kernel *shm_l
>  		 * We raced in the idr lookup or with RMID,
>  		 * either way, the ID is busted.
>  		 */
> -		BUG_ON(1);
> +		BUG();
>  		return (struct shmid_kernel *)ipcp;
>  	}

Sure, this is fine.

Thanks,
Davidlohr

--
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 | Find similar | Unroll thread


Thread

Re: [PATCH 1/2] ipc,shm: move BUG_ON check into shm_lock Davidlohr Bueso <dave@stgolabs.net> - 2015-06-04 02:30 +0200

csiph-web