Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp304824pxa; Tue, 4 Aug 2020 06:11:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+6jEHkGyLg57cDrEa8jkDh9ezpOZpMkfY7aZkFEoLbtMJ4EvonZuCvstiI7XB0ZbeOPNG X-Received: by 2002:a50:a6da:: with SMTP id f26mr20704973edc.4.1596546712504; Tue, 04 Aug 2020 06:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596546712; cv=none; d=google.com; s=arc-20160816; b=gf5ZedIBZyobpM4SewkC2fw64muknmeVwZOoD64D32OfURd38JkdCcdzrIeitg2OVP iTZCLBt9AP9JiGirfpdBk8ZPCOeszvMu9V/7jdRD0I2UDobjK9C37wzTf9sinbF1QzX1 zEmA6PmfvVVV3bBuxhuCI9iekYTjZEKTqCh+JFoEBAWRKpvKQ/7+FmqwXx8n+M5sXZ6y lgnn40eICf5A6Hg4Obx6NlsRvJPKYvrxHRDBDH+KTi/tkgNEqZ45zLf1iSc7ikhJt92X XVgsaCImZcf4eUkfeRz30wKqso8IQI5hNpiwRDrKMCm9xIefwhTvX6qf6HkDNwMjJJmG JZMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:date:message-id:to:subject:from :dkim-signature; bh=URVnzukKS+P2nWYrtw5dp7rwGBO9XtEHJXqL8SP6zO8=; b=uCk8btPU4QhPmC4utVMWVCmKielgae2Eo59viN0u/BBKk8gjF4HRafJCsUO7/NS5my vvXD80XNHPatB7Qo5qyFpEK9NwQuW0pWUeez61wkzZ/oo5W9hZEUyogTkMBc2p/2dPh9 QBMIBebzlgUZnGiTXNgZplpTgjnRuMgRbSoboLE2GCn/YKc/6Vy0tSSsbcg/T3WaHDCy jHwUmumCGfrSMRCRxut2493QQ7YLSeaM/5/wz20xWv/1imCXsks55r1C/LvHC1oO1CGn 3yLDZlNuYVyYpnnDVlXyI5ivN3GLp2dGSGA7I9uPm35zWP8sLdKNlkdv/TN+hUNUEQ7Q 2uSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@doubly.so header.s=MBO0001 header.b=KNzE2sql; 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=doubly.so Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si1726172edv.263.2020.08.04.06.11.26; Tue, 04 Aug 2020 06:11:52 -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=@doubly.so header.s=MBO0001 header.b=KNzE2sql; 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=doubly.so Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728322AbgHDNLP (ORCPT + 99 others); Tue, 4 Aug 2020 09:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727987AbgHDNLO (ORCPT ); Tue, 4 Aug 2020 09:11:14 -0400 X-Greylist: delayed 337 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 04 Aug 2020 06:11:13 PDT Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050::465:102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B487DC06174A for ; Tue, 4 Aug 2020 06:11:13 -0700 (PDT) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4BLZk31hH5zKm6T for ; Tue, 4 Aug 2020 15:05:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=doubly.so; s=MBO0001; t=1596546330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=URVnzukKS+P2nWYrtw5dp7rwGBO9XtEHJXqL8SP6zO8=; b=KNzE2sqlvnuz77ErAj4S35CFSwz7UN2ImtNaX49D3Ulj04l+OasRm8fTE4QEeqK/HUlnlv QpvMgiBcqSrpdjBRqXse2GglEYkCb7NgtB1EApxmzAO8r3xCwMdOJ+POhUcfDsIxUL4vH6 lt4IgS2bcqKzFcNnPYvpaN8BFPTtPOv390TgMFgsDED3vSJMMCMfmd0e39dNo1gBqNVvup HB2GFunwsdnaT+2ottltmcI1TRUyaS2/kztsj5tIsqY8Ou6h/SOx9cFRfWmVjb3V7L1j9Q hY9jfrRW7pAML952j+nGhZ9rhlBN7/scU686UApMKJcWbmLhJxFgz0eajxc37Q== Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id d2tN0njdRyVX for ; Tue, 4 Aug 2020 15:05:28 +0200 (CEST) From: Devin Bayer Subject: setsid2(sid) proposal - assign current process to existing session To: linux-kernel@vger.kernel.org Message-ID: Date: Tue, 4 Aug 2020 15:05:27 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-MBO-SPAM-Probability: 0 X-Rspamd-Score: -2.55 / 15.00 / 15.00 X-Rspamd-Queue-Id: 41E5D17BA X-Rspamd-UID: dce495 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, I'm wondering about the possibility of introducing a new system call for moving a process to an existing session. If `sid` is an existing session with the same owner as the current process, one could call: setsid2(sid) This would have similar behavior to setpgid(), and would probably effectively call setpgid() internally too. The use case is for something like `flatpak-spawn --host`, which allows you to launch a program in an outer namespace from an inner namespace. It behaves as a child of the caller but is actually a child of an external daemon. It works by connecting stdin/out/err to those of the caller, for example a PTY for xterm running in the inner namespace. This works fine for non-interactive programs, but it's impossible for the spawned task to share the controlling TTY with the shell running in xterm. I can't see where the problems are, though I'm surprised such functionally doesn't yet exist. Because it deals with such basic concepts, I'm wondering if such a change will even be considered. There is a workaround; one can create a new PTY on the host and copy the I/O streams manually. Not ideal, but okay. Any comments welcome. Cheers ~ dev