Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp230213pxb; Sat, 20 Feb 2021 01:35:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzK967APQE3mryfZviZBMZtl9CGWWnQ7owjxjdSIir6USKQPy2n6vua4n6/17kwZ8lAxQiS X-Received: by 2002:aa7:c98c:: with SMTP id c12mr500271edt.65.1613813721595; Sat, 20 Feb 2021 01:35:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613813721; cv=none; d=google.com; s=arc-20160816; b=gB/osVXXf1YnNfd0FrX1VHihwgIcbmB+OdVmr0oRE2lprIz/0KSAlSazQdx7HRYHzW Zy6bs8sb52Lut7Yvhxa2ylGzFUty7GPgEFtN/oMd7L/BR+UAKSItEjMu7pNYW8nDAFOq vN4gXuht4dIRTfEIDLWyI/qXxjjVI8EH48siFosG1+2MwWc9HYO/lEySmwvsTN36hMyc Y5hFPcNPoOx9sjLj0ZfkAU0rwqunBdAvtlWkn5JMJew3qzFhLEG1av7Qza8YUqsDc45L nv4YljYvdgDM71rQUeIyprMU7tuZcwfjtMLRtCVi5XmrKEjQCkiRqu3pHLEi5vQqh6L8 A0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=aU6EkxCmwm7ZBRSmBHpzJ3NMym8iTR9+L0yAeuHl2no=; b=dZcoW3HG32lBCp+NKy+txObXXAWP9fS6vwpiys1d1mNbbGlIysDkxqBOqjSqQxLFLw v9k43VYa+Y1Zok+vVoGBMykBCHJWpy7e2FGK2d5/k+bY0YHtxAvua4HJ7HbISWKVFls5 iQ1X5HJy3faAwnGXJkk5LcBvqp8+6pGNQOfPg0zie3x0fBA15s48O/OimLn79U7tW5J3 ntGnKN3ouTdkZJcq/8pcMB7E5EhFiSDftTQUIOVg7SBCFRXKxQhZ8RrY5kWCuYkkFhH6 6AP6opNHiLyWARp9FEigBU4qXC/1SXusMXohy3drbSSDIaGcpESMa2zVtzkmzbveyl+V NeIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sargun.me header.s=google header.b=JKdp44i6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si8765215ede.66.2021.02.20.01.34.57; Sat, 20 Feb 2021 01:35:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sargun.me header.s=google header.b=JKdp44i6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229645AbhBTJdO (ORCPT + 99 others); Sat, 20 Feb 2021 04:33:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbhBTJdN (ORCPT ); Sat, 20 Feb 2021 04:33:13 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56F2CC061786 for ; Sat, 20 Feb 2021 01:32:33 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id u8so8212319ior.13 for ; Sat, 20 Feb 2021 01:32:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sargun.me; s=google; h=mime-version:from:date:message-id:subject:to:cc; bh=aU6EkxCmwm7ZBRSmBHpzJ3NMym8iTR9+L0yAeuHl2no=; b=JKdp44i6/7tt87YblVoGu5BePf6hR8nDWAOdFU858sv4zx8DCezAdMEhOkLkRdwR0Z aRnbX2auMDWY1leI9eHXymj55Kc/0zIJeLIFD0OTphIlB7fVgYBom5qZYqnSH8KdkKf3 5d2QXWOS01+YxTcMfEz+3rXETLNPHvyIPp39g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=aU6EkxCmwm7ZBRSmBHpzJ3NMym8iTR9+L0yAeuHl2no=; b=ji71n1aLp+IlMVYiYRGQTDk8W8uJkD+ItYuoQocK9iHwlasNe8Ca/KHmGvNCbPtYyV ZGjf9yjuJo60KH3x9sJao+O6eXfXFHR8oTWXlZOnjWIAI8wKX+EFDTGPLECkWnDMqEAO XjKz4x2P2SC9FR71v64XR8ZubXwkMZHn8gwDV8alMoEk822KGGk+WP/1CmoLnj7xVXqU /0uFokeu44TprBy7KU9mOcuEKqaD4JGg7UFGvZ4ERLhBnhzEQs97B7HulEW3EKP8CXt5 rw4gVGEQei4e4BNxKnpYwLvql28IIk1rdKXoKwPbnUZPTLZFZuYUD9exBwZDnuQOLoaI /w9w== X-Gm-Message-State: AOAM530wjCuPZByP7nH6HFDQSS+XUNdiBNdOvxsJ6ccGMd3PSn3jzuwf qP2mZT1Qh2wB1T+58it83ALkkM+bxg5a6agnfG3CM5qDOYL2Gw== X-Received: by 2002:a5d:8719:: with SMTP id u25mr7657714iom.103.1613813552699; Sat, 20 Feb 2021 01:32:32 -0800 (PST) MIME-Version: 1.0 From: Sargun Dhillon Date: Sat, 20 Feb 2021 01:31:57 -0800 Message-ID: Subject: seccomp: Delay filter activation To: Kees Cook Cc: LKML , Giuseppe Scrivano , Christian Brauner , Tycho Andersen , Hariharan Ananthakrishnan , Keerti Lakshminarayan , Kyle Anderson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We've run into a problem where attaching a filter can be quite messy business because the filter itself intercepts sendmsg, and other syscalls related to exfiltrating the listener FD. I believe that this problem set has been brought up before, and although there are "simpler" methods of exfiltrating the listener, like clone3 or pidfd_getfd, but these are still less than ideal. One of the ideas that's been talked about (I want to say back at LSS NA) is the idea of "delayed activation". I was thinking that it might be nice to have a mechanism to do delayed attach, either activated on execve / fork, or an ioctl on the listenerfd to activate the filter and have a flag like SECCOMP_FILTER_FLAG_NEW_LISTENER_INACTIVE, which indicates that the listener should be setup, but not enforcing, and another ioctl to activate it. The later approach is preferred due to simplicity, but I can see a situation where you could accidentally get into a state where the filter is not being enforced. Additionally, this may have unforeseen implications with CRIU. I'm curious whether this is a problem others share, and whether any of the aforementioned approaches seem reasonable. -Thanks, Sargun