Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp821845ybt; Wed, 17 Jun 2020 15:06:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgwTI7jJ+I4fjUZNsfooIjlXKqVSYM6d/1w1vTCO4gfYajNOScWrICKfqju3LmpeiHaTq1 X-Received: by 2002:a05:6402:70b:: with SMTP id w11mr1161676edx.251.1592431608217; Wed, 17 Jun 2020 15:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592431608; cv=none; d=google.com; s=arc-20160816; b=Syhico6/s8UPfAFW5MhhTL32tA2kwv9hw+bZV5kYfriVBThYB0BRMEBOaMgdpewufE D5eVPYI7M+fVRize5XkhBzuJbyF6JB+y8TGb0JYg8Zo1RO44HVtlZ1S3OGkbpz+2Fyuu EvqWN67yT9X88U9h/cUIS5PVldvHcIxo8Ld0z2fdgUOs8AtMUBAWsKG5DwG51agd8w01 lgGlJZSPMW4iupLf3b48na5qtgBa9Vhb3KJvRY0SDCgKLvR41oNvWIB3+TfT2QKuBQnP WceUuN3e71+QfbvJmemOF9UsFoblm9VvdGCABZsc08p5tbP9DqwSpamZfq15wca/4eHf HmpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2q7bLMUd5vfYPBehCH2qcIvt1dDMWXzsM1rSr8xASEs=; b=wbLgHKSNbdfek1bVXNldjfYEajBVgcjkJJdb72guw/lPt3pUR9gxxX6NrjUY8U9pxV wD4SN7hUx1g70UafK7Lf2Ppx1j9TR1oy2Fhvo9sDwpDwkU6hXAKRI0aNoFuTtyHqWBGf po/GHqdUfJuzsBVvN4mAVM0MDVFMO8zBglyPNYY2aFCcBReyA/7EocV2lmaj6fYUvVox /5qYC2ysgvj603LlCWeBC+BRuydScqm+3B/UKcZ5kEmRbppSgH/Bh0SRx+jUP6jNpNqY /iDl438S5PUPrD4gmyxqUQskTPyfEyYee/icFmaRvX1W2MCfi7fjVL8BdC12Dukk+AcE wy6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fiquKUdy; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x26si635959ejc.746.2020.06.17.15.06.24; Wed, 17 Jun 2020 15:06:48 -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=@chromium.org header.s=google header.b=fiquKUdy; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbgFQWEI (ORCPT + 99 others); Wed, 17 Jun 2020 18:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbgFQWDg (ORCPT ); Wed, 17 Jun 2020 18:03:36 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C500CC061794 for ; Wed, 17 Jun 2020 15:03:34 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id i4so1724649pjd.0 for ; Wed, 17 Jun 2020 15:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2q7bLMUd5vfYPBehCH2qcIvt1dDMWXzsM1rSr8xASEs=; b=fiquKUdyAlyN5DN55k77fJo/naedBS1mJ6UPcwZUUzNVbhK6HBR2lN9vkr/JQ4toCx dncsX1dNE5j6lxBS7GZWAMyhdOA95exy4UqW2G53ACGN7/yiUulBC9tSekOj3i7WRpAR q91Ikv3l4LUdzw/5lIaj5dL5WFyrEGxRvY6MQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2q7bLMUd5vfYPBehCH2qcIvt1dDMWXzsM1rSr8xASEs=; b=BAgi5f6udr94SfMtyeMwuR3OZiZB1DSN/VveqOdc/3Kj4U2wumv15lqMDyBtxystce 3fEEJnfxPMvvu8nsmD08iOgrEEottvjjbeFP7CKk2Fdq7PnDf7aaDu7qf84argr/0yXU UWEMEiDJbjevCIXluB4vYymfSsc0S3gzMeq1pETtZ2zXaLmBUZzeCnSRcd/mcsawJbyX kVi1eJ4keR2adt27sPeU3xn0pOzfqGHrc3+ECx2YaDWljDOxtoBw5loxNcxUhTAovZKO LiRsZxxiDO2oWsKKTafBzDurZUZ9WhmM29ZSCy+NhUigwfi6Z6+crTzRPgusSeVcqZOh mRjg== X-Gm-Message-State: AOAM5322PSpC4z4sRlLK7xnhpDRUr4O5dRqqgI9zoacFphHXhSy1UkaV iu/cYzyFRWl8UQizdxozQvLSc+zyaI0= X-Received: by 2002:a17:90a:20a2:: with SMTP id f31mr1193084pjg.34.1592431414361; Wed, 17 Jun 2020 15:03:34 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d23sm467248pjv.45.2020.06.17.15.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 15:03:30 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Sargun Dhillon , Christian Brauner , Tycho Andersen , David Laight , Christoph Hellwig , "David S. Miller" , Jakub Kicinski , Alexander Viro , Aleksa Sarai , Matt Denton , Jann Horn , Chris Palmer , Robert Sesek , Giuseppe Scrivano , Greg Kroah-Hartman , Andy Lutomirski , Will Drewry , Shuah Khan , netdev@vger.kernel.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v5 0/7] Add seccomp notifier ioctl that enables adding fds Date: Wed, 17 Jun 2020 15:03:20 -0700 Message-Id: <20200617220327.3731559-1-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! v5: - merge ioctl fixes into Sargun's patches directly - adjust new API to avoid "ufd_required" argument - drop general clean up patches now present in for-next/seccomp v4: https://lore.kernel.org/lkml/20200616032524.460144-1-keescook@chromium.org/ This continues the thread-merge between [1] and [2]. tl;dr: add a way for a seccomp user_notif process manager to inject files into the managed process in order to handle emulation of various fd-returning syscalls across security boundaries. Containers folks and Chrome are in need of the feature, and investigating this solution uncovered (and fixed) implementation issues with existing file sending routines. I intend to carry this in the seccomp tree, unless someone has objections. :) Please review and test! -Kees [1] https://lore.kernel.org/lkml/20200603011044.7972-1-sargun@sargun.me/ [2] https://lore.kernel.org/lkml/20200610045214.1175600-1-keescook@chromium.org/ Kees Cook (5): net/scm: Regularize compat handling of scm_detach_fds() fs: Move __scm_install_fd() to __fd_install_received() fs: Add fd_install_received() wrapper for __fd_install_received() pidfd: Replace open-coded partial fd_install_received() fs: Expand __fd_install_received() to accept fd Sargun Dhillon (2): seccomp: Introduce addfd ioctl to seccomp user notifier selftests/seccomp: Test SECCOMP_IOCTL_NOTIF_ADDFD fs/file.c | 63 +++++ include/linux/file.h | 19 ++ include/uapi/linux/seccomp.h | 22 ++ kernel/pid.c | 11 +- kernel/seccomp.c | 172 ++++++++++++- net/compat.c | 55 ++--- net/core/scm.c | 50 +--- tools/testing/selftests/seccomp/seccomp_bpf.c | 229 ++++++++++++++++++ 8 files changed, 540 insertions(+), 81 deletions(-) -- 2.25.1