linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
To: Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>
Cc: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Alexei Starovoitov <ast-uqk4Ao+rVK5Wk0Htik3J/w@public.gmane.org>,
	"Michael Kerrisk (man-pages)"
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Daniel Borkmann
	<dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Will Drewry <wad-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Julien Tinnes <jln-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	David Drysdale <drysdale-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	X86 ML <x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
	linux-arch <linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	LSM List
	<linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v7 4/9] seccomp: move no_new_privs into seccomp
Date: Tue, 24 Jun 2014 12:50:02 -0700	[thread overview]
Message-ID: <CAGXu5jJjuNmf=FRzUPMChvL4D_xkg034pUbRAbaK38f37GYC0A@mail.gmail.com> (raw)
In-Reply-To: <CALCETrU9x05ADgz9JToiw_BuCPz1h0xmOh=1R3eojL9far1aEA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, Jun 24, 2014 at 12:34 PM, Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org> wrote:
> On Tue, Jun 24, 2014 at 12:30 PM, Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
>> On 06/24, Andy Lutomirski wrote:
>>>
>>> On Tue, Jun 24, 2014 at 12:18 PM, Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 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{}.
>
> We could add an unsigned long atomic flags field to task_struct.

I thought that had gotten shot down originally, but given the current
state of the patch series, it would be effectively identical, since my
earlier attempt at keeping sizes the same (with alternate accessors)
was too messy. I will change this as well.

> Grr.  Why isn't there an unsigned *int* atomic bitmask type?  Even u64
> would be better.  unsigned long is useless.

Useless beyond 32 bits. ;)

-Kees

-- 
Kees Cook
Chrome OS Security

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Oleg Nesterov <oleg@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Alexei Starovoitov <ast@plumgrid.com>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Daniel Borkmann <dborkman@redhat.com>,
	Will Drewry <wad@chromium.org>, Julien Tinnes <jln@chromium.org>,
	David Drysdale <drysdale@google.com>,
	Linux API <linux-api@vger.kernel.org>, X86 ML <x86@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	linux-mips@linux-mips.org,
	linux-arch <linux-arch@vger.kernel.org>,
	LSM List <linux-security-module@vger.kernel.org>
Subject: Re: [PATCH v7 4/9] seccomp: move no_new_privs into seccomp
Date: Tue, 24 Jun 2014 12:50:02 -0700	[thread overview]
Message-ID: <CAGXu5jJjuNmf=FRzUPMChvL4D_xkg034pUbRAbaK38f37GYC0A@mail.gmail.com> (raw)
Message-ID: <20140624195002.gaByZGeYDfpjeUaQQYFTImPhaxC0g99hsg_qD7bwV2s@z> (raw)
In-Reply-To: <CALCETrU9x05ADgz9JToiw_BuCPz1h0xmOh=1R3eojL9far1aEA@mail.gmail.com>

On Tue, Jun 24, 2014 at 12:34 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Tue, Jun 24, 2014 at 12:30 PM, Oleg Nesterov <oleg@redhat.com> wrote:
>> On 06/24, Andy Lutomirski wrote:
>>>
>>> On Tue, Jun 24, 2014 at 12:18 PM, Oleg Nesterov <oleg@redhat.com> 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{}.
>
> We could add an unsigned long atomic flags field to task_struct.

I thought that had gotten shot down originally, but given the current
state of the patch series, it would be effectively identical, since my
earlier attempt at keeping sizes the same (with alternate accessors)
was too messy. I will change this as well.

> Grr.  Why isn't there an unsigned *int* atomic bitmask type?  Even u64
> would be better.  unsigned long is useless.

Useless beyond 32 bits. ;)

-Kees

-- 
Kees Cook
Chrome OS Security

  parent reply	other threads:[~2014-06-24 19:50 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 21:58 [PATCH v7 0/9] seccomp: add thread sync ability Kees Cook
2014-06-23 21:58 ` Kees Cook
2014-06-23 21:58 ` [PATCH v7 1/9] seccomp: create internal mode-setting function Kees Cook
2014-06-23 21:58 ` [PATCH v7 2/9] seccomp: split filter prep from check and apply Kees Cook
2014-06-23 21:58   ` Kees Cook
2014-06-26 12:37   ` David Drysdale
2014-06-27 18:45     ` Kees Cook
2014-06-27 18:45       ` Kees Cook
2014-06-23 21:58 ` [PATCH v7 3/9] seccomp: introduce writer locking Kees Cook
2014-06-23 21:58   ` Kees Cook
2014-06-24 16:52   ` Oleg Nesterov
2014-06-24 16:52     ` Oleg Nesterov
2014-06-24 18:02     ` Kees Cook
2014-06-24 18:02       ` Kees Cook
     [not found]       ` <CAGXu5j+G8qAkGD7H=3R2iw2ZTqZSrMPa2f=czoEjwSW5wKqUWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-24 18:35         ` Oleg Nesterov
2014-06-24 18:35           ` Oleg Nesterov
2014-06-24 20:26           ` Kees Cook
2014-06-24 18:30   ` Oleg Nesterov
2014-06-24 18:30     ` Oleg Nesterov
     [not found]     ` <20140624183024.GA1258-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-06-24 19:46       ` Kees Cook
2014-06-24 19:46         ` Kees Cook
2014-06-23 21:58 ` [PATCH v7 4/9] seccomp: move no_new_privs into seccomp Kees Cook
2014-06-23 21:58   ` Kees Cook
2014-06-24 19:18   ` Oleg Nesterov
2014-06-24 19:18     ` Oleg Nesterov
2014-06-24 19:20     ` Andy Lutomirski
2014-06-24 19:20       ` Andy Lutomirski
2014-06-24 19:30       ` Oleg Nesterov
2014-06-24 19:30         ` Oleg Nesterov
2014-06-24 19:34         ` Andy Lutomirski
2014-06-24 19:34           ` Andy Lutomirski
     [not found]           ` <CALCETrU9x05ADgz9JToiw_BuCPz1h0xmOh=1R3eojL9far1aEA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-24 19:50             ` Kees Cook [this message]
2014-06-24 19:50               ` Kees Cook
     [not found]               ` <CAGXu5jJjuNmf=FRzUPMChvL4D_xkg034pUbRAbaK38f37GYC0A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-24 19:51                 ` Andy Lutomirski
2014-06-24 19:51                   ` Andy Lutomirski
2014-06-23 21:58 ` [PATCH v7 5/9] seccomp: split mode set routines Kees Cook
2014-06-23 21:58   ` Kees Cook
2014-06-23 21:58 ` [PATCH v7 6/9] seccomp: add "seccomp" syscall Kees Cook
2014-06-23 21:58   ` Kees Cook
2014-06-23 21:58 ` [PATCH v7 7/9] seccomp: implement SECCOMP_FILTER_FLAG_TSYNC Kees Cook
2014-06-23 21:58   ` Kees Cook
2014-06-24 17:08   ` Oleg Nesterov
2014-06-24 17:08     ` Oleg Nesterov
     [not found]     ` <20140624170800.GA30480-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-06-24 18:19       ` Kees Cook
2014-06-24 18:19         ` Kees Cook
2014-06-24 17:27   ` Oleg Nesterov
2014-06-24 17:27     ` Oleg Nesterov
2014-06-24 18:05     ` Kees Cook
2014-06-24 18:37       ` Oleg Nesterov
2014-06-24 18:37         ` Oleg Nesterov
2014-06-24 19:08         ` Kees Cook
2014-06-24 19:08           ` Kees Cook
     [not found] ` <1403560693-21809-1-git-send-email-keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-06-23 21:58   ` [PATCH v7 8/9] ARM: add seccomp syscall Kees Cook
2014-06-23 21:58     ` Kees Cook
2014-06-23 21:58 ` [PATCH v7 9/9] MIPS: " Kees Cook
2014-06-23 21:58   ` Kees Cook
2014-06-23 22:01 ` [PATCH v7 1/1] man-pages: seccomp.2: document syscall Kees Cook
2014-06-23 22:01   ` Kees Cook
     [not found]   ` <20140623220150.GM5412-oSa+0FWJbaXR7s880joybQ@public.gmane.org>
2014-06-24 10:23     ` Michael Kerrisk (man-pages)
2014-06-24 10:23       ` Michael Kerrisk (man-pages)
2014-06-24 16:43       ` Kees Cook
2014-06-24 16:43         ` Kees Cook
2014-06-24 17:48   ` [PATCH v7.1 " Kees Cook
2014-06-24 17:48     ` Kees Cook
2014-06-24 18:06   ` [PATCH v7 " Andy Lutomirski
2014-06-24 18:06     ` Andy Lutomirski
     [not found]     ` <CALCETrV=nAuWi8_Xj6KnJ6P1Yiaw36+n50-gHKaTgea4yH85Eg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-24 19:18       ` Kees Cook
2014-06-24 19:18         ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGXu5jJjuNmf=FRzUPMChvL4D_xkg034pUbRAbaK38f37GYC0A@mail.gmail.com' \
    --to=keescook-f7+t8e8rja9g9huczpvpmw@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=ast-uqk4Ao+rVK5Wk0Htik3J/w@public.gmane.org \
    --cc=dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=drysdale-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=jln-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=wad-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).