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 39C19C43334 for ; Tue, 14 Jun 2022 21:14:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 735026B0071; Tue, 14 Jun 2022 17:14:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E4426B0072; Tue, 14 Jun 2022 17:14:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 584B76B0073; Tue, 14 Jun 2022 17:14:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 46B386B0071 for ; Tue, 14 Jun 2022 17:14:38 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1A96432B85 for ; Tue, 14 Jun 2022 21:14:38 +0000 (UTC) X-FDA: 79578095436.31.49BF946 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf28.hostedemail.com (Postfix) with ESMTP id 99D48C00AC for ; Tue, 14 Jun 2022 21:14:37 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id d13so8750325plh.13 for ; Tue, 14 Jun 2022 14:14:37 -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=HkQPTB8t9EvGTKD58qF0vHfJ68oz3l8jIBkren14MtU=; b=aTkpA5a5N6RUC9vd4bhLfhbhY/dz8q6pNmobzGI2TMh1aU1jDqxRo5Gxd/Zft8SmN6 SIhZMRCGAIy+V/TMcqBK7WEhxm0SkwnT2JX22dhc4C/53+O4dm2pbpCriM8kBPoGMJdV GHRSx3d9WBeM29p9VR6/Z2Nas89KWs9bNq5AM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HkQPTB8t9EvGTKD58qF0vHfJ68oz3l8jIBkren14MtU=; b=bowAlp3iCt2DDwf3a3sl30U7k5HP1xCN7ohEYHwppG2ct8pbUT+rO2RntEILGajsRh JJu4Hv8kAcnN4ZR3FoYvWOKog4VPCyLgDTWp6lzsgtjRAxw3i2NJNgJ+F9hE3TgUFcs2 3LMQ5ZEGZYKFOyjzmey0o1IEapFJ0JC1Zcv/FS8sWyYBJe6K87GsbKId8keWTNq+H+Tb eeG+pZWk/46ErOxQAYEYd99ljZNPVIcMPcq0PYfpMkz3cTAKgusfqfCRAnMVZYxWd6pT +3UOfM8fq6Z2WPyZS+0FRkx+qny1kAwR3cyfMnY517AdYf+tdYsdTcUjpjDKO040wM08 5arA== X-Gm-Message-State: AJIora8ByTLeLybZUZ3BHPDdu25MIRhvIVDupz+f1TgClpMpIMcLYm2J dw2rnjwXJBKnojuEHs0QI2xAFw== X-Google-Smtp-Source: AGRyM1uFBH5wfa41P6XfONQLES95sTRwU3lihAbKYJg4LX3fASGK2gpnxJeeDBjDXT40OVpTGzCeNA== X-Received: by 2002:a17:90b:1e42:b0:1e8:7669:8a1c with SMTP id pi2-20020a17090b1e4200b001e876698a1cmr6476478pjb.206.1655241276404; Tue, 14 Jun 2022 14:14:36 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b185-20020a621bc2000000b0051bc22c153asm8054589pfb.65.2022.06.14.14.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 14:14:36 -0700 (PDT) Date: Tue, 14 Jun 2022 14:14:35 -0700 From: Kees Cook To: Andrei Vagin Cc: linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Christian Brauner , Florian Weimer , linux-mm@kvack.org, Eric Biederman Subject: Re: [PATCH 1/2] fs/exec: allow to unshare a time namespace on vfork+exec Message-ID: <202206141412.2B0732FF6C@keescook> References: <20220613060723.197407-1-avagin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220613060723.197407-1-avagin@gmail.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655241277; 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=HkQPTB8t9EvGTKD58qF0vHfJ68oz3l8jIBkren14MtU=; b=HW0hc7x3Vsk6tarHzQQHVE3HmaZm3uXBOAGhxxGk4h9fv5/eel7IU9AFaCdgtvPBa+ToUi ELKYDQdmFRA0qNNfK3jRHVSXoQa86nOdmJ0BHrT2KQMwcTTbfXqho0l2dNR4YAKZ/ernlu /IMNpYF/aw/s15d9p3qeCO+8IgGzAv4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655241277; a=rsa-sha256; cv=none; b=Ls2xFIMnSn6mSDLkHkuO1SN7eCRDAIsFTrJx436HEXpZhnz8Tddt9jqpRuzdcFpRwjNA15 SXLbIXKm7QLixwKXR2/gBymlZNNS4Zzp78c9COwhf1HJXm14uRFSwtJIEYHqNEfhGbbeIM US5zCwvVPhNESwhYa8Gx3zG+rja3LIY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=aTkpA5a5; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf28.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.182 as permitted sender) smtp.mailfrom=keescook@chromium.org Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=aTkpA5a5; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf28.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.182 as permitted sender) smtp.mailfrom=keescook@chromium.org X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: 8iaik1sd1nu3xnwrkuhqqg9wh51brddk X-Rspamd-Queue-Id: 99D48C00AC X-HE-Tag: 1655241277-109616 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: 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? How is CLONE_NEWTIME supposed to be used today? -Kees -- Kees Cook