From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE12C64E7C for ; Wed, 2 Dec 2020 15:23:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61B5320872 for ; Wed, 2 Dec 2020 15:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728474AbgLBPXM (ORCPT ); Wed, 2 Dec 2020 10:23:12 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:45566 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728280AbgLBPXM (ORCPT ); Wed, 2 Dec 2020 10:23:12 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kkTxe-008pWF-1s; Wed, 02 Dec 2020 08:22:30 -0700 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.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kkTxc-007fto-Ti; Wed, 02 Dec 2020 08:22:29 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Cc: Linus Torvalds , Oleg Nesterov , Al Viro , Kees Cook , Jens Axboe References: <878saih2op.fsf@x220.int.ebiederm.org> Date: Wed, 02 Dec 2020 09:21:57 -0600 In-Reply-To: <878saih2op.fsf@x220.int.ebiederm.org> (Eric W. Biederman's message of "Mon, 30 Nov 2020 16:58:46 -0600") Message-ID: <87lfegcjxm.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=1kkTxc-007fto-Ti;;;mid=<87lfegcjxm.fsf@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18k/nm6I5OVD9qQBrGSYbdgXRiQTuW2bmI= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH] exec: Move io_uring_task_cancel after the point of no return X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ebiederm@xmission.com (Eric W. Biederman) writes: > Now that unshare_files happens in begin_new_exec after the point of no > return, io_uring_task_cancel can also happen later. > > Effectively this means io_uring activities for a task are only canceled > when exec succeeds. > > Signed-off-by: Eric W. Biederman > --- > > This is against my exec-for-v5.11 branch applied. > fs/exec.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fs/exec.c b/fs/exec.c > index 14fae2ec1c9d..9e9368603168 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1257,6 +1257,11 @@ int begin_new_exec(struct linux_binprm * bprm) > if (retval) > goto out; > > + /* > + * Cancel any io_uring activity across execve > + */ > + io_uring_task_cancel(); > + > /* Ensure the files table is not shared. */ > retval = unshare_files(); > if (retval) > @@ -1783,11 +1788,6 @@ static int bprm_execve(struct linux_binprm *bprm, > struct file *file; > int retval; > > - /* > - * Cancel any io_uring activity across execve > - */ > - io_uring_task_cancel(); > - > retval = prepare_bprm_creds(bprm); > if (retval) > return retval;