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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 0B00BC48BD1 for ; Wed, 9 Jun 2021 20:34:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E66DA61354 for ; Wed, 9 Jun 2021 20:34:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbhFIUgK (ORCPT ); Wed, 9 Jun 2021 16:36:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbhFIUgF (ORCPT ); Wed, 9 Jun 2021 16:36:05 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B9FC061574 for ; Wed, 9 Jun 2021 13:33:56 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id r14so1518512ljd.10 for ; Wed, 09 Jun 2021 13:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HKOE8BadJeo+YL8tRU0iYJhaHWhLziwYQepJorZ98hY=; b=UBP8J6oYchq2ROBkKb/OBl2yhXz9+41fIVP2jys4OwQsSgcG7GA3wC9CyITc1BANel 6pUPf1o7H/jAprU3hJI9Orap/rRnTmgpIpJfaXDu+lmLVs+eno55vuWfJKvk061XOrqM lIKlhsHcRIejWytT4LUfn+BysOlyh7R4deQ6Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HKOE8BadJeo+YL8tRU0iYJhaHWhLziwYQepJorZ98hY=; b=GR4ucuq0nvf/uOBsCOCIWGuCQy68DXnoKY2uP/JjNsWVRP56qUFxNLLXhirmWM5Pxz xkn7zRxT1JolYpyJYtUjYdKmL19I8lpe3uK/vV0Xgnp44vs1ZU5dlUSwr5HDhZ9/pBAf /ue4ZzlCdkLHiyjDx89Rha+OYfZSuaxSKF57jUXU+Sjigx8K+x14+iNF+/IWTtjP3hHW bJsb/B8lZJ+i2Aj/7VZeHWW0iTzh9elDznm75l9/2VhiO2RQKun3JvYRRHqrVxEmaXsh WfXERs036rNdy8xsmMM4/tbmTFd2VmRhjkRWcBODUM9S4Zc/s5J7csfVywwbXAFKUSj0 B+JA== X-Gm-Message-State: AOAM532VoqLtPpTjc0z9wBa4gq22qdCvv6m+oUU7/F0RHfLDwj9Kllcp RVpGW0aI7+Jswo1MWypRIy+gGKAlJgnYjmgokgI= X-Google-Smtp-Source: ABdhPJzS6osxQJn+zFl9cwVbI+OqVVG50n6en+WyldiptSTjm9c0dLgoAhzE4nPY3Te3H70xm34Yig== X-Received: by 2002:a2e:9544:: with SMTP id t4mr1221957ljh.474.1623270835118; Wed, 09 Jun 2021 13:33:55 -0700 (PDT) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id i124sm86389lfd.62.2021.06.09.13.33.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Jun 2021 13:33:53 -0700 (PDT) Received: by mail-lj1-f175.google.com with SMTP id n17so1570708ljg.2 for ; Wed, 09 Jun 2021 13:33:52 -0700 (PDT) X-Received: by 2002:a2e:9644:: with SMTP id z4mr1178053ljh.507.1623270832349; Wed, 09 Jun 2021 13:33:52 -0700 (PDT) MIME-Version: 1.0 References: <192c9697e379bf084636a8213108be6c3b948d0b.camel@trillion01.com> <9692dbb420eef43a9775f425cb8f6f33c9ba2db9.camel@trillion01.com> <87h7i694ij.fsf_-_@disp2133> In-Reply-To: <87h7i694ij.fsf_-_@disp2133> From: Linus Torvalds Date: Wed, 9 Jun 2021 13:33:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] coredump: Do not interrupt dump for TIF_NOTIFY_SIGNAL To: "Eric W. Biederman" Cc: Linux Kernel Mailing List , linux-fsdevel , io-uring , Alexander Viro , Olivier Langlois , Jens Axboe , "Pavel Begunkov>" , Oleg Nesterov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 9, 2021 at 1:17 PM Eric W. Biederman wrote: >> > In short the coredump code deliberately supports being interrupted by > SIGKILL, and depends upon prepare_signal to filter out all other > signals. Hmm. I have to say, that looks like the core reason for the bug: if you want to be interrupted by a fatal signal, you shouldn't use signal_pending(), you should use fatal_signal_pending(). Now, the fact that we haven't cleared TIF_NOTIFY_SIGNAL for the first signal is clearly the immediate cause of this, but at the same time I really get the feeling that that coredump aborting code should always had used fatal_signal_pending(). We do want to be able to abort core-dumps (stuck network filesystems is the traditional reason), but the fact that it used signal_pending() looks buggy. In fact, the very comment in that dump_interrupted() function seems to acknowledge that signal_pending() is all kinds of silly. So regardless of the fact that io_uring does seem to have messed up this part of signals, I think the fix is not to change signal_pending() to task_sigpending(), but to just do what the comment suggests we should do. But also: > With the io_uring code comes an extra test in signal_pending > for TIF_NOTIFY_SIGNAL (which is something about asking a task to run > task_work_run). Jens, is this still relevant? Maybe we can revert that whole series now, and make the confusing difference between signal_pending() and task_sigpending() go away again? Linus