From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 24 Jun 2014 21:32:17 +0200 (CEST) Received: from mx1.redhat.com ([209.132.183.28]:21411 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6834666AbaFXTcPUNZ9l (ORCPT ); Tue, 24 Jun 2014 21:32:15 +0200 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5OJW1xh026098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Jun 2014 15:32:01 -0400 Received: from tranklukator.brq.redhat.com (dhcp-1-125.brq.redhat.com [10.34.1.125]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s5OJVvYp020303; Tue, 24 Jun 2014 15:31:57 -0400 Received: by tranklukator.brq.redhat.com (nbSMTP-1.00) for uid 500 oleg@redhat.com; Tue, 24 Jun 2014 21:30:59 +0200 (CEST) Date: Tue, 24 Jun 2014 21:30:55 +0200 From: Oleg Nesterov To: Andy Lutomirski Cc: Kees Cook , "linux-kernel@vger.kernel.org" , Alexei Starovoitov , "Michael Kerrisk (man-pages)" , Andrew Morton , Daniel Borkmann , Will Drewry , Julien Tinnes , David Drysdale , Linux API , X86 ML , "linux-arm-kernel@lists.infradead.org" , linux-mips@linux-mips.org, linux-arch , LSM List Subject: Re: [PATCH v7 4/9] seccomp: move no_new_privs into seccomp Message-ID: <20140624193055.GA4482@redhat.com> References: <1403560693-21809-1-git-send-email-keescook@chromium.org> <1403560693-21809-5-git-send-email-keescook@chromium.org> <20140624191815.GA3623@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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: 40767 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 06/24, Andy Lutomirski wrote: > > On Tue, Jun 24, 2014 at 12:18 PM, Oleg Nesterov wrote: > >> > >> -struct seccomp { }; > >> +struct seccomp { > >> + unsigned long flags; > >> +}; > > > > A bit messy ;) > > > > I am wondering if we can simply do > > > > static inline bool current_no_new_privs(void) > > { > > if (current->no_new_privs) > > return true; > > > > #ifdef CONFIG_SECCOMP > > if (test_thread_flag(TIF_SECCOMP)) > > return true; > > #endif > > Nope -- privileged users can enable seccomp w/o nnp. Indeed, I am stupid. Still it would be nice to cleanup this somehow. The new member is only used as a previous ->no_new_privs, just it is long to allow the concurent set/get. Logically it doesn't even belong to seccomp{}. Oleg. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.redhat.com ([209.132.183.28]:21411 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6834666AbaFXTcPUNZ9l (ORCPT ); Tue, 24 Jun 2014 21:32:15 +0200 Date: Tue, 24 Jun 2014 21:30:55 +0200 From: Oleg Nesterov Subject: Re: [PATCH v7 4/9] seccomp: move no_new_privs into seccomp Message-ID: <20140624193055.GA4482@redhat.com> References: <1403560693-21809-1-git-send-email-keescook@chromium.org> <1403560693-21809-5-git-send-email-keescook@chromium.org> <20140624191815.GA3623@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Return-Path: Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-subscribe: List-owner: List-post: List-archive: To: Andy Lutomirski Cc: Kees Cook , "linux-kernel@vger.kernel.org" , Alexei Starovoitov , "Michael Kerrisk (man-pages)" , Andrew Morton , Daniel Borkmann , Will Drewry , Julien Tinnes , David Drysdale , Linux API , X86 ML , "linux-arm-kernel@lists.infradead.org" , linux-mips@linux-mips.org, linux-arch , LSM List Message-ID: <20140624193055.btZz3zM77rknpyt5pXnuk-E9-31rn8-9j499JQ6ZqMQ@z> On 06/24, Andy Lutomirski wrote: > > On Tue, Jun 24, 2014 at 12:18 PM, Oleg Nesterov wrote: > >> > >> -struct seccomp { }; > >> +struct seccomp { > >> + unsigned long flags; > >> +}; > > > > A bit messy ;) > > > > I am wondering if we can simply do > > > > static inline bool current_no_new_privs(void) > > { > > if (current->no_new_privs) > > return true; > > > > #ifdef CONFIG_SECCOMP > > if (test_thread_flag(TIF_SECCOMP)) > > return true; > > #endif > > Nope -- privileged users can enable seccomp w/o nnp. Indeed, I am stupid. Still it would be nice to cleanup this somehow. The new member is only used as a previous ->no_new_privs, just it is long to allow the concurent set/get. Logically it doesn't even belong to seccomp{}. Oleg.