From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F392C433EF for ; Wed, 15 Jun 2022 07:53:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2EFBA6B0071; Wed, 15 Jun 2022 03:53:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 278556B0072; Wed, 15 Jun 2022 03:53:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F2B36B0073; Wed, 15 Jun 2022 03:53:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ED0666B0071 for ; Wed, 15 Jun 2022 03:53:38 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C0713144B for ; Wed, 15 Jun 2022 07:53:38 +0000 (UTC) X-FDA: 79579705716.01.1AB15A1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 0A98BC009D for ; Wed, 15 Jun 2022 07:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655279617; 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=FXTKUxd64nLLIwF+PQCx2RZTJUXOCQ9mT06OTIzqBzKi9zrx9zm/u/QNGHmfFshQOrHlQ0 1nD8cC7z1evltN582m50hXN2AUmuyHDCAkTxxG1vg06wCRXsG6dFU3uwbtJmdwn70WCSrU RHThKOPi6fd6WRlJV8eI7Up57UrZqwk= 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655279618; a=rsa-sha256; cv=none; b=bNtefuQgmF0R4FxL5H4Cpz7mMgGFWyPlbpEIR6ZRo73cfL+Jz6EUgvtSmrqe/KphCc6I8b 0AqiRU9xIdXUH6RMcQLtOxh8G0+PS4BUIj7f0qrWexfIX+lrznfDDMEqAAkqWLb1B4xL4Q agycMzkC1CDDU5/47UE51B3i5wO9r7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655279618; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Ts9KtjHONM+dDdUL5NJu/c2bC7PtMeeEFKNh8C3021U=; b=INspHUp7pzz/Lj27oF6owjYyY0kyQqQcz/8fBYYO1zF/p6fr8yWWX9+5k5jNgAK0tEl/Yu ZeMJe7k2aIV/IZrBXMoaHyJjdU/YakSirATOIPsq4skNEZuSUz/295iCsDgAHYqkNzcjIM sRvOX33gZWfNxenpOVEtn7pOQqJHzVA= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FXTKUxd6; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf22.hostedemail.com: domain of fweimer@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=fweimer@redhat.com Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FXTKUxd6; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf22.hostedemail.com: domain of fweimer@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=fweimer@redhat.com X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 0A98BC009D X-Stat-Signature: hkj3u6pg3u391gdt15askbde6s9zxti8 X-HE-Tag: 1655279617-443884 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: * 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