Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751692AbdF1Pgs (ORCPT ); Wed, 28 Jun 2017 11:36:48 -0400 Received: from mail-he1eur01on0098.outbound.protection.outlook.com ([104.47.0.98]:21632 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751498AbdF1Pgm (ORCPT ); Wed, 28 Jun 2017 11:36:42 -0400 Authentication-Results: axis.com; dkim=none (message not signed) header.d=none;axis.com; dmarc=none action=none header.from=virtuozzo.com; Date: Wed, 28 Jun 2017 18:36:13 +0300 From: Kirill Tkhai To: Niklas Cassel Cc: peterz@infradead.org, linux-kernel@vger.kernel.org, mingo@kernel.org, stable@kernel.org Subject: Re: [PATCH] rwsem-spinlock: Fix EINTR branch in __down_write_common() Message-ID: <20170628153611.gyvawfjtbrv7cj2u@virtuozzo.com> References: <149762063282.19811.9129615532201147826.stgit@localhost.localdomain> <76aba539-a6c7-66e8-2088-d0f5938535dc@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76aba539-a6c7-66e8-2088-d0f5938535dc@axis.com> User-Agent: NeoMutt/20170609 (1.8.3) X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HK2P15301CA0020.APCP153.PROD.OUTLOOK.COM (2603:1096:202:1::30) To VI1PR0801MB1344.eurprd08.prod.outlook.com (2603:10a6:800:3b::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 154bfef2-ba3f-45d8-b9e2-08d4be3b777c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:VI1PR0801MB1344; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1344;3:wNQUFObWnEnQy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CyWG0A4DiwUtvMyNbudamgMqF1nOLnAdQmkLLvNf8EoWKnCO0sKIeYZm9pLTnslqJfwGYN+anZxw15XUf6y2fn/yKgxQnfDcn0AQzXqeudaR/fNgZHuoHcOyNPkCxkfojehwUFx26PvC0BDlAoIRtCKT0UHVv/VwrNUizrucnbZUHNGSOYyW2HO/Ew8mJqkNS4wIpITfEugsd5lMM05n6zoUh2dHOCqS820yRNk5MfHAaE5MiO96SzezQD5wxocV21cO9GCNCjBX+cuGuUJZLY62VFpL8u9WiV/tJtNCRq25iAN5oHslcP7pexl/hRBaZIydG7duOYLVbFVcIhijABNbIqpyPQX2Q== X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1344;20:Ik2FOxba1WCjogrMiLWKj9tM7E9VCTumDLYnwWQgmD3vGYQRvRTHXGBzaKPlOJzdugimlz95KhQ0SP7Uz87Y9sTFqPyk7TIT3q3o70Z4gxK1v6nz1FOLtDM3Om0cQREoYoBAxI1tWXBWl8q1hWte0AxfsSBfD3fiVpWwKjqd1BMahVhDGNhs/NwyM6kMcWxwcFRfj5Ea2WlXy7F19EMS9h0MTd1L4lleGaWOw14VlwQuXPNql1RYjbiZP5ZRnz5t+AIQlKajKQb4yGBdGjVOrlvX/ZqVKxbk2pzKpBJ7wTA2Latqnfp01DThXznENrvZj0HwuT6oexcsaHVspVA830ePQpK0iGxWYaYKXxE2JxxIfrxNMr09xiiI31UiYsvJXhGM2BStsnHs6r4kco0bLY3LUZS2SB7h5GM0z4zOB8M= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236129657087228); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123555025)(20161123564025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:VI1PR0801MB1344;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:VI1PR0801MB1344; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0801MB1344;4:FSgb2L2J3DGGKFoHupVfCEmFNpLHspbcDx3csU0N?= =?us-ascii?Q?mEVWQN3HkH04Lj+O9gpq1p5Lbaxh9byVC1l+d8n4iOqFTNKZJ8Nru/UHOU9g?= =?us-ascii?Q?sAmLOfpdB5+GLqdJ+mNN7mKRBTg/X6ad62HxlFHIA2gDpOUMGqaue54VAXOn?= =?us-ascii?Q?0HUbaiAcprhFcBl/EG3M7xNYWt1dXNmWWLHwi/+IMw0L/KV2NYTWSMLjeTAL?= =?us-ascii?Q?CsYMUWd8XCV5tgIpN4f4uCWq7qC+K4EwCwkfq7gm750qCpDugPKbgYHzl+fG?= =?us-ascii?Q?anqZScADgCEUEGEt70kIskBs6WJ4GFU+xUkhAEjz8+o/0gK8WzbpI8mhGX/S?= =?us-ascii?Q?z0fpRDxfKrsOvgMeA9X6F4bVLOQAKgBoJtlPuhPCFf4gMe3TPxLqeSVgtOLN?= =?us-ascii?Q?vws/V6niF9KKkwMbcJ9Mokzg7vDBVqoMf+UJx/TH8INYEbzEWmElaWKbWRXF?= =?us-ascii?Q?pSE0vG91vsdvn8rb5sQYHUILOZGKZ7NmpAqdT6q4STbV4PVvPBW02ZM9dAW/?= =?us-ascii?Q?v3UwIr2TdqEXrC6XGp9ZlFxz4KAYwlZGadG34MHuqGlxOyICkaGZAditFvUO?= =?us-ascii?Q?R6jNpBTtg9QEKtfDwaUIiMGTRlBUsubH+SERolC9ofLY9lBKTyDaSVPsonRZ?= =?us-ascii?Q?uEiGtdpHEsrIj3FYlkY6kJPiAf2uuaTdoPlPIfj83UhtJee1usNE5fNgf/OG?= =?us-ascii?Q?NIyY9NfRCYCR/5cM30ZXwBrXdC9MxUNJWYRV8A56pyaHzf7tUgK+ba7G7fay?= =?us-ascii?Q?vMGpSkY2+v4OpbIthT2s6RFgTsG1j8fKXxtwQA208w3vGCLPJS1bLoB4WrYO?= =?us-ascii?Q?xX+mgIbRxqbNRRNIvTqZPh5GR/mfkwy1m607GYFK84qx2lYexhVf55dtutZI?= =?us-ascii?Q?+9YmKmO4tXHf1DHdj6z0js4sd3eVW31KXc+Kf3uaLGYVdPCa9QH3M1KiMHZf?= =?us-ascii?Q?XfSqUtx0pW19ye5zNZxK0xGgo06kwPbf1uMKjY5KwztPgib7+8igChpcFfc+?= =?us-ascii?Q?WFHhdvNU/OguwHzLEQCpS2InyJ5TsQ60zI+tqI9PyHuVHowbrLqNpHc03NIJ?= =?us-ascii?Q?fqkGJWyDltzrel9wmuxt66/7AYwKCaQEAMXjI3xtD5GKori1SCbWR/kEBDYD?= =?us-ascii?Q?vTxpjItg42Pd3STRfHx/PDLOMQgFQlnXxMiTktxCqSszPHtDMfuGocl4EWvG?= =?us-ascii?Q?lW2aHL6dAhjnqJ0=3D?= X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(39840400002)(39450400003)(39410400002)(39400400002)(24454002)(6116002)(4326008)(2906002)(25786009)(66066001)(86362001)(81166006)(189998001)(575784001)(53546010)(5660300001)(36756003)(8676002)(478600001)(23726003)(6246003)(110136004)(38730400002)(33646002)(76176999)(54356999)(42186005)(50466002)(3846002)(229853002)(1076002)(83506001)(2950100002)(55016002)(305945005)(53936002)(6916009)(6666003)(4001350100001)(7736002)(47776003)(50986999);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB1344;H:virtuozzo.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0801MB1344;23:didmH57824Y7VGTfzA5Ja5y4/a5EclVn3Uinl3i?= =?us-asc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sN440YLPEhVD?= =?us-ascii?Q?/T+nuefvzNSseBruprldUXpAK72xfEevnX+ZmxvAcjmL2yiSCU+D8ccCJrKp?= =?us-ascii?Q?TNmTKNtQ3eeTKCpybSYeM2rKnyK3GN2VX+WBoK7tPCvGCryWgkaWOdVN36fW?= =?us-ascii?Q?oAszl4OC/aDIye3b1au/5Kd8WaranJnwvG/UzfR6IKzo0zk9+fEv5HHpZjUf?= =?us-ascii?Q?ODFC+ENkZ/iI=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;VI1PR0801MB1344;6:4P+VMPPLeRCMYXYlwKfaPzEzxxmIBuo8NcWWmodG?= =?us-ascii?Q?1/JoYUraC4jwuy78kEUzrTwfAjK1zGo/+PwgQ1I78c1DVQn+dXq6eaHlQ4Jp?= =?us-ascii?Q?8J9kiTr3k1aKWhVX1qbEPk15duntW6lMiNQX7MEkIjrbvq2toRg602tNULM+?= =?us-ascii?Q?KJTj2hETEL90aq72oiIOm27Cwum9QE7ff3XyToNO44b40gPZN2mkEn71WZen?= =?us-ascii?Q?kgCAhlS/UXn7ZIYdsnBbG8KG0hRw6TTMfiJyjOUd48m9IUq8ZG0R5vM7KC2A?= =?us-ascii?Q?RWgowBIzjd3HzENCQWi6CMoqf4NWY/phTtJgWxm4PGbPbscvyqWD+nLnNFNf?= =?us-ascii?Q?dr+LqsYyOnPTTJ+pX7nZasjIRnB3Ttun+Kf3++f9lZJ8abXK4e0epKqgFadZ?= =?us-ascii?Q?/MPK5si0jr4GnQFXo///cX9aLc3uQC/6KXN8p5bl59UrlHu8WEh72ilitmCP?= =?us-ascii?Q?8qUVYyzF0pm+ExhYDtxpMzubh6Vp3HrjJUcnEcYXw0A+s6LOyNO8NPalUiK9?= =?us-ascii?Q?ejjb+5/Qxf3ZPNQnatAaxkYOKf5KaDpGJnNX7Km6YPvbF6ULbZQaI4ZF4YXn?= =?us-ascii?Q?UzXvyo5Gt4RxKGTGKchZ0hyPji9kBune9l9+84qKNasi9YWQcTrJlp6I90gy?= =?us-ascii?Q?vR0JliEo2pyYBG/6qen7wzLijxozAhU25dxslkZRrbGg4L8sdRsEbby9YmHF?= =?us-ascii?Q?gCWIYavvtgZz4oyzfGE90ls0XFnyjaunrt/rfD1O1RWOYk03kmkPoLxCKtHf?= =?us-ascii?Q?bzTNOErCwDuwsKSZx+BSS861OJTB0g5568wHhhkGIbsbP3/IyAPRNLE7VPtM?= =?us-ascii?Q?tYpm1EoAjDK7bc7lW8bJjIfIVwTLHV6kHBoBaI1z38NsHE8xeJzJYuZyfUf1?= =?us-ascii?Q?Wm+1OkmHxCG09wShlKOdBsZ8z/QknOjrKw1RERywdpoX0GVzb1KsgcjEU1dc?= =?us-ascii?Q?cd9ZD4rR+AQ1QLFNkatoXlB2xtCfo2CE6osORz8kTyjP+O+rw19emlY28H0I?= =?us-ascii?Q?rXw=3D?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1344;5:UYdqrOKrZFCPGGwI19h0G/TfqeSFNYSDlAtAnKjn2J71k3tKlA76WwCUUFcN4KiLzN9+FfzkyAFUn6nacMScGNoWPyPBNuMV8mf/vPbeHqqKn3BxI6/59E5lheHrE5D67jF0IEiUNMt6Om+139kanXVd1qfefMT5og3GYzJI/etGIO02Y+/j6t9eVX0DCrBFWp68LiCL4UjfGViWylCpUCfxjLRom+US+7hiI1PFwDdoIak+njEN6Ss1OBny557D0a6eybrdVkzRMeVkj7bGtbgAHyRh7xVz2anqgWShltMMuLb5XCFkeGOm8e+krAfHyvTeXiacESsrqI73dl7EjmlkPUvFgPyBT0t+QyEHzR761bz120oeBepP8jKV252qa2T+P0qX612f7Ag/Q/M/dC+kvhtfq/srNNYaALSoJbC4oleDjeMVWSOKF4qJNDJNjTIEjRFOS11pEZxHkJ4MhZlUinGm38E1AffGkHyis1aVS3rnZetyRZC+kE/RJ4+6;24:be2SScu14KOgh5s862DoUkiph7keg8urasffR+tu/RB6CCHIYV+MbYS7eRE92r8XRCgO6/J4avp6yDSfY90W768Vhwnpw3BdxZamdiQ7K8Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1344;7:wrsvmFC0UzTUmepd72IpXfAJcWP55QNgpTJiKdEKEbETpF6FCoa2+OICz6ZE84pDV/ta0t/MfEJMwFt3NWtfBkp2j4VUQGy+GBGilgjl/7Kte9ynleE4xp8OtyhdoSigMZVbu2Kq6EfHjMYPsq0qMNpLVuJmQoSVL32bNoGLwnsjzQh1kgcEc7T3P1iinmeuy1X8fNF70NP43kY/XGjQislu9yVtO8zZfPQ49owdTW1NGSgaJGdu5NMxHufOWQXaMevN9ZvCAR+bZyX5mq1xy4D8GLXqVTC6Po0SGVAdhB2nX/9VzDkWi32uCjLPuydE+RLv7c6LRAU2QltlimSaPq6ITl7Bs+M21OwQ3c0gGox6isvkige6n9O/BqoXgUad6PRDaWbE5Rt5VId32BDoTA4Eo20h7cPQ466VLvUAPzNZzWQ3YjX56ZnCkk8uxdeJSxk32gY5807QrU3qcfIfKmedO97lTwKU7UEUiJXIwDktp0Yoi9pQ7saEz5THJrsTMhgAqf98Sw0ta6+bRLsmsmJ8G4I7YpYX28UvskY94f3spWCCcIqKH5x3ciJ2+kBBpHRA7hjHjrXjwPbBUu12tUDHjzIIJh/im9zu51qw/MGD1DTMsGs+pWIOwtG3vIJPbvr0kohDscVzIZdkBxnnJXgs4Lr9a6rYfitSBT+lpMKobo1GqFsqq24nBTeu5PQW8LXD5DnouMJMqvJlLQkpJgH1TGcuiIQYV+/Q2MFb3/0yfNbY8dABDrOVME2VCZcWSOL1z70Ej5oP3aoXskZ08z3U0LHoBeZy7yEdPQJ6Abw= X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1344;20:T2r+y8GEOLLDCqcfswqLUk+776gYpeTlnLjOhxvuDbWjU7OM0XjCfueAHw3mG3Z956961LV8ZKZJHwb1gPv4l9/przRtdQTymN7BgMI7B+vcs/hqutVwCc5RVMVdsmKvX6e0ziQivULDwey6ss4qkd12yrI7AolnLvxmGls5Hvo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2017 15:36:34.1373 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1344 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2132 Lines: 70 On Wed, Jun 28, 2017 at 15:20, Niklas Cassel wrote: > Good catch! > > This should go to -stable as well. > > > Perhaps > > if (!list_empty(&sem->wait_list) && sem->count > 0) > __rwsem_do_wake(sem, 0); > > Rather than > > if (!list_empty(&sem->wait_list) && sem->count >= 0) > __rwsem_do_wake(sem, 0); > > Since we have the spinlock, and since we just checked > if sem->count == 0, we still know that it can't be 0. > > Either way: > > Acked-by: Niklas Cassel > [PATCH]rwsem-spinlock: Fix EINTR branch in __down_write_common() If a writer could been woken up, the above branch if (sem->count == 0) break; would have moved us to taking the sem. So, it's not the time to wake a writer now, and only readers are allowed now. Thus, 0 must be passed to __rwsem_do_wake(). Next, __rwsem_do_wake() wakes readers unconditionally. But we mustn't do that if the sem is owned by writer in the moment. Otherwise, writer and reader own the sem the same time, which leads to memory corruption in callers. rwsem-xadd.c does not need that, as: 1)the similar check is made lockless there, 2)in __rwsem_mark_wake::try_reader_grant we test, that sem is not owned by writer. Fixes: 17fcbd590d0c "locking/rwsem: Fix down_write_killable() for CONFIG_RWSEM_GENERIC_SPINLOCK=y" Signed-off-by: Kirill Tkhai Acked-by: Niklas Cassel CC: Peter Zijlstra (Intel) CC: Ingo Molnar --- kernel/locking/rwsem-spinlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/locking/rwsem-spinlock.c b/kernel/locking/rwsem-spinlock.c index c65f7989f850..3e6feccb8b56 100644 --- a/kernel/locking/rwsem-spinlock.c +++ b/kernel/locking/rwsem-spinlock.c @@ -231,8 +231,8 @@ int __sched __down_write_common(struct rw_semaphore *sem, int state) out_nolock: list_del(&waiter.list); - if (!list_empty(&sem->wait_list)) - __rwsem_do_wake(sem, 1); + if (!list_empty(&sem->wait_list) && sem->count > 0) + __rwsem_do_wake(sem, 0); raw_spin_unlock_irqrestore(&sem->wait_lock, flags); return -EINTR;