Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752949AbdFLWOh (ORCPT ); Mon, 12 Jun 2017 18:14:37 -0400 Received: from mail-eopbgr30110.outbound.protection.outlook.com ([40.107.3.110]:38080 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752371AbdFLWOb (ORCPT ); Mon, 12 Jun 2017 18:14:31 -0400 Authentication-Results: linutronix.de; dkim=none (message not signed) header.d=none;linutronix.de; dmarc=none action=none header.from=virtuozzo.com; Date: Mon, 12 Jun 2017 15:14:14 -0700 From: Andrei Vagin To: Thomas Gleixner Cc: tip-bot for Thomas Gleixner , linux-tip-commits@vger.kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, gorcunov@openvz.org, john.stultz@linaro.org, mingo@kernel.org, peterz@infradead.org Subject: Re: [tip:timers/core] posix-timers: Zero out oldval itimerspec Message-ID: <20170612221413.GA414@outlook.office365.com> References: <20170609201156.GB21491@outlook.office365.com> <20170612210610.GA23730@outlook.office365.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) X-Originating-IP: [65.152.152.74] X-ClientProxiedBy: HE1PR0802CA0017.eurprd08.prod.outlook.com (2603:10a6:3:bd::27) To AM4PR08MB0737.eurprd08.prod.outlook.com (2a01:111:e400:59ed::11) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM4PR08MB0737: X-MS-Office365-Filtering-Correlation-Id: 17502f45-8b16-42fb-480f-08d4b1e0615b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:AM4PR08MB0737; X-Microsoft-Exchange-Diagnostics: 1;AM4PR08MB0737;3:pGFiMG0+1/n0UJYZ4bJAcEypZtPv2f2J/Fnw0Fpwr+pQT+i2+X7eicI3xpkPvPsreKSvy+frGmQzJCI4N4f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MxWYrpREQQroEAXuE7eLzK/ucbMp3tl20JhVkealRBfrT6MNKcEBOXrWpPHEa88iMkMJhPEcl3hFRlN6UH/+4yYYrSbsK1L3QdIxC1rHRgxfCspxNMkRYlZvfbkJVGu34ctv8YgqKv081kAvzI08xfsUAr4XNJGzGV3nbhIcTk4/RL1rwQwxQkwaR+wqf3YSWv45/QqzB6JEK+KYmAaVrlOfdhgwSD0m9VRy79ZZsAUfaAxv5pppnNflFu79VaaqV1hhB0lpA+48KIyRZ9dUzE0mlsKYrA5aNGo8+Z43A2KMX0rdpQhYWJZoafooLBJs6KCuWrgPOeojcnwNBMviRiAOoix60G4xOkeEpOIVwr/Xbt3tb9hwfaQgOHvFf9Tio= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:AM4PR08MB0737;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:AM4PR08MB0737; X-Microsoft-Exchange-Diagnostics: =?koi8-r?Q?1;AM4PR08MB0737;4:u1ODIHo1B2yxHp0GERiQqGJmAS4Tm4vBHFm2P00W+izK?= =?koi8-r?Q?V8aC0g/RjJB9/UveuBcX+oQPJ5xtp4qt90JsxnCXcHAGeuASozhMav2KfMQxju?= =?koi8-r?Q?qZOfs4YR7+qSNR/qpDkvwhI99zz4IMbBkUSSZ8ZZv/G4Fl1pE4+2E8jIpvcQAD?= =?koi8-r?Q?m6MyBvrseM5Xs6X0Y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Aatgt/Z6Py1hJL?= =?koi8-r?Q?ih5z0DpdzcWvFZERxD0fRl+rs9MjyPXsKLAieXbFEd81rxlUQg8FNC?= X-Forefront-PRVS: 03361FCC43 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(39410400002)(39400400002)(39830400002)(39450400003)(24454002)(478600001)(5660300001)(25786009)(4326008)(50986999)(54356999)(189998001)(33656002)(76176999)(53416004)(6246003)(93886004)(53936002)(38730400002)(9686003)(55016002)(110136004)(2950100002)(1076002)(6916009)(3846002)(6666003)(7736002)(229853002)(81166006)(8676002)(6506006)(575784001)(23686003)(47776003)(86362001)(66066001)(2906002)(305945005)(42186005)(18370500001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM4PR08MB0737;H:outlook.office365.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?koi8-r?Q?1;AM4PR08MB0737;23:PAbh9jRYynjRBtWjKbkPRItWhHt2lS+OtWhv40qhxM/?= =?koi8-r?Q?3EO2VYHpgd0Kmxu77D7efGOCXyorIwx+CA3lPQsjVrCN0p/U8KA3k9A7GYxOl0?= =?koi8-r?Q?iG854ImF6jj9fafgqVSYByhKvnTFMp8a8qMdqVGm6UAAw4Yi3MEkKc3bKnwdQ+?= =?koi8-r?Q?MnVzP0QD3BvBGcX2D/0+9N8UEN4U6rBHJe0DIu7WIWiGPv8QwB+G4n/cqj7NKG?= =?koi8-r?Q?MPoqDvy5MPT7KusBB7t9n/S9JKoq767PbHe1bS4EnIlKDMPYkJC4/TKrpQz5kw?= =?koi8-r?Q?RwiY0Aqwz6H+uH+wjevk5RO6hmd3NrnFxXKMfvaVOJJYpiMBnEAWFsTHQi9ShJ?= =?koi8-r?Q?Ig3vkFNH760EJ/dhc8JotRhqm2Hym8OIKD8v5mLLxdGeRlFren9hCG2cBpiYSb?= =?koi8-r?Q?2H7SRT5uLaaUEmp4i5Zf3rwOJ9pmZ95jxnpt1GV+hCDbo0nBX23OY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G3gEbPJNddjKuAyRlU8+Mj1vNGlxr+g/JXyOsPU8Slhs4mx6rmq0ReOUKVaD2tjaBysZSqdz+zB1Qywuv/mqTr387Yvy+M3tphrsLhG+SpCsupd5hw2/JggY5p2JW+TV0WfoGI3TXk3yEkFVel3AOuvH4hY2i22kCFz+rySmOT011xrjhZ6EEYToxii9EAlj+5TqmtYSNR3LJxSS2Jhzi0ykZq+mzS6u0FfQXaaWYtw== X-Microsoft-Exchange-Diagnostics: 1;AM4PR08MB0737;5:FZzLXcz1BT8DBQxc3djOD0x0V2/b5zxjxyHjHEJvtOlzYO0WcptrqEEZPJToCVPpT8nA82btwqDAjLZgPJ2qbcWy27ibYbdBWV2/Qr50VrpIh0YE1ZDt1EPi56VbRdsuhIlOpcWCB8jqntdEqMD+UgKYwrwAFwgcymwF24YxJzZYjE9avej2XfYI6RyDA9vjBF2SWzmU8tU4CDJqi/BfpPxPSpqep6vDkeCT1YY1wjofn9iHfXfBU2jf2jxC+VUo37YFN/ZnCEIF4flcQeG58M5EvXFJ3ysZGUD2JJWS3b9glcUdoI15ADhjyZT4TPlrrrYwzOJq3sX4ZyYAPojzzP16NgK6qfCJTWRci1akeNqBzTwrk/1/UYNkwDJgzfxJhf1o9H4UDSvyYBJh2zHQQXCQkvQe55YfN1tXbUswJy6lSqixSLPBFfBfpk1K9KRgtx0wRz3enI4mpuy7JBXDABt2jAXWnHXSdQ9zWCGcIs680Hu7QTRTXYw7Qy7EROYt;24:nPfNIbiZfN/IPnjaFtf+nPyINNYI7qynNuvxfLtQhjMhFAWyb4A4RID8+1DCmRy+tATdcCGmN+D9ZAsXpb1RN4TQaHPyhDYc7d3YqC+cOZY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM4PR08MB0737;7:lGRG3YvY1mkhwNeICx33061GmhiHyJp+hYIMKED+f3lJYMXxogdZZ983/yFMrdbCac93LQDSsIsK/3mRA70hTIpXnAW/ERoroca72jRDXVGqOMrrlAS2aQJI2NveIeHmwkt/yFv+lYbhwf7xQmVIILqLrFuip9s0roMQTHh5qbu4KXwzM0NtAy0mVPa31RZieEycXokN8jOkdl38+jDV5t4fjj4nH+oO6rBmmFN6bIEVEJh4QCxDnVewweJVFlivckhxB7AlCkY4gHbb1DO/p28U3n7/clOuXBlUTu1iEJQlMUUsPBHTn9cWpSJZg1Z+BkLdmp8WdBsR07qZbnma+w==;20:JdZMMp7SXwk3+cV0YZbZVN2F0D/XKe4i1G2VplHPnl23CcSfh720cvYjqGq5bTaR70dhM6O1zQ1rNENwRon06X8VZA3t170/RX83000DTVsamlkpBxevDgfjvXmcDg+aRRHqaJX0vIbxE86vilgqgF96O3jHEjUzKD6owzqwkok= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2017 22:14:20.4842 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB0737 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1738 Lines: 52 On Tue, Jun 13, 2017 at 12:01:17AM +0200, Thomas Gleixner wrote: > On Mon, 12 Jun 2017, Andrei Vagin wrote: > > > diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c > > > index b53a0b5..88517dc 100644 > > > --- a/kernel/time/posix-timers.c > > > +++ b/kernel/time/posix-timers.c > > > @@ -828,6 +828,8 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, > > > if (!timespec64_valid(&new_spec64.it_interval) || > > > !timespec64_valid(&new_spec64.it_value)) > > > return -EINVAL; > > > + if (rtn) > > > + memset(rtn, 0, sizeof(*rtn)); > > > > Maybe we need to call memset after "retry:"? > > That would be counter productive. > > > common_timer_get() is called at the begining of common_timer_set(), then > > common_timer_set() can return TIMER_RETRY. common_timer_get() will be > > called again and some fields of rtn which have been touched first time > > will not be touched. > > > > At the end, rtn will contain data from two executions of > > common_timer_get(). > > No. See the full code sequence: > > retry: > timr = lock_timer(timer_id, &flag); > if (!timr) > return -EINVAL; > > kc = clockid_to_kclock(timr->it_clock); > if (WARN_ON_ONCE(!kc || !kc->timer_set)) > error = -EINVAL; > else > error = kc->timer_set(timr, flags, &new_spec64, rtn); > > unlock_timer(timr, flag); > if (error == TIMER_RETRY) { > rtn = NULL; // We already got the old time... > goto retry; > } > > If you clear it after retry, you'll get all zeros in the retry case. Not > what you really want. Yes, you are right. Sorry for the noise. > > Thanks, > > tglx