On Wed, Dec 18, 2013 at 04:38:24PM -0800, Davidlohr Bueso wrote: > On Wed, 2013-12-18 at 18:33 -0200, Rafael Aquini wrote: > > After the locking semantics for the SysV IPC API got improved, a couple of > > IPC_RMID race windows were opened because we ended up dropping the > > 'kern_ipc_perm.deleted' check performed way down in ipc_lock(). > > The spotted races got sorted out by re-introducing the old test within > > the racy critical sections. > > > > This patch introduces ipc_valid_object() to consolidate the way we cope with > > IPC_RMID races by using the same abstraction across the API implementation. > > > > Signed-off-by: Rafael Aquini <aqu...@redhat.com> > > Acked-by: Rik van Riel <r...@redhat.com> > > Acked-by: Greg Thelen <gthe...@google.com> > > Reviewed-by: Davidlohr Bueso <davidl...@hp.com> > > [...] > > > +/* > > + * ipc_valid_object() - helper to sort out IPC_RMID races for codepaths > > + * where the respective ipc_ids.rwsem is not being held down. > > + * Checks whether the ipc object is still around or if it's gone already, > > as > > + * ipc_rmid() may have already freed the ID while the ipc lock was > > spinning. > > + * Needs to be called with kern_ipc_perm.lock held -- exception made for > > one > > + * checkpoint case at sys_semtimedop() as noted in code commentary. > > + */ > > +static inline bool ipc_valid_object(struct kern_ipc_perm *perm) > > +{ > > + return perm->deleted == 0; > > +} > > I would like to see .deleted being converted to bool while we're at it > though, that return statement just bugs the hell out of me. Could you > send a patch for that as well? >
Sure, as I mentioned earlier the full .deleted conversion from int to bool it's on my todo list already for a follow-up patch. Thanks! -- Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/