Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2193810imm; Tue, 10 Jul 2018 15:09:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpflNWOHZMZhx+40WMHnBFiNIDruM5d93gJULFL5gOOE6DUYBs2v0hBcurDfSoXsmzxAk6vl X-Received: by 2002:a17:902:7581:: with SMTP id j1-v6mr2526294pll.218.1531260578423; Tue, 10 Jul 2018 15:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531260578; cv=none; d=google.com; s=arc-20160816; b=Ydj4D2fEzuPRwrbGACwLy6hafOUHE0pMFAB9W1l3Od1NSFii4FSx+FNE8R8vNJurPq 7a09Ez/pEVA4cHwTaiE00N1kZdot0S5aYela1owlJTpHe+0P4UZ9aYMk8FV0Y7AQuoce IHHWuYsXSZalHHqJSEsCdc0wV5p7k47WThrw8qzdTFIbwp29rvk04S55Ai7FEH1+cYtK zpkltLkwwf4WN4EZD5cVgNlI72m0MCIOMRYJypQayYHM2811qCqE8WvjOBjqEC16CjhJ fD7EnIxmxBe9pIHR3fa0rigilB0qCErMKapK6nfBs9DV/DFF3aCVTHNZSDqKGwG1DJbD ykag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=OVCDyWyu0aZ6/R+hN/bQN5w0VvEfJmHnw8MtBM8trG8=; b=Hbd+nXsOAZI4kFwQs68qvsEroPUZFyKSZmRZPSu6mF57lgrUFxNrnQeJKj1e5bk79n VGeBhmSc/1y0f0bRcyUrA5HxD7sFh3rBj7aof01E/cIb0O6y3WLxRr37v4Du4P2WF2Ii x+MOke2aHJzj9l32P3aG63mEtZJEd1A+eZR6iF2ZKHgpd8oEKiDrblX0MsYNW1+2axIn SKguOCYsfRZbAicgRsdcpjLlDrKKY0dEKTCoAIAf76/bnznIvtmyw/7t8vTQ5TvFa5YD ofr/n5xriyipPxcqqC4zi/2kjntCU1e0eIgwGRDdz36eLofg2p16DkH4r4ZLcT4Jp/4Y mo9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22-v6si17297892plo.123.2018.07.10.15.09.22; Tue, 10 Jul 2018 15:09:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732334AbeGJWJn (ORCPT + 99 others); Tue, 10 Jul 2018 18:09:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:53852 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732237AbeGJWJn (ORCPT ); Tue, 10 Jul 2018 18:09:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 03ADAAD0B; Tue, 10 Jul 2018 22:08:35 +0000 (UTC) Date: Tue, 10 Jul 2018 15:08:30 -0700 From: Davidlohr Bueso To: Manfred Spraul Cc: Andrew Morton , Dmitry Vyukov , LKML , 1vier1@web.de, Kees Cook Subject: Re: [PATCH 01/12] ipc: reorganize initialization of kern_ipc_perm.id Message-ID: <20180710220830.pvdvq7aovja5nrmf@linux-r8p5> References: <20180709151019.1336-1-manfred@colorfullife.com> <20180709151019.1336-2-manfred@colorfullife.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180709151019.1336-2-manfred@colorfullife.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 09 Jul 2018, Manfred Spraul wrote: >ipc_addid() initializes kern_ipc_perm.id after having called >ipc_idr_alloc(). > >Thus a parallel semop() or msgrcv() that uses ipc_obtain_object_idr() >may see an uninitialized value. > >The patch moves all accesses to kern_ipc_perm.id under the spin_lock(). Yeah this is a lot better than my kzalloc() idea. I was considering completions to avoid these races with ->getnew(), but careful init beats that idea for obvious reasons. The only thing I would say is that the title should be more descriptive. Unlike the next patch, this one isn't really reorganizing anything. How about: ipc: compute kern_ipc_perm.id under the ipc lock for stat cmds > >The issues is related to the finding of >syzbot+2827ef6b3385deb07eaf@syzkaller.appspotmail.com: >syzbot found an issue with kern_ipc_perm.seq > >Signed-off-by: Manfred Spraul >Cc: Dmitry Vyukov >Cc: Kees Cook >Cc: Davidlohr Bueso Reviewed-by: Davidlohr Bueso