From patchwork Tue Nov 8 09:36:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Ryabinin X-Patchwork-Id: 9417699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E5F666022E for ; Tue, 8 Nov 2016 16:13:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5E08286B6 for ; Tue, 8 Nov 2016 16:13:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA8E7287BB; Tue, 8 Nov 2016 16:13:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0C57287EC for ; Tue, 8 Nov 2016 16:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932274AbcKHQM5 (ORCPT ); Tue, 8 Nov 2016 11:12:57 -0500 Received: from mail-db5eur01on0106.outbound.protection.outlook.com ([104.47.2.106]:51354 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932223AbcKHQMv (ORCPT ); Tue, 8 Nov 2016 11:12:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=bdqwZ8c706xhWZPt2b27KRmX5Dmr32GjcQW9m55JD/E=; b=NKUYWIo41g96t2/pCVEhoLVgBgWouSmT1XsKtzgg5PSa9/ifb09ipnqwpR1QDptjeYa+9lvvM1c3ou7CCsEbnxo4QT4Pr6aSMc5p4awvira1e3eygNuU/1QKcNgNj1wP4j/XoTib/BA/+xEFBnl3VJDLzDno2VRdiohuqrm1dpE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from [10.30.19.223] (195.214.232.10) by HE1PR0801MB2058.eurprd08.prod.outlook.com (10.168.95.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Tue, 8 Nov 2016 09:36:19 +0000 Subject: Re: [PATCH] coredump: fix unfreezable coredumping task To: Andrew Morton References: <1475225434-3753-1-git-send-email-aryabinin@virtuozzo.com> <20161107142608.e4fa032b2e32b623663ff2e9@linux-foundation.org> CC: Alexander Viro , Tejun Heo , "Rafael J. Wysocki" , Pavel Machek , "Oleg Nesterov" , , , , From: Andrey Ryabinin Message-ID: Date: Tue, 8 Nov 2016 12:36:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161107142608.e4fa032b2e32b623663ff2e9@linux-foundation.org> X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: DB5PR06CA0030.eurprd06.prod.outlook.com (10.162.165.40) To HE1PR0801MB2058.eurprd08.prod.outlook.com (10.168.95.23) X-MS-Office365-Filtering-Correlation-Id: cd5f3eb2-33e7-426c-49d6-08d407bab2ce X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2058; 2:in2C8DMVWBvFneGhtGLpQ9o6FGa15mmDFcKovN0bd6w3DrIfLCvPASOJjg8Vb2RZBR8tbNTQbzpseiHKKoXKtqXwaRbjud+t8ccG6p9Q71xqtSSnMZDuSD3+XIq9qs566Ue787CY3Tiw5XCkWCHd61AgbQiH0pcKKTwEbLCs9j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J3/Q/80Wg7eEg2lVpDPBH5MpiB2E0WjRhUqMeTBkYCiMCUi5bgDFZbRbEiwTA4Olm+d411WozDnw8Fsn9p0g/ncIpQ= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2058; 31:qgWoX5L/FputEqAruHm2sbuJql6x8Se56LaeRgdMiomR2CnsXDV6iNYXPUIdmh5OhCAw3dBT4EXIe9WmiUHWPQyak1mU0RXZLcfGGxuDvEgpvt8jI+SDqD+rKY/Sv6Bypq6AgemkPhxtSlMO9hlTZv9SGv1Dt3rpfGbvQkxWmsQNoA5pEr3Q0/BF++lnEeb+WwZlOuYWO2Uo6FKDXng+99F4G1jzNzGwTgEZ9WR0Y4npIapd+NmSzWMrv49BeNk8JJaNxiiF2g3SoEq294qq2w==; 20:BKGIUz4oV1XOLWKECZJs6RXb47g5Xtkfp5g0nsztJaszS3pe3+H92pUpDc0p0Yxo3+NUrn37um2ITXyP2zTWs8FpKcpaTXf940DvHi66t/gnzIJ0u+6wtUVlcYw2RsY53LFCI22Cz/W9VdEDP7V3mRPvfAU0kc05CtugMjLvx8b7fYTgf81eFLJRzbj7oey2jyv7fZHCUG2BwrGtBdlfQ8/ckXDy2yj4nYimPchTWv0l3pEZGr1GSPwiyXPKPZlU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(42068640409301); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6042046)(6043046); SRVR:HE1PR0801MB2058; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB2058; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2058; 4:8R5MSrcfUBSPxFXV66+Zy25YqW+v7mAHw8E9zLHl5yzds6WafTya4h4Fg6zOy1NaS6/Qcgxa9SsmH/00YCIc2S57rb0t4N/wdKgPimf8zqxmq9r/4/UkgjLCPdDAKVh1BxOz5bvZUQgnKvOfryE8ncR1zY36MK9v9Qw9O7Qf5lysOO4txUEg3NUHGsXiScE5R0xi9HZUaevsJBH8JISlDt2RQGaCq3kMeSy7XrrKQ4NaF70U837QAPuL+qGHLNAKZstmTpi6GNOPbYvnXc4HQu+7vVJ40EnkIUCcuZUZhHIONQRsZHwcojnCxGjA69PUngV3C3BTzdvx2p1pnKuiYppzIdZ7WI/PBIv5V0IKpvxWkb0aUlZzmM+UinryqLBN4YQL5YIgtC6GbWPJZgSg7YMka5cOxA8It73qjYNbGkaHDQNTFGSOes4WidT+vD8p08CfsDf7IGK+kIHvRpNUNpqk2rJYrRLlMi1B4YVp6Ztf7c86MLwE/n8Dtbs0SxRzJQonJIO05Yf946cyApOhuw== X-Forefront-PRVS: 01208B1E18 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(199003)(24454002)(54534003)(189002)(377454003)(31696002)(2950100002)(6666003)(68736007)(6116002)(36756003)(86362001)(106356001)(105586002)(42186005)(586003)(3846002)(31686004)(23746002)(33646002)(77096005)(50466002)(4001350100001)(92566002)(97736004)(66066001)(65956001)(47776003)(65806001)(64126003)(189998001)(8676002)(305945005)(7736002)(2906002)(110136003)(7416002)(7846002)(230700001)(83506001)(4326007)(76176999)(65826007)(54356999)(101416001)(5660300001)(6916009)(50986999)(81156014)(81166006); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB2058; H:[10.30.19.223]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; HE1PR0801MB2058; 23:CFC1c93Yd0ECdcN51OZaf/SpBxGYH2bDUNJ?= =?Windows-1252?Q?ru3G0qmhBxXAvcrQbq+rLt+OD7Ye2ONSYiRZ2KaTcVQKcVY1fHRcJkCC?= =?Windows-1252?Q?8tb1SF36O63qX/GbNpNr4Io57+p0NmOuAHRg2d/GDfk5DE5DItJ1YSr2?= =?Windows-1252?Q?WClAPJ6Je3WoGyYjBCqsY8gTEman09TxsdZeRo8pOZlbDq9b1zyh7Ss5?= =?Windows-1252?Q?KjzAEQbOxGw8z9X1eTG3h4sDSn0CrxT6tS8wQ9H/mewGasRFXDP6By99?= =?Windows-1252?Q?0YQUN30qKwqPKSFlgrfOrymZNyMpopnM5hOH+ILmDsLF9GkOKsV10B+J?= =?Windows-1252?Q?oAKU3LeL6c/SmMuQKGAXQy//2wPiyc4iJY7VhBPzvkn8/A8sLDyfAPU/?= =?Windows-1252?Q?BH+H6vZBcXHA48/BuxdPk0XM8XD2RUP8UolYVllVktBs2HVZlPj2hCpZ?= =?Windows-1252?Q?SMnDEbPnnbFxGGDZ7zcbsU5R8GG8rmEfbPlJsRnPXxhfKd/93yRX7+4I?= =?Windows-1252?Q?tyuUtE7gjxvaiQYlYBDScWfUlWe4aMZB/LYXtfgEQi6DmwHirKSLe1ej?= =?Windows-1252?Q?bzlGzGyLcwl1j+ONdN/HHHzu04T+Z3PKVRtWBDUY5tDh/npGr7zC1JdJ?= =?Windows-1252?Q?om70S7RqFAYM0cX3A6Dg03z0K/4RDkGbywh0PuqQuVO3DLkoh5FOnUC2?= =?Windows-1252?Q?07a5p1ZSS0wiQQ91uRGqu5URxnMEC+/j4ov39BQG/NCGxZTUzDpMGZTJ?= =?Windows-1252?Q?zVOIlLLo8dxfxqvOle8FbiQbLSyUBs2oGczHInTXcB7biASR2vbDPgXi?= =?Windows-1252?Q?ZoR2/TCaYg+t1U4wzBgHW10bV20oHuxDs2LZU/VtAoszJPpjtAlr8njq?= =?Windows-1252?Q?ASJqAhOlEpDz0lDB+zDs+IoUc0bKxnXOUU7dykcRB/De27ZbbmKZfj95?= =?Windows-1252?Q?xdCN+40AQyVzrdnzMKD/n3kw+E9/BCD2z7I/MGtVM1YFDZBb3xW1d9mK?= =?Windows-1252?Q?boB8BAPwOEbmln1V/V4tmbn3HRUxTZkTvIgxdPB53n8fC77X6hB4fdrt?= =?Windows-1252?Q?lElNmPxa/ybnK1mZXjqSTjFI6bJFzR3H7jlkESf07/5Wgpfl4lVLdWhO?= =?Windows-1252?Q?vgimWQMqiYB4FE1Tb9iabKc21deydiienijSW6T6W0JNJsatVpVIxcfd?= =?Windows-1252?Q?Qy6zCjmZiSGafpO+CvBVicpmWeKR+1HLAgIj/ITMysW5M9p+fO4Flux9?= =?Windows-1252?Q?tew5bciTnOyldEbVwYQ9v3fo/HBd//sRjrpYQZem3nUxtyvDaW/h0+Rk?= =?Windows-1252?Q?SnCCxBQd51ll0fAYB0rJdf7qRAKUMGHaemwH6F5+YD8b0QFPojbEDXog?= =?Windows-1252?Q?GcHJm6z99SQvyV5C/K8bO62i6RbX76BtlsS4iMBbt8FsIO+vzA8yl6+M?= =?Windows-1252?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2058; 6:6f30ChOh8ZzIH8YJIFKwOX0xxuU4NyKWL2/DJxzCnXvSDsNJusIaaae9YWVRrqOJjNPqM3ujWmN4IKox4oeP2cJkZld7r3hsu010+w66BVtFL1aVaTcaf4brQ/LzEcuARoZ6FThRnW5NXdeYyiuIc1bnziPRWdmlq2nnIY5wXUmORwgcZNKE0DFkoNEYkOrNnKNlHLr2yOyeQSieu9C1Jx3U8voiJ5iH3qDFxBeTJZYa2ZKtILkOdYG/BBYnpuEdjzJliN+lDapHlcVCYaUaEQNKCBRofXS3yuonBKb8GPOLiPdXiI2yJTkf1750/tHnT70gQ6W3iyey5Oa+MHtkJQ==; 5:KLfTtcRDYpSewQEgFY3pb+4Ne/B8Dd8JmM34J3veCPa3Z7N1pZN1C/yVWc1Q8JKMIyyfrXQNPPxx/aE9vCGZwsEGXPhF5RPGACnr8fkGGOGdzS7NWyLFPM3vA+f9WulPdR52OciM+mUI312hmxAGTog1CVEBBzBcBVB/zq2g/Js=; 24:GjnrUWzqG+ZRktju53Igju0rQt8ZCMDELuF10GCxexYrFRwCVo1GfV7J58rfSkt+AGqmKch/6oMf/vq9hlc0aWgbiu4g+nEviyAZ/volSWg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2058; 7:pxY0xaaBPvs+kHOd7yryRmNnF382SPHryL1TgUcY9eS9FmGsz5kaykU3xe2pX/Ju5lMNWrwW1bcX0Xe3nPtmOjvGpfl6ekEAzpcw8lRYpQsky0IxHQSiEM40Zs8G7GcLEomLyLf2K7qW63Y5JYuAlDJ4PB4SlbjBFHYgKip7nMN3eHWi7C8WRVSXHhuL4ys/q6DEnf9h0VfCcL+8NqC60HvGHUFrcLGgVQz/rNZjXqO0uJqrN0CJXxcMm1NXMsjfFGNEu4RJq/dGBrm8FXDfp85x1FPT5864Vc5W6WuTnV1iI8I4+1Y1LWAc/arE8DuD9JRO3NLuiYqlVj02koqYeyme4EfUTJZTp6qjdgOBkP4=; 20:GSA0VcFvZRMo+l8CH1fiCN2b5dNNu3huRNlbYOoW6vVydDNf3YfziJhqG8LTz1wYNHv48ZRc/bvvgkfcRxYYK6OmjeA9XvyzXub1SdvcBU7Brqd4ZeHEFOZcP4pRapVAXVZ/WVvt+bDwgK71eAOggm8HTYSmJ2WxTICup5Nluvs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2016 09:36:19.7306 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2058 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 11/08/2016 01:26 AM, Andrew Morton wrote: > On Fri, 30 Sep 2016 11:50:34 +0300 Andrey Ryabinin wrote: > >> It could be not possible to freeze coredumping task when it waits >> for 'core_state->startup' completion, because threads are frozen >> in get_signal() before they got a chance to complete 'core_state->startup'. >> >> Use freezer_do_not_count() to tell freezer to ignore coredumping >> task while it waits for core_state->startup completion. >> >> Signed-off-by: Andrey Ryabinin >> Cc: stable@vger.kernel.org > > The changelog provides no reason why this patch should be merged into > -stable. Nor into anything else, really. > > Please (as always) provide a full description of the bug's end-user > visible effects. > Sorry. Added the following paragraph: Inability to freeze a task during suspend will cause suspend to fail. Also CRIU uses cgroup freezer during dump operation. So with unfreezable task CRIU dump will fail because it wait for transition from 'FREEZING' to 'FROZEN' state which will never happen. ---- From: Andrey Ryabinin Subject: coredump: fix unfreezable coredumping task It could be not possible to freeze coredumping task when it waits for 'core_state->startup' completion, because threads are frozen in get_signal() before they got a chance to complete 'core_state->startup'. Inability to freeze a task during suspend will cause suspend to fail. Also CRIU uses cgroup freezer during dump operation. So with unfreezable task CRIU dump will fail because it wait for transition from 'FREEZING' to 'FROZEN' state which will never happen. Use freezer_do_not_count() to tell freezer to ignore coredumping task while it waits for core_state->startup completion. Link: http://lkml.kernel.org/r/1475225434-3753-1-git-send-email-aryabinin@virtuozzo.com Signed-off-by: Andrey Ryabinin Acked-by: Pavel Machek Acked-by: Oleg Nesterov Cc: Alexander Viro Cc: Tejun Heo Cc: "Rafael J. Wysocki" Cc: Michal Hocko Cc: Signed-off-by: Andrew Morton --- fs/coredump.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/coredump.c b/fs/coredump.c index 281b768..eb9c92c 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -423,7 +424,9 @@ static int coredump_wait(int exit_code, struct core_state *core_state) if (core_waiters > 0) { struct core_thread *ptr; + freezer_do_not_count(); wait_for_completion(&core_state->startup); + freezer_count(); /* * Wait for all the threads to become inactive, so that * all the thread context (extended register state, like