Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp10877imm; Wed, 12 Sep 2018 17:02:04 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY57+Q7+67LbykOTAPslz1E44x43qZAUpatShcZ6GixvFIf1p3uu8xs98FxSl/Gzc6RlsAA X-Received: by 2002:a62:2119:: with SMTP id h25-v6mr4855319pfh.112.1536796923970; Wed, 12 Sep 2018 17:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536796923; cv=none; d=google.com; s=arc-20160816; b=mgd2FupG0fEMvichvo5zcGegHf+xAUmGPSVRBpjSa2oEY9C3YsWRNdUaSP40F7fO4B wdbZjfuo+hq4Ct/Zkryl9edRCKn3wKMpZhiMjeWGbIsrmy4QVVnrsY+Y+2BJKvgg2/o4 pZC/V06mbe21/HoId2QlkVvNw2oGfG8M3bKgpE2uwOeL0SKlo9DQ03BhWwH4YJyhimmW 7YkzjCpB8sYsSk29TgJWrbxAostV0mtfO5KC1qSvnYlqj/jtGqHKRZlHEwCvbjAB7OsQ gWeZtlMbLc0Nc+5smsqdO0pUzf71Oftm8yVA1tVn8NXM9BpAOx2Qo9MkbJlI8c4Sykq8 MPuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=NlHj7Vhh6eLuGkKS2Pxv9SAvayJlb7tdXTe2j2eEj1g=; b=IWe+HRBZNDkd0A8hh+D8GFleU12ahowbyRdnzz1MoiStUUNhBkiaDyOmNqeWNEuwyB ctANxcfYAQh7bognPZ+7yla17cyfsxvutR4VicPClT9NXKJkUn9qSjlQPSBSE49UkbBC YP7hLqfMs6ifzyQH+EEmJBgJEYz9GNb5EJB+EyrMI/85mUVMRMYWADy8XGD/9+BdEHH+ 1XK+LvLFubwmWTrqLL8fh8HaSJzm6stENg8s3PiqwJ1zSGaK2Bg4+ITWk/oY0VMmCQp7 X5tN+LO03Wiiac2kmsEDqYSg44p73GO9DWaq/3+w2Ex9ZQ26IYWlSBjfnRB6xp41A6x7 gDbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=deY5RNY7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u22-v6si2608836plk.443.2018.09.12.17.01.48; Wed, 12 Sep 2018 17:02:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=deY5RNY7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726912AbeIMFIJ (ORCPT + 99 others); Thu, 13 Sep 2018 01:08:09 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39516 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbeIMFIJ (ORCPT ); Thu, 13 Sep 2018 01:08:09 -0400 Received: by mail-wm0-f68.google.com with SMTP id q8-v6so4219636wmq.4 for ; Wed, 12 Sep 2018 17:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NlHj7Vhh6eLuGkKS2Pxv9SAvayJlb7tdXTe2j2eEj1g=; b=deY5RNY7smrUkqQpRrVSmwY/jUDdGWb3BoWV6wnTurEXyeXbbxhg/l4qq5YMIqsC54 EF7z7veA/ifornwFwrQaPrCGP3qcHua0PBMsh7T45xMIxCnTx7TbB7Rs29/JYw552Qg5 9x9L1so5oWp84SHHsFppzjOtgrbdcj/BhNYxtMyA0xwaWuRwB0naJdEQSmPMf2xw/Irm te3clGfoG+b8qPlvz2K2AM1/PPO56Eif4pK1d1kc7GQ9uc/KriRIzMg4glwgst0FcdSg lYw4VkerMR3Kg8zFM0rU90JP0lYk7L6jKAgDWDd/nlH68wVeGH5NxotSEaD24h2gYBU1 Jrcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NlHj7Vhh6eLuGkKS2Pxv9SAvayJlb7tdXTe2j2eEj1g=; b=J8ACYJ85Od5IeAeL9bPWOjAv1tnami9lbP297+JZ6li2v5w7u8D7tocLe5g2IVEenW SBumkWDWTC1bqwHhhUDh3nvz6l+Z9MoJI8ZWBphoyLt43TIF2UCak7K9vFLtyAmZGjVX exho239EXqR/hdWEsgstERFpMnUu6Vy3J5FTJYo49bM4IzzBQCnYWi8fQKLHsAcYddZk gB8gQA1sz/l3CgS+G43zZSCa+oa1ihqaSc7uMVXw0GpNA/bI9BBXDoRSPHZ1pVkYTSkq Oppt0Pp3iOs7cz0AlKHnnIXOh/HJknfXo1/Bp+UYJLDCzUCU5xCqRo6rpfnPcIBW58C6 GeZQ== X-Gm-Message-State: APzg51AaXwVF6fHL1G357P451KT0+VFZvHS0+oKRQMRUro37JzD4FE17 nVG2032dmmPrTfzAXvbPK12TarEfGo+wcpBm15j5Ww== X-Received: by 2002:a1c:7e92:: with SMTP id z140-v6mr3218255wmc.48.1536796875010; Wed, 12 Sep 2018 17:01:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:7810:0:0:0:0:0 with HTTP; Wed, 12 Sep 2018 17:00:54 -0700 (PDT) In-Reply-To: <20180906152859.7810-4-tycho@tycho.ws> References: <20180906152859.7810-1-tycho@tycho.ws> <20180906152859.7810-4-tycho@tycho.ws> From: Andy Lutomirski Date: Wed, 12 Sep 2018 17:00:54 -0700 Message-ID: Subject: Re: [PATCH v6 3/5] seccomp: add a way to get a listener fd from ptrace To: Tycho Andersen Cc: Kees Cook , LKML , Linux Containers , Linux API , Oleg Nesterov , "Eric W . Biederman" , "Serge E . Hallyn" , Christian Brauner , Tyler Hicks , Akihiro Suda , Jann Horn Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 6, 2018 at 8:28 AM, Tycho Andersen wrote: > As an alternative to SECCOMP_FILTER_FLAG_GET_LISTENER, perhaps a ptrace() > version which can acquire filters is useful. There are at least two reasons > this is preferable, even though it uses ptrace: > > 1. You can control tasks that aren't cooperating with you > 2. You can control tasks whose filters block sendmsg() and socket(); if the > task installs a filter which blocks these calls, there's no way with > SECCOMP_FILTER_FLAG_GET_LISTENER to get the fd out to the privileged task. Hmm. I contemplated this a bit and looked at your example a bit, and I have a few thoughts: - What happens if you nest code like your sample? That is, if you are already in some container that is seccomped and there's a listener, can you even run your sample? - Is there any association between the filter layer that uses the USER_NOTIF return and the listener? How would this API express such a relationship? I realize that my dream of how this should all work requires eBPF and BPF_CALL, so it may not be viable right now, but I'd like a better understanding of how this all fits together. Also, I think that it's not strictly true that a filter that blocks sendmsg() is problematic. You could clone a thread, call seccomp() in that thread, then get a listener, then execve(). Or we could have a seccomp() mode that adds a filter but only kicks in after execve(). The latter could be generally useful. --Andy