Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp286872ybr; Fri, 22 May 2020 06:41:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPUbOvHYMnn85itR4af4jUcElL1iGrUpZdEsoF/GuQrt4DhXdv0lUfBkcdGEpy5m+wZXrV X-Received: by 2002:aa7:d691:: with SMTP id d17mr3032911edr.273.1590154911645; Fri, 22 May 2020 06:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590154911; cv=none; d=google.com; s=arc-20160816; b=Jg0KLAOoXMKo57TgFjl5mBeGY59SgUiWy0WKXhcf1R5qYpIr3mlCOSNpZ4fVVJCb/X uhKKlwP3wPuXfuBDDHvjpci8ECSyBAbREOyzjO+f4WWPStfWAGvb7pokNF7UEZWpJSv7 3oLVnt+RWewSx999A+XeM5LYCEl9YF8Rvx1fgAvZv2XUWs5kcAHksYm/DYqU9sq5GZw+ P2MjqZGfao63aZ9kHgFjc+qi3KpXU9r/Vjbptdi3D+8x9LCTf3ohqW7R6nbYEV7EwzfR 46KWwoK9P3g9hZ/fsaZeku+damDG6jPdClrTt1GyW31qGg77JJhA64QtO8nx1l/ulshB CSAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from; bh=dwxYMgK3MMwJPtmBXEc6hJ4WGe4o/nBYJV6RBFzz3r0=; b=DrUmEN5brD71wCMEduM49nxyeTIRoHKOj05z0y9qIxmUGmqgzgiCvPuw8e68pXpiLy GokDVHp9j7REZJlAunuhkRzimbcK91SAmz/sqwlOEBDBEXoe2tTpx1dDBHyot7f6elPl 1//GRuJM+lnoOeimdzrLpjLCfU6Ov4Jhbjg24J1Mr2ic0Xd2SAqbiWWeNiRxPyDEi7Pb sLKXFN3xZu2x8qB7CUGTR4+t7/MO8FjL29cyRr93o8io7gxDVkOT+f0S2h0H1bhXO89N JFXzjhFE4wDRXY0uT0INdM1y2R7XNgYDjzrEcN4MYcYeeLsdtCVaHbvE7JW7SNJQRQI9 4HcQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si4977111ejr.560.2020.05.22.06.41.27; Fri, 22 May 2020 06:41:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729922AbgEVNjB (ORCPT + 99 others); Fri, 22 May 2020 09:39:01 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:34864 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729406AbgEVNjA (ORCPT ); Fri, 22 May 2020 09:39:00 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jc7sy-0003j6-TB; Fri, 22 May 2020 07:38:53 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1jc7sx-0000zH-CV; Fri, 22 May 2020 07:38:52 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Rob Landley Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Oleg Nesterov , Jann Horn , Kees Cook , Greg Ungerer , Bernd Edlinger , linux-fsdevel@vger.kernel.org, Al Viro , Alexey Dobriyan , Andrew Morton , Casey Schaufler , linux-security-module@vger.kernel.org, James Morris , "Serge E. Hallyn" , Andy Lutomirski References: <87h7wujhmz.fsf@x220.int.ebiederm.org> <87sgga6ze4.fsf@x220.int.ebiederm.org> <87v9l4zyla.fsf_-_@x220.int.ebiederm.org> <877dx822er.fsf_-_@x220.int.ebiederm.org> <87y2poyd91.fsf_-_@x220.int.ebiederm.org> <874ksaioc6.fsf@x220.int.ebiederm.org> <87r1vcd4wo.fsf@x220.int.ebiederm.org> <6ce125fd-4fb1-8c39-a9a9-098391f2016a@landley.net> Date: Fri, 22 May 2020 08:35:06 -0500 In-Reply-To: <6ce125fd-4fb1-8c39-a9a9-098391f2016a@landley.net> (Rob Landley's message of "Thu, 21 May 2020 23:51:20 -0500") Message-ID: <871rnccctx.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1jc7sx-0000zH-CV;;;mid=<871rnccctx.fsf@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+mSrIOE54/VQp+XUfD3u/JlfcpgUct7Ko= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa06.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG autolearn=disabled version=3.4.2 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 0; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: ; sa06 0; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Rob Landley X-Spam-Relay-Country: X-Spam-Timing: total 1062 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 12 (1.1%), b_tie_ro: 10 (1.0%), parse: 1.78 (0.2%), extract_message_metadata: 18 (1.7%), get_uri_detail_list: 1.45 (0.1%), tests_pri_-1000: 8 (0.7%), tests_pri_-950: 1.39 (0.1%), tests_pri_-900: 1.10 (0.1%), tests_pri_-90: 63 (5.9%), check_bayes: 61 (5.7%), b_tokenize: 12 (1.2%), b_tok_get_all: 9 (0.8%), b_comp_prob: 3.7 (0.3%), b_tok_touch_all: 32 (3.0%), b_finish: 1.06 (0.1%), tests_pri_0: 457 (43.0%), check_dkim_signature: 0.70 (0.1%), check_dkim_adsp: 2.6 (0.2%), poll_dns_idle: 481 (45.3%), tests_pri_10: 2.4 (0.2%), tests_pri_500: 493 (46.4%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2 7/8] exec: Generic execfd support X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rob Landley writes: > On 5/21/20 10:28 PM, Eric W. Biederman wrote: >> >> Rob Landley writes: >> >>> On 5/20/20 11:05 AM, Eric W. Biederman wrote: >> >>>> The file descriptor is stored in mm->exe_file. >>>> Probably the most straight forward implementation is to allow >>>> execveat(AT_EXE_FILE, ...). >>> >>> Cool, that works. >>> >>>> You can look at binfmt_misc for how to reopen an open file descriptor. >>> >>> Added to the todo heap. >> >> Yes I don't think it would be a lot of code. >> >> I think you might be better served with clone(CLONE_VM) as it doesn't >> block so you don't need to feed yourself your context over a pipe. > > Except that doesn't fix it. > > Yes I could use threads instead, but the cure is worse than the disease and the > result is your shell background processes are threads rather than independent > processes (is $$ reporting PID or TID, I really don't want to go > there). I was just suggesting clone(CLONE_VM) because it creates a thread in a separate process. Which on nommu sounds like it could be almost exactly what you want. If you need the separate copies of all of your global variables etc, re-exec'ing your self could be the easier way to go. Eric