From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 09 Jul 2014 20:57:28 +0200 (CEST) Received: from mx1.redhat.com ([209.132.183.28]:43209 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6861345AbaGIS5UB73pU (ORCPT ); Wed, 9 Jul 2014 20:57:20 +0200 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s69IvAW8026742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Jul 2014 14:57:10 -0400 Received: from tranklukator.brq.redhat.com (dhcp-1-170.brq.redhat.com [10.34.1.170]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s69Iv6L9024562; Wed, 9 Jul 2014 14:57:07 -0400 Received: by tranklukator.brq.redhat.com (nbSMTP-1.00) for uid 500 oleg@redhat.com; Wed, 9 Jul 2014 20:55:52 +0200 (CEST) Date: Wed, 9 Jul 2014 20:55:49 +0200 From: Oleg Nesterov To: Kees Cook Cc: linux-kernel@vger.kernel.org, Andy Lutomirski , "Michael Kerrisk (man-pages)" , Alexei Starovoitov , Andrew Morton , Daniel Borkmann , Will Drewry , Julien Tinnes , David Drysdale , linux-api@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org, linux-arch@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH v9 09/11] seccomp: introduce writer locking Message-ID: <20140709185549.GB4866@redhat.com> References: <1403911380-27787-1-git-send-email-keescook@chromium.org> <1403911380-27787-10-git-send-email-keescook@chromium.org> <20140709184215.GA4866@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140709184215.GA4866@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 41105 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: oleg@redhat.com Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips On 07/09, Oleg Nesterov wrote: > > On 06/27, Kees Cook wrote: > > > > static u32 seccomp_run_filters(int syscall) > > { > > - struct seccomp_filter *f; > > + struct seccomp_filter *f = ACCESS_ONCE(current->seccomp.filter); > > I am not sure... > > This is fine if this ->filter is the 1st (and only) one, in this case > we can rely on rmb() in the caller. > > But the new filter can be installed at any moment. Say, right after that > rmb() although this doesn't matter. Either we need smp_read_barrier_depends() > after that, or smp_load_acquire() like the previous version did? Wait... and it seems that seccomp_sync_threads() needs smp_store_release() when it sets thread->filter = current->filter by the same reason? OTOH. smp_store_release() in seccomp_attach_filter() can die, "current" doesn't need a barrier to serialize with itself. Oleg.