linux-mips
[Top] [All Lists]

Re: [PATCH v8 3/9] seccomp: introduce writer locking

To: Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH v8 3/9] seccomp: introduce writer locking
From: Kees Cook <keescook@chromium.org>
Date: Fri, 27 Jun 2014 10:27:05 -0700
Cc: LKML <linux-kernel@vger.kernel.org>, Andy Lutomirski <luto@amacapital.net>, "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>, Alexei Starovoitov <ast@plumgrid.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@kernel.org" <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>, linux-security-module <linux-security-module@vger.kernel.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ynkRZlD3Y2aL0rX/aKuN1Q9uJPiWrW1RfmRe4ZP+utg=; b=Z1gEEX+C+4H3O9deMwuxdTeCZgcrQHkUMGnAuc6OUgD+gwcJqlAsFkb3WQyE+rXAE2 Jj6kf1RtrgKTs38MH145RMmAZSKw/HXRAGxH8Eouy2DFQ+9ev5WPluTJUc2dsFvuG/5s lf1NUxMPI5fxXdOT9jNgynjuD4bCu5ctu4rAHwpFrFF354bcIX72DiMB08/m0zelTKS6 uPwJKLRJUPXzOvURjMBpr4VHqh4/4gomfv+OdezFbKNgXOBuhRIDuw4+AF51MJZhQ/Mf uDIvgaWpe9tkOSsRqXkjO6DizNXAGC0vuC+9Rm9Ksehf6D6oSyYyr2Q/iGb5D16Lbn2U tpjA==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ynkRZlD3Y2aL0rX/aKuN1Q9uJPiWrW1RfmRe4ZP+utg=; b=Yu5ovKrs9luf4a8Gx8l7SkCbnUvVMosrvWJTvn0A5xjGlEx0QGLl0jbJwZ3PMS1zPM 2jgtkFbobsyyJJfdGsTsoDFSqhvsDNStRSf1/gozwj+QqtDXnilRCaHlOrFMYIAlsTNL LBbqp/XKady7LVuHiXcrDwumjb3MgozFBotoY=
In-reply-to: <20140625180705.GB18185@redhat.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1403642893-23107-1-git-send-email-keescook@chromium.org> <1403642893-23107-4-git-send-email-keescook@chromium.org> <20140625180705.GB18185@redhat.com>
Sender: linux-mips-bounce@linux-mips.org
On Wed, Jun 25, 2014 at 11:07 AM, Oleg Nesterov <oleg@redhat.com> wrote:
> On 06/24, Kees Cook wrote:
>>
>> +static void copy_seccomp(struct task_struct *p)
>> +{
>> +#ifdef CONFIG_SECCOMP
>> +     /*
>> +      * Must be called with sighand->lock held, which is common to
>> +      * all threads in the group. Regardless, nothing special is
>> +      * needed for the child since it is not yet in the tasklist.
>> +      */
>> +     BUG_ON(!spin_is_locked(&current->sighand->siglock));
>> +
>> +     get_seccomp_filter(current);
>> +     p->seccomp = current->seccomp;
>> +
>> +     if (p->seccomp.mode != SECCOMP_MODE_DISABLED)
>> +             set_tsk_thread_flag(p, TIF_SECCOMP);
>> +#endif
>> +}
>
> Wait. But what about no_new_privs? We should copy it as well...
>
> Perhaps this helper should be updated a bit and moved into seccomp.c so
> that seccomp_sync_threads() could use it too.

Ah! Yes. I had been thinking it had been copied during the task_struct
duplication, but that would have been before holding sighand->lock, so
it needs explicit recopying. Thanks!

-Kees

-- 
Kees Cook
Chrome OS Security

<Prev in Thread] Current Thread [Next in Thread>