Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1025636ybb; Wed, 8 Apr 2020 14:56:31 -0700 (PDT) X-Google-Smtp-Source: APiQypJW+urlEL1XuCZe2w/Oor8yWXz9I4jykUQ2wg33lSFQd9rKbNIAkV2OA5I6aiXopunFmdMr X-Received: by 2002:aca:3986:: with SMTP id g128mr3996527oia.3.1586382991086; Wed, 08 Apr 2020 14:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586382991; cv=none; d=google.com; s=arc-20160816; b=pWIg3RHM3lrz92TWrv0mHqJzjPTugcuz/w/LAJqMOpa6n/Vox1xFthp8lLriN0tclb 8v37xw3O44Rhue+8wczhIGlsDpcRWAVx/F7TFOZY2wXLzYMRR56I3OciUVkgHhz8kKNL WZCO+SvmGrqr6UNKiFUUsfQzQSgLVcvCoHPPeT1Py/d8rB34ozdpnepu6ygc4nhCz8dY ULmYVcI7y0VUHGF4cCSjcN/XfP5qbbi4MGV57YxlgJRv7JFHJO8jcPPqUQwwjJ1BklYq c44K+tKW9M72AVj5fpz9Dlz8znF8ExmHa5mIQ7sul7imamLWBjSsM6h8pZSWTHzpraOb zvtw== 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=sXe5C1gc2sGWqYHSYOCq/BDjUwMZgu4ML+Hffa0kPpE=; b=MXV8fYjUBXPcceumHGInuQxrSUtVx4BxcuHNzGtwQPox7MAwvqE30lTBMbFaUNQgy+ FlwSnqllIc9GEKaiEgp4Oa6IIA+ipvqU9CPx6kOKcidrYJvNb/UVeNp824H1N3/xRWFa 96gvw7PdjvJ7NvvW6KyaP04KrkmteoO3Xy3O4tkVy94Bb4X7uvu/rvx8FB2G6bY+vAvF M7MyWqNTOU3c7NTMGsiApY3AblTc3CpUiAm2DTjSTo1QSN/h/GU+QHVxWoGSyc9PD20L Mj1NwPH4xh2OAwWG2KlofgEPojkYszBoai/mwaqBORY4UsoC9ZbIvgBtOH90JCcsw+E6 9CIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v35si1579703otb.120.2020.04.08.14.56.19; Wed, 08 Apr 2020 14:56:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728273AbgDHTyE (ORCPT + 99 others); Wed, 8 Apr 2020 15:54:04 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:37952 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726709AbgDHTyD (ORCPT ); Wed, 8 Apr 2020 15:54:03 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jMGlt-0006MP-M5; Wed, 08 Apr 2020 13:54:01 -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 1jMGlt-0000Xd-0W; Wed, 08 Apr 2020 13:54:01 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds Cc: Bernd Edlinger , Linux Kernel Mailing List , Alexey Gladkov , Oleg Nesterov , Kees Cook , Jann Horn , Christian Brauner References: <87blobnq02.fsf@x220.int.ebiederm.org> <87lfnda3w3.fsf@x220.int.ebiederm.org> <87wo6s3wxd.fsf_-_@x220.int.ebiederm.org> <87o8s43wuq.fsf_-_@x220.int.ebiederm.org> Date: Wed, 08 Apr 2020 14:51:10 -0500 In-Reply-To: (Linus Torvalds's message of "Wed, 8 Apr 2020 10:25:17 -0700") Message-ID: <875ze9ycwh.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=1jMGlt-0000Xd-0W;;;mid=<875ze9ycwh.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/uIisiQByxQnmMGlkpSKa9gSxUVSdAITo= 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 sa07.xmission.com X-Spam-Level: ** X-Spam-Status: No, score=2.0 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01,XMNoVowels, XMSubLong 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.4997] * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 299 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 12 (4.0%), b_tie_ro: 10 (3.5%), parse: 1.05 (0.4%), extract_message_metadata: 16 (5.2%), get_uri_detail_list: 1.47 (0.5%), tests_pri_-1000: 14 (4.8%), tests_pri_-950: 1.25 (0.4%), tests_pri_-900: 0.98 (0.3%), tests_pri_-90: 57 (19.1%), check_bayes: 55 (18.5%), b_tokenize: 6 (1.9%), b_tok_get_all: 6 (1.9%), b_comp_prob: 2.2 (0.7%), b_tok_touch_all: 39 (12.9%), b_finish: 0.94 (0.3%), tests_pri_0: 184 (61.5%), check_dkim_signature: 0.49 (0.2%), check_dkim_adsp: 2.1 (0.7%), poll_dns_idle: 0.69 (0.2%), tests_pri_10: 2.1 (0.7%), tests_pri_500: 8 (2.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 1/3] binfmt: Move install_exec_creds after setup_new_exec to match binfmt_elf 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 Linus Torvalds writes: > On Mon, Apr 6, 2020 at 6:34 PM Eric W. Biederman wrote: >> >> In 2016 Linus moved install_exec_creds immediately after >> setup_new_exec, in binfmt_elf as a cleanup and as part of closing a >> potential information leak. >> >> Perform the same cleanup for the other binary formats > > Can we not move it _into_ setup_new_exec() now if you've changed all > the binfmt handlers? > > The fewer cases of "this gets called by the low-level handler at > different points" that we have, the better off we'd be, I think. One > of the complexities of our execve() code is that some of it gets > called directly, and some of it gets called by the binfmt handler, and > it's often very hard to see the logic when it jumps out to the binfmt > code and then back to the generic fs/exec.c code.. Yes. I already have merging of setup_new_exec and install_exec_creds in my working tree. I just posted the simplest set of patches to get the idea across. We can almost merge those two with flush_old_exec as well except for the code that sets the personality between flush_old_exec and and setup_new_exec. I am wondering if maybe setting the personality should be a callback. Eric