Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp680778ybg; Fri, 12 Jun 2020 11:40:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxop4NZQ2yYLztrNGqx1gMMT7NMkNusOtJJ+qZ7KQvcoQyLrc2nBfkd5sSamNiFlhfxV1r X-Received: by 2002:a17:906:1904:: with SMTP id a4mr14259446eje.194.1591987246340; Fri, 12 Jun 2020 11:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591987246; cv=none; d=google.com; s=arc-20160816; b=HAJ8bcy3H6tJtuGudRuOZkOH0T+tteI2fjN7jfUzmWGwPsAgmdlPIZCJnmmMAlzwbn W+b7y2GynVb2eA+b42g6UuKURihM0WEQIx5AQ+5an0YA5UH6F7WO9BEdJtjLu9jvB+nG rUoKaZycC4D9+xgsXt0oYgjs/BvCRuKHr1UfonW8Z2ofiMZ2Ttz1wA3CSFF6iq45sKto iQMG8qL6qcRqTHlPjfg30CZVEm7qlY0sq1PW4z/zrEYcuXgol/x4BNZYQ7hygjXqJxFF Yr8jIcNH690KW9iJaTTaHIXOkLK/mbOSUL1lh7fSbrcO0j/FcVsxmza2PNSvh/ZEcSzM kgtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=JT8oJD0kpQknzBVSZP3Z/2D3ZlbgWd1By/OrwYLAa6A=; b=rq7E97yHDMhsdwVZ5PsNfRamfx7LdnWSQ6pFDHLpIB4VqDNAjycQzmL6QDfsEoE7A4 c+eVqMTbMoZYviIdI5l7TGu0p9+H4lkrI1oxqZWdlySycsxsud5bJ7yt4e4v7DN8Ek1v 8vr9lwdKICL6KQq83hVJpOJYjTn7qn9Gf2Z+qjEFFqgyKqNVTd7giaM0h7qyhRYJWhh0 64bRlz0zF1bd3dTIiqpK3hk3jeA0djKL7gHKFzP/mJyJZ8iHJtuJtUyMCH0BouBiFbrd d0pxxcyJxaOd2IYijqIUaI/OSYNIHEc7Lc+dSgHsx3VpzGgHAqt5nHczLZ1gbRWCkQOU 6RyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U10uEEVi; 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 s15si4313661ejq.486.2020.06.12.11.40.23; Fri, 12 Jun 2020 11:40:46 -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=U10uEEVi; 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 S1726272AbgFLSig (ORCPT + 99 others); Fri, 12 Jun 2020 14:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgFLSif (ORCPT ); Fri, 12 Jun 2020 14:38:35 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6EC5C08C5C2 for ; Fri, 12 Jun 2020 11:38:35 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id r18so4507124pgk.11 for ; Fri, 12 Jun 2020 11:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JT8oJD0kpQknzBVSZP3Z/2D3ZlbgWd1By/OrwYLAa6A=; b=U10uEEViSocGeq7huvYZniWsLdXbFGNHeYYlLoO3+rCSFg9w1WEquFmb4W0zY7AZRD E7CNqC0dJexgTuH0Pvbo+SiLE0vHNH+ueUP892gN+69vPCV8rxhH63Lt+KnEyoie9TcW vdeYY9cIoIja/EdttRdHl0Rn+8mzjxjoaLVdA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JT8oJD0kpQknzBVSZP3Z/2D3ZlbgWd1By/OrwYLAa6A=; b=AvfL7KA5fTSMHFrTV8yCC4wEgVO8fn8pxha+nAWeuA+bmAoJ7c0qqaQW7H+F6hfwA2 oQ7RcWQ0/4n37NwGC2toSmtnCUHwrS7XZiAKQvqHLqbYkUM2hwzczT+CGe+2HnOl1syD BGJEucLhST5j7DGG4YutFPG2BGAp2EryzyGFNlSgToD9Ln15r/9RO+GAE+wdz/jWE2V9 D8o+6T8BfDjyTqxj0xh4SNG49C+h38m6TymDHiTa+N3SR4bKNZwwO9yonr3H9IZDreTp DtfwjV5HxoVYb6rHUfQNrAWmeOH5CI7A3/Qw8Z0QxxugnWVy36kLqR2H/wzVIP5dGlx1 Fq1Q== X-Gm-Message-State: AOAM532qdWyifOQZKJbzcHW8ZEtKoEkUCnTo8TYPF0EHP2tDdD2EK2hr JusGyJkA1yUoqC2jIHEPv3uFiQ== X-Received: by 2002:a63:ff51:: with SMTP id s17mr10439801pgk.300.1591987115224; Fri, 12 Jun 2020 11:38:35 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id v7sm4266581pfn.147.2020.06.12.11.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 11:38:34 -0700 (PDT) Date: Fri, 12 Jun 2020 11:38:33 -0700 From: Kees Cook To: Christian Brauner Cc: Sargun Dhillon , Giuseppe Scrivano , Robert Sesek , Chris Palmer , Jann Horn , Greg Kroah-Hartman , "containers@lists.linux-foundation.org" , "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Matt Denton , Tejun Heo , David Laight , Al Viro , "linux-fsdevel@vger.kernel.org" , "cgroups@vger.kernel.org" , "David S . Miller" Subject: Re: [PATCH v3 1/4] fs, net: Standardize on file_receive helper to move fds across processes Message-ID: <202006121135.F04D66DFA@keescook> References: <20200610081237.GA23425@ircssh-2.c.rugged-nimbus-611.internal> <202006101953.899EFB53@keescook> <20200611100114.awdjswsd7fdm2uzr@wittgenstein> <20200611110630.GB30103@ircssh-2.c.rugged-nimbus-611.internal> <067f494d55c14753a31657f958cb0a6e@AcuMS.aculab.com> <202006111634.8237E6A5C6@keescook> <94407449bedd4ba58d85446401ff0a42@AcuMS.aculab.com> <20200612104629.GA15814@ircssh-2.c.rugged-nimbus-611.internal> <202006120806.E770867EF@keescook> <20200612182816.okwylihs6u6wkgxd@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200612182816.okwylihs6u6wkgxd@wittgenstein> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 12, 2020 at 08:28:16PM +0200, Christian Brauner wrote: > Al didn't want the PAGE_SIZE limit in there because there's nothing > inherently wrong with copying insane amounts of memory. Right, ok. > (Another tangent. I've asked this on Twitter not too long ago: do we > have stats how long copy_from_user()/copy_struct_from_user() takes with > growing struct/memory size? I'd be really interested in this. I have a > feeling that clone3()'s and - having had a chat with David Howells - > openat2()'s structs will continue to grow for a while... and I'd really > like to have some numbers on when copy_struct_from_user() becomes > costly or how costly it becomes.) How long it takes? It should be basically the same, the costs should be mostly in switching memory protections, etc. I wouldn't imagine how many bytes being copied would matter much here, given the sub-page sizes. > > Ah yeah, I like this because of what you mention below: it's forward > > compat too. (I'd just use the ioctl masks directly...) > > > > switch (cmd & ~(_IOC_SIZEMASK | _IOC_DIRMASK)) > > > > > return seccomp_notify_addfd(filter, buf, _IOC_SIZE(cmd)); > > > > I really like that this ends up having the same construction as a > > standard EA syscall: the size is part of the syscall arguments. > > This is basically what I had proposed in my previous mail, right? I guess I missed it! Well, then I think we're all in agreement? :) -- Kees Cook