Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1684069

Re: [PATCH v2 1/8] exec: Correct comments about "point of no return"

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From ebiederm@xmission.com (Eric W. Biederman)
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/8] exec: Correct comments about "point of no return"
Date Mon, 10 Jul 2017 11:00:05 +0200
Message-ID <u1CHX-2Lf-87@gated-at.bofh.it> (permalink)
References <u1BLP-2bz-7@gated-at.bofh.it> <u1BLP-2bz-5@gated-at.bofh.it>
X-Original-To Kees Cook <keescook@chromium.org>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version 1.0
Content-Type text/plain
X-Xm-Spf eid=1dUUSH-0006qU-0B;;;mid=<87van0r86d.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.213.87;;;frm=ebiederm@xmission.com;;;spf=neutral
X-Xm-Aid U2FsdGVkX18YVyyN59Exyp6WiAQgfX8VOClqhratBZU=
X-Sa-Exim-Connect-IP 67.3.213.87
X-Sa-Exim-Mail-From ebiederm@xmission.com
X-Spam-Report * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1]
X-Spam-Dcc XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1
X-Spam-Combo ;Kees Cook <keescook@chromium.org>
X-Spam-Timing total 186 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 3.0 (1.6%), b_tie_ro: 2.0 (1.1%), parse: 1.17 (0.6%), extract_message_metadata: 2.9 (1.6%), get_uri_detail_list: 0.90 (0.5%), tests_pri_-1000: 6 (3.0%), tests_pri_-950: 1.15 (0.6%), tests_pri_-900: 1.02 (0.5%), tests_pri_-400: 21 (11.6%), check_bayes: 20 (11.0%), b_tokenize: 8 (4.1%), b_tok_get_all: 6 (3.1%), b_comp_prob: 1.87 (1.0%), b_tok_touch_all: 3.3 (1.8%), b_finish: 0.65 (0.4%), tests_pri_0: 136 (73.0%), check_dkim_signature: 0.47 (0.3%), check_dkim_adsp: 2.9 (1.6%), tests_pri_500: 4.3 (2.3%), rewrite_mail: 0.00 (0.0%)
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 robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 33
Organization linux.* mail to news gateway
X-Original-Cc Linus Torvalds <torvalds@linux-foundation.org>, Andy Lutomirski <luto@kernel.org>, David Howells <dhowells@redhat.com>, Serge Hallyn <serge@hallyn.com>, John Johansen <john.johansen@canonical.com>, Casey Schaufler <casey@schaufler-ca.com>, Alexander Viro <viro@zeniv.linux.org.uk>, Michal Hocko <mhocko@kernel.org>, Ben Hutchings <ben@decadent.org.uk>, Hugh Dickins <hughd@google.com>, Oleg Nesterov <oleg@redhat.com>, "Jason A. Donenfeld" <Jason@zx2c4.com>, Rik van Riel <riel@redhat.com>, James Morris <james.l.morris@oracle.com>, Greg Ungerer <gerg@linux-m68k.org>, Ingo Molnar <mingo@kernel.org>, Nicolas Pitre <nicolas.pitre@linaro.org>, Stephen Smalley <sds@tycho.nsa.gov>, Paul Moore <paul@paul-moore.com>, Vivek Goyal <vgoyal@redhat.com>, Mickaël Salaün <mic@digikod.net>, Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov
X-Original-Date Mon, 10 Jul 2017 03:46:18 -0500
X-Original-Message-ID <87van0r86d.fsf@xmission.com>
X-Original-References <1499673451-66160-1-git-send-email-keescook@chromium.org> <1499673451-66160-2-git-send-email-keescook@chromium.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1684069

Show key headers only | View raw


But you miss it.

The "point of no return" is the call to de_thread.  Or aguably anything in
flush_old_exec.  Once anything in the current task is modified you can't
return an error.

It very much does not have anything to do with brpm.    It has
everything to do with current.


> diff --git a/fs/exec.c b/fs/exec.c
> index 904199086490..7842ae661e34 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -1285,7 +1285,14 @@ int flush_old_exec(struct linux_binprm * bprm)
>  	if (retval)
>  		goto out;
>  
> -	bprm->mm = NULL;		/* We're using it now */
> +	/*
> +	 * After clearing bprm->mm (to mark that current is using the
> +	 * prepared mm now), we are at the point of no return. If
> +	 * anything from here on returns an error, the check in
> +	 * search_binary_handler() will kill current (since the mm has
> +	 * been replaced).
> +	 */
> +	bprm->mm = NULL;
>  
>  	set_fs(USER_DS);
>  	current->flags &= ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD |

Eric

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/8] exec: Correct comments about "point of no return" Kees Cook <keescook@chromium.org> - 2017-07-10 10:00 +0200
  Re: [PATCH v2 1/8] exec: Correct comments about "point of no return" ebiederm@xmission.com (Eric W. Biederman) - 2017-07-10 11:00 +0200
    Re: [PATCH v2 1/8] exec: Correct comments about "point of no return" Kees Cook <keescook@chromium.org> - 2017-07-10 18:10 +0200
      Re: [PATCH v2 1/8] exec: Correct comments about "point of no return" Kees Cook <keescook@chromium.org> - 2017-07-18 08:40 +0200

csiph-web