Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp238356iog; Wed, 15 Jun 2022 01:01:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5NmpIMBQfO37izIugfiUQkXnwSt4BsDeHc4BTwuyj7QpOrlAWojDiMV1fJiLucsf0ZIm2 X-Received: by 2002:a63:555d:0:b0:3fd:5d54:2708 with SMTP id f29-20020a63555d000000b003fd5d542708mr7687722pgm.92.1655280099681; Wed, 15 Jun 2022 01:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655280099; cv=none; d=google.com; s=arc-20160816; b=bWkYuTCpV42MKClZ9as3RRkgT+IBXQUKxEJpG/1UpzyX1hNQhX12TiPeOizQa8CYSf pLFY88s3/JX0xolwQ2xy8S+zQHQnVZvBxzncAur/mR+yf+Y3RhKnyVeKFaMCTbfgMtvV LROQ9SrxnJGTpMIuaqNOiAya/hxOZBVBSl73rnTq7nREfi0caLvvV56+BSPNXC/3Shud GZwaaU8idYLi2VMSMdZIiIEN4gS2z3GnBIez5ThJOeHba3ew+hF8sbG9eDxrvcaZAirX BVGDuPmjbwhLq/PEBkJ4ZolHtl5I0JJ6LEWKig9UCU0UIC4w0zHLt2UiBDoz/f5VMmCR tKKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=Ts9KtjHONM+dDdUL5NJu/c2bC7PtMeeEFKNh8C3021U=; b=eh1pXWcwYI77kAFp9g7DIjHXyP1IgR7itMZ2nG6wRwXlRwJENBwEYK9WlSB/WsQhav DkhniYGOf7KbgROhht4tlm8leeFtBCkCoNAcYYjwrQW0fj2U18ukzeGayewOBmr1WEQx qGz433bCgKKVzurBIs3HG0E/7q9SWVr2SXa+zvLzqWVeAjsySLDhcqdjqE8z59k5qUoo Eqshuv9QDjSY1pFwceC2hx9ETo4enSYN7QE1kjzN6V53yfnVK6KwELKCBa2scjn3m+nv CE9juWtzJdsLxnHcheCGSApDC8xUuws1GqmxZ00Z+uZ1Ab3uGvMO71BPzscN0BuE7Lv4 oqjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VWAPEHM9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg1-20020a17090326c100b0016198140119si14322471plb.606.2022.06.15.01.01.10; Wed, 15 Jun 2022 01:01:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VWAPEHM9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343699AbiFOHxl (ORCPT + 99 others); Wed, 15 Jun 2022 03:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243934AbiFOHxk (ORCPT ); Wed, 15 Jun 2022 03:53:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1E77841335 for ; Wed, 15 Jun 2022 00:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655279618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ts9KtjHONM+dDdUL5NJu/c2bC7PtMeeEFKNh8C3021U=; b=VWAPEHM9tFS9VYc/1fZUmRZ52wJMYfbWRYeXikvxywc/QqIuwEqXyWNPMXdI4RAoqaVdx0 JlXaFLonnuTiCtGQwqq1h+tm8OY8uIqveg6m88TGYFx3KUPQR898PO6mDplIWNkn09a386 KMC/arCT7swCI12rpxuYQUmAka3ZYdg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-Uo4PnMDGMlWH1ZtjwZ7Vcw-1; Wed, 15 Jun 2022 03:53:33 -0400 X-MC-Unique: Uo4PnMDGMlWH1ZtjwZ7Vcw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 57209811E75; Wed, 15 Jun 2022 07:53:33 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88085C08F22; Wed, 15 Jun 2022 07:53:31 +0000 (UTC) From: Florian Weimer To: Kees Cook Cc: Andrei Vagin , linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Christian Brauner , linux-mm@kvack.org, Eric Biederman Subject: Re: [PATCH 1/2] fs/exec: allow to unshare a time namespace on vfork+exec References: <20220613060723.197407-1-avagin@gmail.com> <202206141412.2B0732FF6C@keescook> Date: Wed, 15 Jun 2022 09:53:29 +0200 In-Reply-To: <202206141412.2B0732FF6C@keescook> (Kees Cook's message of "Tue, 14 Jun 2022 14:14:35 -0700") Message-ID: <874k0mqs5i.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Kees Cook: > On Sun, Jun 12, 2022 at 11:07:22PM -0700, Andrei Vagin wrote: >> Right now, a new process can't be forked in another time namespace >> if it shares mm with its parent. It is prohibited, because each time >> namespace has its own vvar page that is mapped into a process address >> space. >> >> When a process calls exec, it gets a new mm and so it could be "legal" >> to switch time namespace in that case. This was not implemented and >> now if we want to do this, we need to add another clone flag to not >> break backward compatibility. >> >> We don't have any user requests to switch times on exec except the >> vfork+exec combination, so there is no reason to add a new clone flag. >> As for vfork+exec, this should be safe to allow switching timens with >> the current clone flag. Right now, vfork (CLONE_VFORK | CLONE_VM) fails >> if a child is forked into another time namespace. With this change, >> vfork creates a new process in parent's timens, and the following exec >> does the actual switch to the target time namespace. > > This seems like a very special case. None of the other namespaces do > this, do they? I think this started with CLONE_NEWPID, which had a similar delayed effect with unshare: it happens only after fork, not for the current process image. I think it's just a limitation of the unshare interface. Some of the effects simply have to be delayed due to their nature. Thanks, Florian