From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id EA230385625C for ; Wed, 8 Jun 2022 08:35:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA230385625C Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-205-UNc1p7T4M1GTNyjViLdO3A-1; Wed, 08 Jun 2022 04:35:44 -0400 X-MC-Unique: UNc1p7T4M1GTNyjViLdO3A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1D5B1C00AC1; Wed, 8 Jun 2022 08:35:43 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.117]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C19A1121314; Wed, 8 Jun 2022 08:35:41 +0000 (UTC) From: Florian Weimer To: Andrei Vagin Cc: Christian Brauner , Adhemerval Zanella , libc-alpha@sourceware.org, Alexey Izbyshev , Carlos O'Donell Subject: Re: [PATCH v4 0/3] Linux: Fix posix_spawn when user with time namespaces References: <20220510191155.1998575-1-adhemerval.zanella@linaro.org> <877d6tb3hl.fsf@oldenburg.str.redhat.com> <20220511092119.ke4zlm2dkazasmva@wittgenstein> <87h75dyf3p.fsf@oldenburg.str.redhat.com> <87sfori3dy.fsf@oldenburg.str.redhat.com> Date: Wed, 08 Jun 2022 10:35:40 +0200 In-Reply-To: (Andrei Vagin's message of "Wed, 8 Jun 2022 00:21:23 -0700") Message-ID: <87a6anh7s3.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, 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 server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2022 08:35:49 -0000 * Andrei Vagin: >> Regarding the patch you sketched, we'd probably have to introduce a new >> flag (not CLONE_NEWTIME) for this because the difference in behavior is >> quite visible. > > I agree that if we want to switch timens on exec, we need to introduce a > new clone flag. But I would like to avoid doing that. I think we can > live with the current clone flag if we allow switching timens only when > exec is executed by a vfork-ed process. In this case, the chance to > affect existing users is very low, isn't it? > > Without the new change, vfork fails if the currect process has unshared > timens. With the change, vfork creates a new process, and the following > exec executes a binary in the target timens. This is an interesting observation. The behavior is a bit non-obvious (but so is the vfork failure), but I agree that it could work. There are already restrictions and oddities after vfork, so I think it's not too bad after all. And I think it will make posix_spawn-like functions magically work that are currently broken, in pretty much all cases. Thanks, Florian