Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1350446pxb; Sun, 22 Aug 2021 14:12:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzKW7BUbdCe0H1IdM62t3L/BfVf6wc0qzY9zyZb8yACAnrLRV+cZ5fPmw5Z5ipgaIXz0iz X-Received: by 2002:a05:6402:14d1:: with SMTP id f17mr32965427edx.167.1629666770169; Sun, 22 Aug 2021 14:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629666770; cv=none; d=google.com; s=arc-20160816; b=G8mALu8rg9RCCnHm6ZDSNyNHOc4Z/Hb9XpHYR2+X9P8jXUzrsAKrhjZ6u6tozV3+eP cRoVf8eiQLsfxevUdBkFk2uoXPvwDfqo0WE46IL41YfW70OqODERH2V9Z5iohhpQmD6R o07RF1xuKLPaBUPiDvEh9muupjHadcHVOnmiL1YixebitS8PdHTvFR2LhK7r1TGXAB0M CVovJh27JjT4PkfvvadktnY6cdU4GEF3X8bcms/9igmhf8ycwtJ+NtM3JRMhEmbqynqu aHmyvPk1LcKVRBwOC0+QKcS2KlDRfGhP1dTioQoJmypIpTYmLIoxsVxeoaBDVh38xuai SU5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:to:from:references:in-reply-to :message-id:date; bh=2tmEMtBXTIJbob1IjIo/uCMiL50rdg2j8nPhtIOC1DQ=; b=zNhbZ3onURoSZ5lspoaJNvzL+kS9dzWKiX7nSktGTpRoOZXUvLI+Up+L+2ASspAun6 8aeI/NIALEBp+frq7413mWewhkQXCEeM0GysvmTOKUbw2wSsfAsihW1Cvcq6/W4udWfM nnxqBukc35xb6s/h6Ij+sq3ECJgMOic1+F6n41y0j6mv+VavmzJbFvIL2EaW5jFHUFIZ 2q2PMNAFxkU69QWqyGWJmnoKjoPFLudpuBwwVEXl2DybCldphsgf+V5NJbzEuTQALeF+ UohazKxAWOrbT0jOKyjmQdRMmU7V7kcwGeQyyZ1cmG5XCCay4clxImh1d0+kPlzi7cU3 DQtw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy12si4996298edb.450.2021.08.22.14.12.27; Sun, 22 Aug 2021 14:12:50 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233393AbhHVVGu (ORCPT + 99 others); Sun, 22 Aug 2021 17:06:50 -0400 Received: from cloud48395.mywhc.ca ([173.209.37.211]:36814 "EHLO cloud48395.mywhc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232539AbhHVVGt (ORCPT ); Sun, 22 Aug 2021 17:06:49 -0400 Received: from modemcable064.203-130-66.mc.videotron.ca ([66.130.203.64]:52712 helo=localhost) by cloud48395.mywhc.ca with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mHufP-0001tb-7O; Sun, 22 Aug 2021 17:06:07 -0400 Date: Sun, 22 Aug 2021 17:06:06 -0400 Message-Id: <1625bc89782bf83d9d8c7c63e8ffcb651ccb15fa.1629655338.git.olivier@trillion01.com> In-Reply-To: References: From: Olivier Langlois To: Jens Axboe , Pavel Begunkov , Oleg Nesterov , Steven Rostedt , Ingo Molnar , "Eric W. Biederman" , io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] coredump: cancel io_uring requests before dumping core X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud48395.mywhc.ca X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - trillion01.com X-Get-Message-Sender-Via: cloud48395.mywhc.ca: authenticated_id: olivier@trillion01.com X-Authenticated-Sender: cloud48395.mywhc.ca: olivier@trillion01.com X-Source: X-Source-Args: X-Source-Dir: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The previous solution of ignoring the TIF_NOTIFY_SIGNAL bit while dumping core is only working when the core dump is sent in a file. When a pipe is used, pipe_write returns -ERESTARTSYS if signal_pending which includes TIF_NOTIFY_SIGNAL is true. A more robust solution is to make sure that io_uring will not set TIF_NOTIFY_SIGNAL while the core dump is generated by cancelling all the io_uring requests made by the current task before starting. Fixes: 06af8679449d ("coredump: Limit what can interrupt coredumps") Signed-off-by: Olivier Langlois --- fs/coredump.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/coredump.c b/fs/coredump.c index 07afb5ddb1c4..9aceb4b3b40d 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -625,6 +626,8 @@ void do_coredump(const kernel_siginfo_t *siginfo) need_suid_safe = true; } + io_uring_task_cancel(); + retval = coredump_wait(siginfo->si_signo, &core_state); if (retval < 0) goto fail_creds; -- 2.32.0