Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3198982imj; Mon, 18 Feb 2019 22:25:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IbnSFdp5zq/Ff5YvtJ2jmC+ueimjjBfjDfUnjOFKv74AMZ0BeHgkE8T6C1OKhOibzJkrPtv X-Received: by 2002:a63:f412:: with SMTP id g18mr22582497pgi.262.1550557554375; Mon, 18 Feb 2019 22:25:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550557554; cv=none; d=google.com; s=arc-20160816; b=Oo8P046ATqvoe+8X9GiRBuuHjbZZy91oJeHv6+iYCScI5CxEFDgTVYKc/txxLwic9+ rLn/Gn4uryjmtCpPWICK7js94HkhjMDqaMHauFOd/hkmPlVj4yit1n0Va5wG9mSsf7jm 5muc5YWRLlhX90aMziPfkql6/GFewowxM56WxJPCW+bEon6CfuuitNou0jer6oMIpGjC D7hinDZ0LDo0xM5Uv/5C4ohfV6D15UpRzOP6X2LLNeCUrwkumQCJXam9OJdehkwmgtXI pdIPanTi+x54zzn/0D9yJh/vs+fc8E9NZi48gR6XK9y1HBuqCYH/E0i9JejEi9uJQjX9 7AeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=fZCkZ9mHUfaV55cNpLkQpP6Lh5HZlg6EnAWlBhFNY00=; b=THTEPFFTEbltHCgmHcCAd3bOrLkbnOkmX+mJlvGaaMok66cC6BrA6c6E0S58oeQlf4 GHC7L52gidkvBpM8wqOFZOeUNvJDExsWQpjbbYdPtozMRfZm4lcnD8R1io9CUtjhZcS4 lCRFonT+hMWJpPkCWhXfyfRCQdsCG051Nf2TAs9MzigpvhgbcfwRZ6lC3Vx0n4vWc6/I pkktdKVqZA7vk+fLbil8L43rPz4WAtBTfvYXFRJRle+OrqTDdQVmZVlIbJ3PEnK1sQrq fjFAYYsoV1IPVMLffeZLldyJfOWtcuHsU3F0uf1ODKX1UEbiaB8X/rlbhzJIXiGlc7nD jrhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jyYrz9TL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si1912900pgm.447.2019.02.18.22.25.38; Mon, 18 Feb 2019 22:25:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jyYrz9TL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726187AbfBSGXr (ORCPT + 99 others); Tue, 19 Feb 2019 01:23:47 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45569 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfBSGXq (ORCPT ); Tue, 19 Feb 2019 01:23:46 -0500 Received: by mail-wr1-f66.google.com with SMTP id w17so20760349wrn.12; Mon, 18 Feb 2019 22:23:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fZCkZ9mHUfaV55cNpLkQpP6Lh5HZlg6EnAWlBhFNY00=; b=jyYrz9TLf9G8IGwObExJBFAvVG/rybT9O/fz9jJeCeRVoTzsW4uOJaHhAhDukjcjRd 7qMLqCjJXT35/efRN/fLRjDJTEi2tgATCLwoYEyhJFFtumaCByRjvRdOZXBWjt5pVkvJ zVwe7VMUL0hBjVPuKRUngATm4TE74su8NglEmQClkvBOGMH8XGzD14VjzBySWnNnCgH4 RBSEzibFyhIZ8NutcI1N0kdhEhfQ1/mXp0er/dtuHPrY29j3V38287j/1JohEDr2B+vb YzRPKYzryfZY9uMVZuMF5XntbwkGWUslw++lwtydPpSmW2x9yCDdiW2l5TgbWNCPdRfZ ckrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=fZCkZ9mHUfaV55cNpLkQpP6Lh5HZlg6EnAWlBhFNY00=; b=Z1XXPNPovuDIvW51h/AmmwsCBhtLsQoZlPnpoLcqi+UCIPl/AADsZI6aPqBRs3mTQm +o3obob5IWmnJjW1E0/TutJEsJApRhQA4PKUkSDh1Ex2CQaQ2E/xIg0g4qQJy03Hw1R7 zSa9ApJfZZw97gl3Z59wyArQD9slwSCD//Jxypv5mPAFHEsSBA2RWq+e3G1xUNziBTOw CWL0RddqvcepK/zCxEXGQejXgNOOs2UdAgmBO2GraA+so56winE5rY5RKizgMVbq2fLT ha4EWb8FXYXbOXbcwLFGhufgKPusU/YMWh2ZE4vE2ZwlgjKUmzYu3sk6ZfgW/jtyE8gy OrYA== X-Gm-Message-State: AHQUAuYL5re/bUGnroIrHpncvrfyYXb/99J/rEq1+PRFPbVsMkj4XG7P n2M6/2RMOYxMAHIYx336MXY= X-Received: by 2002:adf:e5c5:: with SMTP id a5mr19239680wrn.13.1550557424013; Mon, 18 Feb 2019 22:23:44 -0800 (PST) Received: from ?IPv6:2a0b:e7c0:0:107::49? ([2a0b:e7c0:0:107::49]) by smtp.gmail.com with ESMTPSA id 12sm3159478wme.25.2019.02.18.22.23.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Feb 2019 22:23:42 -0800 (PST) Subject: Re: [PATCH 4.20 11/50] signal: Always notice exiting tasks To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Dmitry Vyukov , "Eric W. Biederman" References: <20190213183655.747168774@linuxfoundation.org> <20190213183656.733725215@linuxfoundation.org> From: Jiri Slaby Openpgp: preference=signencrypt Autocrypt: addr=jirislaby@gmail.com; prefer-encrypt=mutual; keydata= mQINBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrgAEtWUv76rM4ekqL9stHyvTGw0Fjsualwb0Gwdx ReTZzMgheAyoy/umIOKrSEpWouVoBt5FFSZUyjuDdlPPYyPav+hpI6ggmCTld3u2hyiHji2H cDpcLM2LMhlHBipu80s9anNeZhCANDhbC5E+NZmuwgzHBcan8WC7xsPXPaiZSIm7TKaVoOcL 9tE5aN3jQmIlrT7ZUX52Ff/hSdx/JKDP3YMNtt4B0cH6ejIjtqTd+Ge8sSttsnNM0CQUkXps w98jwz+Lxw/bKMr3NSnnFpUZaxwji3BC9vYyxKMAwNelBCHEgS/OAa3EJoTfuYOK6wT6nadm YqYjwYbZE5V/SwzMbpWu7Jwlvuwyfo5mh7w5iMfnZE+vHFwp/wARAQABtCB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2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmf faK/S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= Message-ID: <95a41702-ac6a-cd58-2ca5-71d879ee923c@gmail.com> Date: Tue, 19 Feb 2019 07:23:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190213183656.733725215@linuxfoundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13. 02. 19, 19:38, Greg Kroah-Hartman wrote: > 4.20-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Eric W. Biederman > > commit 35634ffa1751b6efd8cf75010b509dcb0263e29b upstream. > > Recently syzkaller was able to create unkillablle processes by > creating a timer that is delivered as a thread local signal on SIGHUP, > and receiving SIGHUP SA_NODEFERER. Ultimately causing a loop > failing to deliver SIGHUP but always trying. > > Upon examination it turns out part of the problem is actually most of > the solution. Since 2.5 signal delivery has found all fatal signals, > marked the signal group for death, and queued SIGKILL in every threads > thread queue relying on signal->group_exit_code to preserve the > information of which was the actual fatal signal. > > The conversion of all fatal signals to SIGKILL results in the > synchronous signal heuristic in next_signal kicking in and preferring > SIGHUP to SIGKILL. Which is especially problematic as all > fatal signals have already been transformed into SIGKILL. > > Instead of dequeueing signals and depending upon SIGKILL to > be the first signal dequeued, first test if the signal group > has already been marked for death. This guarantees that > nothing in the signal queue can prevent a process that needs > to exit from exiting. > > Cc: stable@vger.kernel.org > Tested-by: Dmitry Vyukov > Reported-by: Dmitry Vyukov > Ref: ebf5ebe31d2c ("[PATCH] signal-fixes-2.5.59-A4") > History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git > Signed-off-by: "Eric W. Biederman" > Signed-off-by: Greg Kroah-Hartman This patch breaks strace self-tests in 4.20.9. In particular, "threads-execve": https://github.com/strace/strace/blob/master/tests/threads-execve.c https://github.com/strace/strace/blob/master/tests/threads-execve.test The test received some fix a day ago, but it did not help in this case: https://github.com/strace/strace/commit/2a50278b9 Only a revert of the above patch helped. I don't know if the strace's test is broken (which is quite usual in cases like these) or the patch affects some user-visible behaviour -- e.g. could this be a reason for sh failures in the build farm? Any ideas? The failure is (the test output is non-unified diff: "<" lines are expected, ">" is actual output from strace): > FAIL: threads-execve > ==================== > > 11,12c11 > < 19311 execve("../threads-execve", ["../threads-execve", "8", "2"], 0x7ffc2447c258 /* 63 vars */ > < 19181 <... rt_sigsuspend resumed>) = ? > --- >> 19311 execve("../threads-execve", ["../threads-execve", "8", "2"], 0x7ffc2447c258 /* 63 vars */ > 17,18c16 > < 19395 execve("../threads-execve", ["../threads-execve", "8", "3"], 0x7ffdedb69ee8 /* 63 vars */ > < 19181 <... nanosleep resumed> ) = ? > --- >> 19395 execve("../threads-execve", ["../threads-execve", "8", "3"], 0x7ffdedb69ee8 /* 63 vars */ > ... > 11,12c11 > < 22715 execve("../threads-execve", ["../threads-execve", "8", "2"], 0x7fff2ea03388 /* 63 vars */ > < 22657 <... rt_sigsuspend resumed>) = ? > --- >> 22715 execve("../threads-execve", ["../threads-execve", "8", "2"], 0x7fff2ea03388 /* 63 vars */ > 17,18c16 > < 22764 execve("../threads-execve", ["../threads-execve", "8", "3"], 0x7ffc5ea29658 /* 63 vars */ > < 22657 <... nanosleep resumed> ) = ? > --- >> 22764 execve("../threads-execve", ["../threads-execve", "8", "3"], 0x7ffc5ea29658 /* 63 vars */ > threads-execve.test: failed test: ../../strace -a21 -f -esignal=none -e trace=execve,exit,nanosleep,rt_sigsuspend ../threads-execve output mismatch > --- > kernel/signal.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -2393,6 +2393,11 @@ relock: > goto relock; > } > > + /* Has this task already been marked for death? */ > + ksig->info.si_signo = signr = SIGKILL; > + if (signal_group_exit(signal)) > + goto fatal; > + > for (;;) { > struct k_sigaction *ka; > > @@ -2488,6 +2493,7 @@ relock: > continue; > } > > + fatal: > spin_unlock_irq(&sighand->siglock); > > /* > > -- js