From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754732Ab2ALRkL (ORCPT ); Thu, 12 Jan 2012 12:40:11 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.123]:49845 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751013Ab2ALRkK (ORCPT ); Thu, 12 Jan 2012 12:40:10 -0500 X-Authority-Analysis: v=2.0 cv=SqgSGYy0 c=1 sm=0 a=ZycB6UtQUfgMyuk2+PxD7w==:17 a=CN4PQ-MNGcoA:10 a=5SG0PmZfjMsA:10 a=Q9fys5e9bTEA:10 a=1vfNl0wJnvAby7S1ftEA:9 a=PUjeQqilurYA:10 a=ZycB6UtQUfgMyuk2+PxD7w==:117 X-Cloudmark-Score: 0 X-Originating-IP: 74.67.80.29 Message-ID: <1326390006.7642.114.camel@gandalf.stny.rr.com> Subject: Re: [RFC,PATCH 1/2] seccomp_filters: system call filtering using BPF From: Steven Rostedt To: Jamie Lokier Cc: Oleg Nesterov , Will Drewry , linux-kernel@vger.kernel.org, keescook@chromium.org, john.johansen@canonical.com, serge.hallyn@canonical.com, coreyb@linux.vnet.ibm.com, pmoore@redhat.com, eparis@redhat.com, djm@mindrot.org, torvalds@linux-foundation.org, segoon@openwall.com, jmorris@namei.org, scarybeasts@gmail.com, avi@redhat.com, penberg@cs.helsinki.fi, viro@zeniv.linux.org.uk, luto@mit.edu, mingo@elte.hu, akpm@linux-foundation.org, khilman@ti.com, borislav.petkov@amd.com, amwang@redhat.com, ak@linux.intel.com, eric.dumazet@gmail.com, gregkh@suse.de, dhowells@redhat.com, daniel.lezcano@free.fr, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, olofj@chromium.org, mhalcrow@google.com, dlaor@redhat.com Date: Thu, 12 Jan 2012 12:40:06 -0500 In-Reply-To: <20120112173048.GK7180@jl-vm1.vm.bytemark.co.uk> References: <1326302710-9427-1-git-send-email-wad@chromium.org> <1326302710-9427-2-git-send-email-wad@chromium.org> <1326383015.7642.77.camel@gandalf.stny.rr.com> <20120112161418.GA22360@redhat.com> <1326386324.7642.96.camel@gandalf.stny.rr.com> <20120112173048.GK7180@jl-vm1.vm.bytemark.co.uk> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.2.2-1 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2012-01-12 at 17:30 +0000, Jamie Lokier wrote: > You can do this now, using ptrace(). It's horrible, but half of the > horribleness is needing to understand machine-dependent registers, > which this new patch doesn't address. (The other half is a ton of > undocumented but important ptrace() behaviours on Linux.) Yeah I know the horrid use of ptrace, I've implemented programs that use it :-p I guess ptrace can capture the execv and determine if it is OK or not to run it. But again, this doesn't stop the possible attacks that could happen, with having the execv on a symlink file, having the ptrace check say its OK, and then switching the symlink to a setuid file. When the new execv executed, the parent process would lose all control over it. The idea is to prevent this. I like Alan's suggestion. Have userspace decide to allow execv or not, and even let it decide if it should allow setuid execv's or not, but still allow non-setuid execvs. If you allow the setuid execv, once that happens, the same behavior will occur as with ptrace. A setuid execv will lose all its filtering. -- Steve