From patchwork Fri Mar 20 20:25:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 11450269 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6190B14B4 for ; Fri, 20 Mar 2020 20:25:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 260A22072C for ; Fri, 20 Mar 2020 20:25:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 260A22072C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 62EDB6B000C; Fri, 20 Mar 2020 16:25:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5DF836B000D; Fri, 20 Mar 2020 16:25:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CEEF6B000E; Fri, 20 Mar 2020 16:25:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 3629F6B000C for ; Fri, 20 Mar 2020 16:25:16 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E460D813F for ; Fri, 20 Mar 2020 20:25:15 +0000 (UTC) X-FDA: 76616870190.20.flock74_852d4835f0626 X-Spam-Summary: 2,0,0,2b13468934825e7c,d41d8cd98f00b204,bernd.edlinger@hotmail.de,,RULES_HIT:41:355:379:800:854:960:973:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1381:1437:1515:1516:1518:1535:1541:1593:1594:1683:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3867:3871:3872:4118:4321:5007:6737:6738:7652:9592:10004:10400:11026:11232:11473:11658:11914:12043:12048:12160:12296:12297:12438:12519:12555:12760:12895:13069:13161:13229:13311:13357:14096:14097:14181:14394:14721:21080:21444:21451:21627:21990:30054:30055,0,RBL:40.92.74.38:@hotmail.de:.lbl8.mailshell.net-66.100.201.100 62.18.114.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: flock74_852d4835f0626 X-Filterd-Recvd-Size: 7736 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074038.outbound.protection.outlook.com [40.92.74.38]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Mar 2020 20:25:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ALoo6FkOdh7UAiZeQOql/CiAcHqxadx+ogui3u34tdhZhFhuqzXIwngVBUl5fBBj9vuXbjiPqPH+rR8DbyqKo1CMy96CxBaLnBmfc901lsnF87ax6FdLQc6TqmmXiJ+OJhaW6tr5yxz+/aL4ELEqn9HzbA6EEhpmsGErimub/QW8qT1hpFCm5qMIOkkf+KzS4xdGpAge/PGFwI/vAF2q6g7p6nPA67bB04oZUU3h27tBGCttNsR2tMstoQ+Pdr1joW3D8ucSyl6JYF7nCXJQZ0F8WZDr4iC3m6gDy35xxEcHr+7manfzD3VxrDvJxSylWHtrTFz1XOYbgP0W/3ZQkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1iqKQ8iJMPPHs0stqpjWH2idJ1gtMI30mGoa9ajLgyc=; b=JM63A5i2kQuoQ8sy0Bxr8Ju48eZG2Iq+KWw3PkYwSpuYQvs7YbKSP0HyJg68BKlL6j6kWf+M8r6wzfKbJL+VVseoPedVsQFWf1f02y4ydk94QYRUJk6kdbAMOrvCweWGltQnyNiZZueX+6SMYjiLiKQhbNifDTMXaSFXeRF+Ddzhp/EOShU0oHwaBaiO8wBtV/D4EW1kXd1HREGiqDSxSh4Xp2G/JJFKneNpjYHHlBSbAcraDSd57yCq7+DrEqVy3ex4z2RgTBt+wY54GAYiTZFCKfP9MiE7D90Kr4NfAb8qgc+h8wPH8c5TA+4yeQKxiWIZxVFV+BMzwrvRTDsVBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hotmail.de; dmarc=pass action=none header.from=hotmail.de; dkim=pass header.d=hotmail.de; arc=none Received: from DB3EUR04FT027.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::39) by DB3EUR04HT151.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0c::164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13; Fri, 20 Mar 2020 20:25:13 +0000 Received: from AM6PR03MB5170.eurprd03.prod.outlook.com (10.152.24.52) by DB3EUR04FT027.mail.protection.outlook.com (10.152.24.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2814.13 via Frontend Transport; Fri, 20 Mar 2020 20:25:13 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:AF11A19A115B8F9989A9D1B21E9851F8A5626EB739F5731DB7A50418DA0D97C2;UpperCasedChecksum:914F8E391114572AC00C8FE23E869BC087B69CD944B12A3027CE4C4C24323DFB;SizeAsReceived:9414;Count:49 Received: from AM6PR03MB5170.eurprd03.prod.outlook.com ([fe80::1956:d274:cab3:b4dd]) by AM6PR03MB5170.eurprd03.prod.outlook.com ([fe80::1956:d274:cab3:b4dd%6]) with mapi id 15.20.2835.017; Fri, 20 Mar 2020 20:25:12 +0000 From: Bernd Edlinger Subject: [PATCH v6 03/16] exec: Move cleanup of posix timers on exec out of de_thread To: Greg Kroah-Hartman , Kirill Tkhai , "Eric W. Biederman" , Christian Brauner , Kees Cook , Jann Horn , Jonathan Corbet , Alexander Viro , Andrew Morton , Alexey Dobriyan , Thomas Gleixner , Oleg Nesterov , Frederic Weisbecker , Andrei Vagin , Ingo Molnar , "Peter Zijlstra (Intel)" , Yuyang Du , David Hildenbrand , Sebastian Andrzej Siewior , Anshuman Khandual , David Howells , James Morris , Shakeel Butt , Jason Gunthorpe , Christian Kellner , Andrea Arcangeli , Aleksa Sarai , "Dmitry V. Levin" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , "stable@vger.kernel.org" , "linux-api@vger.kernel.org" References: <077b63b7-6f5e-aa8e-bf96-a586b481cc46@hotmail.de> Message-ID: Date: Fri, 20 Mar 2020 21:25:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 In-Reply-To: <077b63b7-6f5e-aa8e-bf96-a586b481cc46@hotmail.de> Content-Language: en-US X-ClientProxiedBy: FR2P281CA0023.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::10) To AM6PR03MB5170.eurprd03.prod.outlook.com (2603:10a6:20b:ca::23) X-Microsoft-Original-Message-ID: <047d07bc-5050-06f6-9494-24f3e7e92616@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (92.77.140.102) by FR2P281CA0023.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Fri, 20 Mar 2020 20:25:11 +0000 X-Microsoft-Original-Message-ID: <047d07bc-5050-06f6-9494-24f3e7e92616@hotmail.de> X-TMN: [nUTIdkd0Q4fkiU0I4gtqb6H5u3ZVz9aW] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: bcad9447-4918-4b56-e426-08d7cd0ccb14 X-MS-TrafficTypeDiagnostic: DB3EUR04HT151: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oADBsXnaKHWWY/5rERPrPbjN76PcpYL7dytFGyzMfqCj40gcpIiBKWpveHMzSFa8xrYjUn6gIf1FmKBmGO30/eANDjNmGo3nmkxIXumxLVFKx4ElqGdrrfti9ClllB6ctpqG5wZhbtOOVJ81d6jbqVhcUkUw8qaVsnBe2TwJuCcgmZaCfstdcV8SaBDQpZc1 X-MS-Exchange-AntiSpam-MessageData: qcV0C42F7VtRIP4+AJo8qTukBTkWVRCT39AIrog8S8tyAxr6q1gW6Rvwo9RkkRjsKRHvxyARgDQH383su+bOqIWmDYkR5BQ+OF9pu+adm0YoRhZt0elckA29zIhFeRbe5dcwD1+ZFKcSlIp4iFUi1Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bcad9447-4918-4b56-e426-08d7cd0ccb14 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2020 20:25:12.9518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3EUR04HT151 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: These functions have very little to do with de_thread move them out of de_thread an into flush_old_exec proper so it can be more clearly seen what flush_old_exec is doing. Signed-off-by: "Eric W. Biederman" Reviewed-by: Bernd Edlinger Reviewed-by: Kees Cook Acked-by: Christian Brauner Reviewed-by: Kirill Tkhai --- fs/exec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/exec.c b/fs/exec.c index ff74b9a..215d86f7 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1189,11 +1189,6 @@ static int de_thread(struct task_struct *tsk) /* we have changed execution domain */ tsk->exit_signal = SIGCHLD; -#ifdef CONFIG_POSIX_TIMERS - exit_itimers(sig); - flush_itimer_signals(); -#endif - BUG_ON(!thread_group_leader(tsk)); return 0; @@ -1277,6 +1272,11 @@ int flush_old_exec(struct linux_binprm * bprm) if (retval) goto out; +#ifdef CONFIG_POSIX_TIMERS + exit_itimers(me->signal); + flush_itimer_signals(); +#endif + /* * Make the signal table private. */