Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-24 Thread Manfred Spraul
Hi all, On 09/24/2013 02:04 AM, Davidlohr Bueso wrote: (In reality, I suspect the reference count is never elevated in practice, so there is only one case that calls the security freeing thing, so this may all be pretty much theoretical, but at least from a logic standpoint the code clearly

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-24 Thread Manfred Spraul
Hi Linus, On 09/24/2013 03:22 AM, Linus Torvalds wrote: On Mon, Sep 23, 2013 at 5:04 PM, Davidlohr Bueso wrote: Ok, so here's the code - again I've tested it with LTP on the resources I have. This looks good to me. Manfred, mind giving this a look-over and see if this resolves your race

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-24 Thread Manfred Spraul
Hi Linus, On 09/24/2013 03:22 AM, Linus Torvalds wrote: On Mon, Sep 23, 2013 at 5:04 PM, Davidlohr Bueso davidl...@hp.com wrote: Ok, so here's the code - again I've tested it with LTP on the resources I have. This looks good to me. Manfred, mind giving this a look-over and see if this

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-24 Thread Manfred Spraul
Hi all, On 09/24/2013 02:04 AM, Davidlohr Bueso wrote: (In reality, I suspect the reference count is never elevated in practice, so there is only one case that calls the security freeing thing, so this may all be pretty much theoretical, but at least from a logic standpoint the code clearly

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Linus Torvalds
On Mon, Sep 23, 2013 at 5:04 PM, Davidlohr Bueso wrote: > > Ok, so here's the code - again I've tested it with LTP on the resources > I have. This looks good to me. Manfred, mind giving this a look-over and see if this resolves your race concerns too? Linus -- To unsubscribe from

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Davidlohr Bueso
On Mon, 2013-09-23 at 09:54 -0700, Linus Torvalds wrote: > On Sun, Sep 22, 2013 at 11:42 PM, Davidlohr Bueso wrote: > >> > >> More importantly, it's wrong. You do the call_rcu() unconditionally, > >> but it might not be the last use! You need to do it with the same > >> logic ipc_rcu_putref(),

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Linus Torvalds
On Sun, Sep 22, 2013 at 11:42 PM, Davidlohr Bueso wrote: >> >> More importantly, it's wrong. You do the call_rcu() unconditionally, >> but it might not be the last use! You need to do it with the same >> logic ipc_rcu_putref(), namely at the dropping of the last reference. > > This is the way IPC

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Davidlohr Bueso
On Sat, 2013-09-21 at 11:58 -0700, Linus Torvalds wrote: > On Sat, Sep 21, 2013 at 11:30 AM, Davidlohr Bueso wrote: > > > > IPC uses security_xxx_free() at two levels: for freeing the structure > > (ie: shm_destroy()) and cleaning up upon error when creating the > > structure (ie: newseg()). For

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Davidlohr Bueso
On Sat, 2013-09-21 at 11:58 -0700, Linus Torvalds wrote: On Sat, Sep 21, 2013 at 11:30 AM, Davidlohr Bueso davidl...@hp.com wrote: IPC uses security_xxx_free() at two levels: for freeing the structure (ie: shm_destroy()) and cleaning up upon error when creating the structure (ie:

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Linus Torvalds
On Sun, Sep 22, 2013 at 11:42 PM, Davidlohr Bueso davidl...@hp.com wrote: More importantly, it's wrong. You do the call_rcu() unconditionally, but it might not be the last use! You need to do it with the same logic ipc_rcu_putref(), namely at the dropping of the last reference. This is the

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Davidlohr Bueso
On Mon, 2013-09-23 at 09:54 -0700, Linus Torvalds wrote: On Sun, Sep 22, 2013 at 11:42 PM, Davidlohr Bueso davidl...@hp.com wrote: More importantly, it's wrong. You do the call_rcu() unconditionally, but it might not be the last use! You need to do it with the same logic ipc_rcu_putref(),

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-23 Thread Linus Torvalds
On Mon, Sep 23, 2013 at 5:04 PM, Davidlohr Bueso davidl...@hp.com wrote: Ok, so here's the code - again I've tested it with LTP on the resources I have. This looks good to me. Manfred, mind giving this a look-over and see if this resolves your race concerns too? Linus -- To

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-21 Thread Linus Torvalds
On Sat, Sep 21, 2013 at 11:30 AM, Davidlohr Bueso wrote: > > IPC uses security_xxx_free() at two levels: for freeing the structure > (ie: shm_destroy()) and cleaning up upon error when creating the > structure (ie: newseg()). For both I believe we can actually use RCU. > What do you think of the

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-21 Thread Davidlohr Bueso
Hi Eric, On Fri, 2013-09-20 at 14:08 -0400, Eric Paris wrote: > > > Note that Linus suggested a good alternative to patches 1 and 3: use > > > kfree_rcu() and delay the freeing of the security structure. I would > > > much prefer that approach to doing security checks with the lock held, > > >

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-21 Thread Davidlohr Bueso
Hi Eric, On Fri, 2013-09-20 at 14:08 -0400, Eric Paris wrote: Note that Linus suggested a good alternative to patches 1 and 3: use kfree_rcu() and delay the freeing of the security structure. I would much prefer that approach to doing security checks with the lock held, but I want to

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-21 Thread Linus Torvalds
On Sat, Sep 21, 2013 at 11:30 AM, Davidlohr Bueso davidl...@hp.com wrote: IPC uses security_xxx_free() at two levels: for freeing the structure (ie: shm_destroy()) and cleaning up upon error when creating the structure (ie: newseg()). For both I believe we can actually use RCU. What do you

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-20 Thread Eric Paris
On Thu, 2013-09-19 at 14:22 -0700, Davidlohr Bueso wrote: > On Sun, 2013-09-15 at 20:04 -0700, Davidlohr Bueso wrote: > > This patchset deals with the selinux and rmid races Manfred found on > > the ipc scaling work that has been going on. It specifically addresses > > shared mem and msg queues.

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-20 Thread Eric Paris
On Thu, 2013-09-19 at 14:22 -0700, Davidlohr Bueso wrote: On Sun, 2013-09-15 at 20:04 -0700, Davidlohr Bueso wrote: This patchset deals with the selinux and rmid races Manfred found on the ipc scaling work that has been going on. It specifically addresses shared mem and msg queues. While

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-19 Thread Davidlohr Bueso
On Sun, 2013-09-15 at 20:04 -0700, Davidlohr Bueso wrote: > This patchset deals with the selinux and rmid races Manfred found on > the ipc scaling work that has been going on. It specifically addresses > shared mem and msg queues. While semaphores still need updated, I want > to make sure these

Re: [PATCH 0/4] ipc: shm and msg fixes

2013-09-19 Thread Davidlohr Bueso
On Sun, 2013-09-15 at 20:04 -0700, Davidlohr Bueso wrote: This patchset deals with the selinux and rmid races Manfred found on the ipc scaling work that has been going on. It specifically addresses shared mem and msg queues. While semaphores still need updated, I want to make sure these are

[PATCH 0/4] ipc: shm and msg fixes

2013-09-15 Thread Davidlohr Bueso
This patchset deals with the selinux and rmid races Manfred found on the ipc scaling work that has been going on. It specifically addresses shared mem and msg queues. While semaphores still need updated, I want to make sure these are correct first. Also, Manfred had already sent out a patchset

[PATCH 0/4] ipc: shm and msg fixes

2013-09-15 Thread Davidlohr Bueso
This patchset deals with the selinux and rmid races Manfred found on the ipc scaling work that has been going on. It specifically addresses shared mem and msg queues. While semaphores still need updated, I want to make sure these are correct first. Also, Manfred had already sent out a patchset