Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-24 Thread Andrew Morton
On Sun, 23 Nov 2014 19:23:53 +0100 Manfred Spraul wrote: > Subject: [PATCH] ipc/sem.c: Fully initialize sem_array before making it > visible > > ipc_addid() makes a new ipc identifier visible to everyone. > New objects start as locked, so that the caller can complete > the initialization

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-24 Thread Rafael Aquini
On Sun, Nov 23, 2014 at 01:36:51PM -0800, Davidlohr Bueso wrote: > On Sun, 2014-11-23 at 16:03 -0500, Rik van Riel wrote: > > On 11/23/2014 01:23 PM, Manfred Spraul wrote: > > > Hi Rik, > > > > > > On 11/21/2014 08:52 PM, Rik van Riel wrote: > > >> When manipulating just one semaphore with semop,

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-24 Thread Rafael Aquini
On Sun, Nov 23, 2014 at 01:36:51PM -0800, Davidlohr Bueso wrote: On Sun, 2014-11-23 at 16:03 -0500, Rik van Riel wrote: On 11/23/2014 01:23 PM, Manfred Spraul wrote: Hi Rik, On 11/21/2014 08:52 PM, Rik van Riel wrote: When manipulating just one semaphore with semop, sem_lock only

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-24 Thread Andrew Morton
On Sun, 23 Nov 2014 19:23:53 +0100 Manfred Spraul manf...@colorfullife.com wrote: Subject: [PATCH] ipc/sem.c: Fully initialize sem_array before making it visible ipc_addid() makes a new ipc identifier visible to everyone. New objects start as locked, so that the caller can complete the

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-23 Thread Davidlohr Bueso
On Sun, 2014-11-23 at 16:03 -0500, Rik van Riel wrote: > On 11/23/2014 01:23 PM, Manfred Spraul wrote: > > Hi Rik, > > > > On 11/21/2014 08:52 PM, Rik van Riel wrote: > >> When manipulating just one semaphore with semop, sem_lock only > >> takes that single semaphore's lock. This creates a

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-23 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/23/2014 01:23 PM, Manfred Spraul wrote: > Hi Rik, > > On 11/21/2014 08:52 PM, Rik van Riel wrote: >> When manipulating just one semaphore with semop, sem_lock only >> takes that single semaphore's lock. This creates a problem during >>

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-23 Thread Manfred Spraul
Hi Rik, On 11/21/2014 08:52 PM, Rik van Riel wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during initialization of the semaphore array, when the data structures used by sem_lock have not been set up yet. The

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-23 Thread Manfred Spraul
Hi Rik, On 11/21/2014 08:52 PM, Rik van Riel wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during initialization of the semaphore array, when the data structures used by sem_lock have not been set up yet. The

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-23 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/23/2014 01:23 PM, Manfred Spraul wrote: Hi Rik, On 11/21/2014 08:52 PM, Rik van Riel wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during initialization of

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-23 Thread Davidlohr Bueso
On Sun, 2014-11-23 at 16:03 -0500, Rik van Riel wrote: On 11/23/2014 01:23 PM, Manfred Spraul wrote: Hi Rik, On 11/21/2014 08:52 PM, Rik van Riel wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-22 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/22/2014 02:14 PM, Manfred Spraul wrote: > On 11/21/2014 09:29 PM, Rik van Riel wrote: >> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >> >> On 11/21/2014 03:09 PM, Andrew Morton wrote: >>> On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel >>>

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-22 Thread Manfred Spraul
On 11/21/2014 09:29 PM, Rik van Riel wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 03:09 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock.

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-22 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/22/2014 08:56 AM, Manfred Spraul wrote: > Hi Rik, > > good catch - I completely forgot to check the initialization > > On 11/22/2014 04:40 AM, Rik van Riel wrote: >> >> newary initializes a bunch of things after the call to ipc_addid, >>

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-22 Thread Manfred Spraul
Hi Rik, good catch - I completely forgot to check the initialization On 11/22/2014 04:40 AM, Rik van Riel wrote: newary initializes a bunch of things after the call to ipc_addid, however some things are initialized inside ipc_addid as well Looking closer at newary, I suppose that it should

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-22 Thread Manfred Spraul
Hi Rik, good catch - I completely forgot to check the initialization On 11/22/2014 04:40 AM, Rik van Riel wrote: newary initializes a bunch of things after the call to ipc_addid, however some things are initialized inside ipc_addid as well Looking closer at newary, I suppose that it should

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-22 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/22/2014 08:56 AM, Manfred Spraul wrote: Hi Rik, good catch - I completely forgot to check the initialization On 11/22/2014 04:40 AM, Rik van Riel wrote: newary initializes a bunch of things after the call to ipc_addid, however some

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-22 Thread Manfred Spraul
On 11/21/2014 09:29 PM, Rik van Riel wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 03:09 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel r...@redhat.com wrote: When manipulating just one semaphore with semop, sem_lock only takes that single

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-22 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/22/2014 02:14 PM, Manfred Spraul wrote: On 11/21/2014 09:29 PM, Rik van Riel wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 03:09 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel r...@redhat.com

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 07:56 PM, Davidlohr Bueso wrote: > On Fri, 2014-11-21 at 18:03 -0500, Rik van Riel wrote: >> In other words, if you try to use a semaphore array before getsem >> returns, you can oops the task that calls semop. > > This seems bogus

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Davidlohr Bueso
On Fri, 2014-11-21 at 18:03 -0500, Rik van Riel wrote: > On 11/21/2014 03:42 PM, Andrew Morton wrote: > > On Fri, 21 Nov 2014 15:29:27 -0500 Rik van Riel > > wrote: > > > >> On 11/21/2014 03:09 PM, Andrew Morton wrote: > >>> On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel > >>> wrote: > >>> >

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 03:42 PM, Andrew Morton wrote: > On Fri, 21 Nov 2014 15:29:27 -0500 Rik van Riel > wrote: > >> On 11/21/2014 03:09 PM, Andrew Morton wrote: >>> On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel >>> wrote: >>> When manipulating

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Andrew Morton
On Fri, 21 Nov 2014 15:29:27 -0500 Rik van Riel wrote: > On 11/21/2014 03:09 PM, Andrew Morton wrote: > > On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel > > wrote: > > > >> When manipulating just one semaphore with semop, sem_lock only > >> takes that single semaphore's lock. This creates a

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 03:09 PM, Andrew Morton wrote: > On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel > wrote: > >> When manipulating just one semaphore with semop, sem_lock only >> takes that single semaphore's lock. This creates a problem during >>

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Andrew Morton
On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel wrote: > When manipulating just one semaphore with semop, sem_lock only takes that > single semaphore's lock. This creates a problem during initialization of > the semaphore array, when the data structures used by sem_lock have not > been set up

Re: [PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Rafael Aquini
On Fri, Nov 21, 2014 at 02:52:26PM -0500, Rik van Riel wrote: > When manipulating just one semaphore with semop, sem_lock only takes that > single semaphore's lock. This creates a problem during initialization of > the semaphore array, when the data structures used by sem_lock have not > been set

[PATCH] ipc,sem block sem_lock on sma->lock during sma initialization

2014-11-21 Thread Rik van Riel
When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during initialization of the semaphore array, when the data structures used by sem_lock have not been set up yet. The sma->lock is already held by newary, and we just have to

[PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Rik van Riel
When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during initialization of the semaphore array, when the data structures used by sem_lock have not been set up yet. The sma-lock is already held by newary, and we just have to

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Rafael Aquini
On Fri, Nov 21, 2014 at 02:52:26PM -0500, Rik van Riel wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during initialization of the semaphore array, when the data structures used by sem_lock have not been set up

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Andrew Morton
On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel r...@redhat.com wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during initialization of the semaphore array, when the data structures used by sem_lock have not

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 03:09 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel r...@redhat.com wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock. This creates a problem during

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Andrew Morton
On Fri, 21 Nov 2014 15:29:27 -0500 Rik van Riel r...@redhat.com wrote: On 11/21/2014 03:09 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel r...@redhat.com wrote: When manipulating just one semaphore with semop, sem_lock only takes that single semaphore's lock.

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 03:42 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 15:29:27 -0500 Rik van Riel r...@redhat.com wrote: On 11/21/2014 03:09 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel r...@redhat.com wrote: When

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Davidlohr Bueso
On Fri, 2014-11-21 at 18:03 -0500, Rik van Riel wrote: On 11/21/2014 03:42 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 15:29:27 -0500 Rik van Riel r...@redhat.com wrote: On 11/21/2014 03:09 PM, Andrew Morton wrote: On Fri, 21 Nov 2014 14:52:26 -0500 Rik van Riel r...@redhat.com

Re: [PATCH] ipc,sem block sem_lock on sma-lock during sma initialization

2014-11-21 Thread Rik van Riel
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/21/2014 07:56 PM, Davidlohr Bueso wrote: On Fri, 2014-11-21 at 18:03 -0500, Rik van Riel wrote: In other words, if you try to use a semaphore array before getsem returns, you can oops the task that calls semop. This seems bogus from an