Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp115847ybm; Wed, 27 May 2020 21:17:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEwxDig3Movg+RMouwJQKpp9GrBHFA2dqtidFfSp7PeWRthi36K0b0p/NfOHwp7Zghc8lK X-Received: by 2002:a17:906:b5c1:: with SMTP id ep1mr1228141ejb.528.1590639419877; Wed, 27 May 2020 21:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590639419; cv=none; d=google.com; s=arc-20160816; b=JSKhOR7t+z11Y+pmf+Z5Od/CctWhEThMNxLf5Xzee1dvKQFG3GddRQJvRd2iVrjIcH SLzvwlPL1BhZY09OATZ/krftnI83eHp0lPPZ+OOlAMi5zdO9pr7D4FdEjI4poTdioe9p GPl2+M4ujXCza2Ycuxwj3hhEkEnc4zIYqScafq1kTZNgKNroclI9GP7/2Cf77j2rSjO/ gEl3GnGbhRp8CvXaANN3EvYACErzX/72vkjoKSj0Lsw6pijMsNzQ4AS6EyGOKbHeBp5x Lp1js8RNzsNkn6D6v/XQQy168+2VzeVh4cA5gmmuSph6jdsvjTua7ZHNGjtW85f3D+aj wG5A== 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 :in-reply-to:references:mime-version:dkim-signature; bh=whokj7dhyD8nKdYthVeJGDFA0AYbgH+VAE8dNabj+Nw=; b=XaKggTRtFfuIZByOXDtcDSN05Vjw37/n8xNm2/5soahWiKp72CSI8FLkPqOfXBzow4 4VgIEa648RO1nb9wRAI3IQbVW2wuBpEPer3u4jJ5k4eus32zV6WGLUDFWof2/11oaUDh KyUXUWsD6f8wqXPgBn6GY6RRQ6Dyqfz/ChwA7Wca0EuVmE++DgEXuG86QTtGPPKDC1DY Grz4qVoLbFks6ieEro2CJdFN8zyXGHysy+PFAiZA0tllmcwk9cbKBlXykTBHsa+48k6T o6uIE1DKK4eCHgph2K4n+p8QgPKThUTAX8LfOupkSA3gRgYTeAHsraxFjDlG0TKlmEoD CbVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fEXn0tJW; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si2843786ejf.525.2020.05.27.21.16.36; Wed, 27 May 2020 21:16:59 -0700 (PDT) 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=@google.com header.s=20161025 header.b=fEXn0tJW; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725994AbgE1EO5 (ORCPT + 99 others); Thu, 28 May 2020 00:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725308AbgE1EO4 (ORCPT ); Thu, 28 May 2020 00:14:56 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F120C05BD1E for ; Wed, 27 May 2020 21:14:56 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id z13so21955223ljn.7 for ; Wed, 27 May 2020 21:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=whokj7dhyD8nKdYthVeJGDFA0AYbgH+VAE8dNabj+Nw=; b=fEXn0tJWaEcS1/o9rxuVZxV/ZZ8RppTt9wKLPP/VzEZKAcFJF1/V5Xxm71Geeljn7x 8KdzwbxxwOaUxY2h4tCDaNXTmaagWb12o7BSvnVuNSK5+cVn1ayVf4F4F36HF/mNWA0E CrmAraECFr86U8gMhGTqyqYw81IuVNGhevHsd5hDPnYljHUudd3UM8/8PUMgnqsxACE5 lt1dTFS8UP8pSzzUwqm64j8JOFez8tg3ldCFxRxqa7EzJX7Up8FV+tQXLUUpnqH8+Mn9 7urqU0X7nx40l7g0xlIh9J/zcrXKTDzwXgUEKukSDIcEKxl5XzLzGFH5TLbCcolu9FPa kAiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=whokj7dhyD8nKdYthVeJGDFA0AYbgH+VAE8dNabj+Nw=; b=sIS3Y2mgboEjt3LYN+s8NTmF+4ZHoNwZfuk1/7Ezq1+ZsPxaIoVT6aJFHmI8dGE70a 7o/sLcpiWl6gEF0UdPaLdqKOnLeyqDDRpVewXM7ElPp1Kshqt+SXFnhSXNSK6nNCxmT4 kwF9YmhK7sdWXqcEZ9KMgo43/l8otIful4YzUz4B2Y/2RvDRTXMvb4MBhQv6Cwd35qbm 6hnYw5AJOeJNq7VTXC8oK4hzQLmoKGq2V6g2R5vH/s2FllbG+9rW/luHU1bN1J8VBxRy GT5raGYDE/2Kp/LokXoSul3aoywkvNUYmDDOXxaN07z3l6fWy/rh9r4KYIfllroj56VU OVmg== X-Gm-Message-State: AOAM533hRy269jNie9YigWbwbRTC5HIwCY1G1keLgYxsyu6Rh/MQliKG MuNk5Z7y1Mg/zdzDyC/jecqdElzXMmzYFv5W+/X1nvn9 X-Received: by 2002:a2e:91c3:: with SMTP id u3mr476939ljg.365.1590639294595; Wed, 27 May 2020 21:14:54 -0700 (PDT) MIME-Version: 1.0 References: <20200527111902.163213-1-christian.brauner@ubuntu.com> <202005271408.58F806514@keescook> <20200527220532.jplypougn3qzwrms@wittgenstein> <202005271537.75548B6@keescook> <20200527224501.jddwcmvtvjtjsmsx@wittgenstein> <20200527231646.4v743erjpzh6qe5f@wittgenstein> <202005271851.B7FBA02F@keescook> In-Reply-To: <202005271851.B7FBA02F@keescook> From: Jann Horn Date: Thu, 28 May 2020 06:14:28 +0200 Message-ID: Subject: Re: [PATCH 1/2] seccomp: notify user trap about unused filter To: Kees Cook Cc: Christian Brauner , kernel list , Andy Lutomirski , Tycho Andersen , Matt Denton , Sargun Dhillon , Chris Palmer , Aleksa Sarai , Robert Sesek , Jeffrey Vander Stoep , Linux Containers 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, May 28, 2020 at 3:59 AM Kees Cook wrote: > On Thu, May 28, 2020 at 01:16:46AM +0200, Christian Brauner wrote: > > I'm also starting to think this isn't even possible or currently doable > > safely. > > The fdtable in the kernel would end up with a dangling pointer, I would > > think. Unless you backtrack all fds that still have a reference into the > > fdtable and refer to that file and close them all in the kernel which I > > don't think is possible and also sounds very dodgy. This also really > > seems like we would be breaking a major contract, namely that fds stay > > valid until userspace calls close, execve(), or exits. > > Right, I think I was just using the wrong words? I was looking at it > like a pipe, or a socket, where you still have an fd, but reads return > 0, you might get SIGPIPE, etc. The VFS clearly knows what a > "disconnected" fd is, and I had assumed there was general logic for it > to indicate "I'm not here any more". Nope. For example, pipes have manual checks based on pipe->readers and pipe->writers, and manually send SIGPIPE and stuff from inside fs/pipe.c. And pipes are not actually permanently "disconnected" - someone can e.g. open a pipe that previously had no readers in read mode, and suddenly you can write to it again.