Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3374143pxb; Mon, 17 Jan 2022 18:58:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwM+Ny4oAcA+/kh30SCCGi+k/oQoA5HrU+zv6DT3PmagcG8QiirWzLtznFGSZ0ldn2cbIJr X-Received: by 2002:a62:33c7:0:b0:4bd:5aa4:1220 with SMTP id z190-20020a6233c7000000b004bd5aa41220mr23796299pfz.55.1642474690595; Mon, 17 Jan 2022 18:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642474690; cv=none; d=google.com; s=arc-20160816; b=sZq9BOMM1/PVc8IzqZCLfntalDZqvhce+r89ROnynPK4xJw17Lf4+Bb0W9Og2HLLFS xO0EXWgsc2+oNFkofBsSA0vaE+d5fFqgzsBm01roFMsVNfOQYUVNvtDgN1v0JdSOuavX Lv9ueUlsaEYNl30RG34MAxEkHQXCctviccYHSvt3tlZNkubUAxRiScn7s52wsBWdbYg6 pKWOy+06yxx8EulINmipuGqMn1DZKvxR1tjEkrnma3sTchYmxNLHp6Y1FmxlDYNTjozh ssH3LIu/8HdKJ5aTBiz1XBEvMpWjcMAMUZ6IfYmDJhnhpxp/O3LmmEDV5O6ArA8dYPK1 OFdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:mime-version:user-agent:message-id :in-reply-to:date:references:cc:to:from; bh=/pybiAlMvnG68AJD3uDqYzlCvdKmsJOCZE5lmpsnaCw=; b=qzTJTabCZTjyfyiKyKgwwJSNnk0Sv0Rbgo0bnLbpp5hGO0eH5U+M4e94V7HhJ0T5I/ Rd1+ulnOKX8XTrYJaKPNgUkfh1mz+gFZ4TYrE0EidgvEz3MeSzHOBg39h/rt/7TcoGyb 7ONgh4euxwO9MF1EZpv5uOYclGoEI+6tQcaorj1jgCuMATjAZdEw0SmT+I6+DuMmBckM 0JB2Y5f46ukCgqpZFU1OZh2h5H15OfAo8CI1gN4o3XW+pliisTKHFi9cMUut5JYsDpG5 N4NXYeT29gjOKSulWN1Gzg2tTix82f8t81J1WnvENU8LcG0yOPvuC29CzrukNP6DxABd OOiQ== 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 w11si15299855plq.436.2022.01.17.18.57.58; Mon, 17 Jan 2022 18:58:10 -0800 (PST) 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 S235563AbiAQSq7 (ORCPT + 99 others); Mon, 17 Jan 2022 13:46:59 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:59742 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbiAQSq6 (ORCPT ); Mon, 17 Jan 2022 13:46:58 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]:45246) by out03.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1n9X1s-005F9h-PW; Mon, 17 Jan 2022 11:46:57 -0700 Received: from ip68-110-24-146.om.om.cox.net ([68.110.24.146]:49256 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1n9X1r-003jNu-BN; Mon, 17 Jan 2022 11:46:56 -0700 From: "Eric W. Biederman" To: Olivier Langlois Cc: Linus Torvalds , Heiko Carstens , Linux Kernel Mailing List , "" , Linux API , Alexey Gladkov , Kyle Huey , Oleg Nesterov , Kees Cook , Al Viro , Jens Axboe , Pavel Begunkov References: <87a6ha4zsd.fsf@email.froward.int.ebiederm.org> <20211213225350.27481-1-ebiederm@xmission.com> <87sfu3b7wm.fsf@email.froward.int.ebiederm.org> <87ilurwjju.fsf@email.froward.int.ebiederm.org> <87o84juwhg.fsf@email.froward.int.ebiederm.org> <57dfc87c7dd5a2f9f9841bba1185336016595ef7.camel@trillion01.com> <87lezmrxlq.fsf@email.froward.int.ebiederm.org> <87mtk2qf5s.fsf@email.froward.int.ebiederm.org> <87h7a5kgan.fsf@email.froward.int.ebiederm.org> <991211d94c6dc0ad3501cd9f830cdee916b982b3.camel@trillion01.com> <87ee56e43r.fsf@email.froward.int.ebiederm.org> Date: Mon, 17 Jan 2022 12:46:48 -0600 In-Reply-To: <87ee56e43r.fsf@email.froward.int.ebiederm.org> (Eric W. Biederman's message of "Mon, 17 Jan 2022 10:09:28 -0600") Message-ID: <87v8yi8ajr.fsf_-_@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1n9X1r-003jNu-BN;;;mid=<87v8yi8ajr.fsf_-_@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.110.24.146;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/YV6/Vvn8jXg8frZWqyokYAqL1kRlGwVk= X-SA-Exim-Connect-IP: 68.110.24.146 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa08.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE 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 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Olivier Langlois X-Spam-Relay-Country: X-Spam-Timing: total 466 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 15 (3.2%), b_tie_ro: 13 (2.7%), parse: 1.27 (0.3%), extract_message_metadata: 13 (2.9%), get_uri_detail_list: 1.36 (0.3%), tests_pri_-1000: 6 (1.2%), tests_pri_-950: 1.41 (0.3%), tests_pri_-900: 1.22 (0.3%), tests_pri_-90: 81 (17.4%), check_bayes: 79 (16.9%), b_tokenize: 6 (1.4%), b_tok_get_all: 9 (1.9%), b_comp_prob: 2.8 (0.6%), b_tok_touch_all: 55 (11.9%), b_finish: 1.29 (0.3%), tests_pri_0: 333 (71.4%), check_dkim_signature: 0.51 (0.1%), check_dkim_adsp: 2.8 (0.6%), poll_dns_idle: 1.31 (0.3%), tests_pri_10: 2.5 (0.5%), tests_pri_500: 8 (1.7%), rewrite_mail: 0.00 (0.0%) Subject: io_uring truncating coredumps X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Subject updated to reflect the current discussion. > Linus Torvalds writes: > But I really think it's wrong. > > You're trying to work around a problem the wrong way around. If a task > is dead, and is dumping core, then signals just shouldn't matter in > the first place, and thus the whole "TASK_INTERRUPTIBLE vs > TASK_UNINTERRUPTIBLE" really shouldn't be an issue. The fact that it > is an issue means there's something wrong in signaling, not in the > pipe code. > > So I really think that's where the fix should be - on the signal delivery side. Thinking about it from the perspective of not delivering the wake-ups fixing io_uring and coredumps in a non-hacky way looks comparatively simple. The function task_work_add just needs to not wake anything up after a process has started dying. Something like the patch below. The only tricky part I can see is making certain there are not any races between task_work_add and do_coredump depending on task_work_add not causing signal_pending to return true. diff --git a/kernel/task_work.c b/kernel/task_work.c index fad745c59234..5f941e377268 100644 --- a/kernel/task_work.c +++ b/kernel/task_work.c @@ -44,6 +44,9 @@ int task_work_add(struct task_struct *task, struct callback_head *work, work->next = head; } while (cmpxchg(&task->task_works, head, work) != head); + if (notify && (task->signal->flags & SIGNAL_GROUP_EXIT)) + return 0; + switch (notify) { case TWA_NONE: break; Eric