Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753940AbdFPNo7 (ORCPT ); Fri, 16 Jun 2017 09:44:59 -0400 Received: from mail-eopbgr50117.outbound.protection.outlook.com ([40.107.5.117]:35171 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753718AbdFPNo5 (ORCPT ); Fri, 16 Jun 2017 09:44:57 -0400 Authentication-Results: infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=none action=none header.from=virtuozzo.com; Subject: [PATCH] rwsem-spinlock: Fix EINTR branch in __down_write_common() From: Kirill Tkhai To: peterz@infradead.org, linux-kernel@vger.kernel.org, ktkhai@virtuozzo.com, mingo@kernel.org, niklas.cassel@axis.com Date: Fri, 16 Jun 2017 16:44:34 +0300 Message-ID: <149762063282.19811.9129615532201147826.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: KL1PR0302CA0009.apcprd03.prod.outlook.com (2603:1096:802::19) To HE1PR0801MB1340.eurprd08.prod.outlook.com (2603:10a6:3:3a::8) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1340: X-MS-Office365-Filtering-Correlation-Id: 6672dd1d-040b-495e-5ad0-08d4b4bddea8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500041)(300135000095)(300000501041)(300135300095)(22001)(300000502041)(300135100095)(300000503041)(300135400095)(201703131423075)(201703031133081)(300000504041)(300135200095)(300000505041)(300135600095);SRVR:HE1PR0801MB1340; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;3:R4fGFe82hYyQYHdq+R6DmEya8fyK7W1VZEt06UDfaCmu8Jc6WjBxkQZ467242+8f8LpFtY5mjAMDPzOuqEhQUJOlLwhgaUDA7q5Csagv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BmS8AsJqWIOCZ7A7vD7QIraThI0NxBKGZ/Uy2YKxzdFgw7NqozFVjWKY/ZzkxJyBbBU0Z8Wi1INPJMq6jq2Hh8lKX0JElOKmVuD59mmZwX7/Y/n/8t1GLoFwDSnMEPBTRekuNqQcrUidANbuMbprdMA== X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;20:aWjCLa53x2DCp088V0i9jdRPOXrmwyPYbeMcrvyhsAkiq7ryO5J2ZoWUBvqkCMisvgcvnbk/TArooUYmcdZsAcTSL3C1ehqFDtjvIRkbKJnQu8gTS6g8f7tqUfNB6n05jsrqxX5FPcvh/gg5qN+d/VlXrhWYEonNTX60oFtafxRfogu0/QVDbb7R49m66aybQ0bJZYUm5O1GUo2EiERamV0TCT4DxYm45xg5j5N+M0xgozGLoACw3LYKwa44YN5UkPx53AG2x4cTVNAsLyZkV9vFi19R4IpTNz4lspM2IZNF6Uc0NTC28Mz0OJ5vDgsFLcrpIiD/xu+yZeuYLZbkbi4a/FqZM/Vu45sadWRZi+jGAwwjcM7m38HAHdgQ4C2mu0MyMScioKxLrrt6UbhIDOF6+kHQQq1WuvW5JT85vlc= 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)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR0801MB1340;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR0801MB1340; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQ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lI3NGNJ?= =?utf-8?B?Yi9mY2U2QW9Fd2ZudGtHMkdBSUx0aDIyN1phcHFkK3hxeEdoRjZDcjArMkZ1?= =?utf-8?B?WGdITkNRZUhvbE4vYkxRTHFMalZVajR6c3QwSndIV21IWVdZaEM2UXpHTEQ3?= =?utf-8?B?RmlmVUk0UkZFZzV1ajRPblIzNFpraWlCbWlLV3VOUDFIQVc5UDZnTWVIZC92?= =?utf-8?B?enVaMDJvUk9kWXplVkRUcWZjWlA1WHdKKzFCcFlsZmZ4YVYyR0VoL2pHUFNq?= =?utf-8?B?VGxrem42Sm9OaXdRVTA0NmlxNjVJRThWWTNHOXhmcWhCaWtBQkJwSFVZY0gy?= =?utf-8?B?UW0vb1lOWVR5eUJ4Q2xFWGZTZFNnMU9mTEcwWlhSaFdPcjVQcGhzRG01YW1m?= =?utf-8?B?UTl0TEZ6QTFSejZvenRCYVVNWFN1WTQ3RUE1TWNnWm9McFRhME1yNXJpK2VF?= =?utf-8?B?V3NzTVBId1liTXFTQmt0RE55TUdWRWRTZWFCUktGUnRQY2ZoWmlTVVlXaldU?= =?utf-8?B?c01ucEQzRzJXN3NNTUJveDMva1FXM0xEVzFFYk1aSWc5Uk5wZmF5K21pVXZI?= =?utf-8?B?cWlPdFRSN1BJOGJiMHBDeUM3bzlSeTJqUmNqVXUweTFBUTF5eGJpRElTay8v?= =?utf-8?Q?WEMcdoHkBRdIosdItGRqILQzJqTc2nC1UcNJJ8bIo207svj?= X-Forefront-PRVS: 0340850FCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6069001)(39400400002)(39410400002)(39840400002)(39450400003)(50466002)(38730400002)(6116002)(3846002)(110136004)(2906002)(81166006)(8676002)(478600001)(4001350100001)(86362001)(50986999)(54356999)(305945005)(7736002)(42186005)(53936002)(575784001)(230700001)(55016002)(23676002)(9686003)(83506001)(189998001)(47776003)(66066001)(6666003)(33646002)(25786009)(61506002)(6506006)(5660300001)(103116003);DIR:OUT;S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k9kWnBZcC93eG5T?= =?utf-8?B?K0ovWWtOQnRnN051S1plb3lsS1hRMnJCM3RJOEx4OWVER0orMUdzTGFwQ3pG?= =?utf-8?B?eEViZGprVmlJWVZrbmpKNEdiZEFuc2dOemd6MVE5TEZlWlVINm1Fc3E3MmJG?= =?utf-8?B?WTdvSjlXTjVJMlNBVDhENzNwOXRPaGpvRWxRSmRwV2dLUVhHbjJ4VTBrRHEr?= =?utf-8?Q?JWRz9MWlFhoilxVCYrrSr0Qn4W3YGb9EE=3D?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;5:RdLxuYLJVtL9pH6Lk2iM2d8W+dGK950t6Jn0Xi82ZUPHR6comnj5yI+6r++/XBkUmWQkrP5pIkYREjYLmOy4g1RZSQ20BtRMiS5D9xv7mK6SLHa+2Ibfi6RzP0aUquZbw0NrfHkWDNij6We4kmwm1leg6D4Mf2iV85vPrane/NHrvTyxkMlJ/fkKWntPJ+poXOihrS9zcKHP0XJlQucu1BQ8CDkL82cVNNyFnfNTDmqsaMHxYFfJAwXCy1hsxzma57odDd+2zIzovRARBnkbpQPFtWeX4S32YACiafZjwXvojkUaRh5B9MaSlBXwpAN7CIzAIMDqkLOOacOH0DwPgY2ViKZVJ1cvKBg1NMprgLN89NHnUgN07cd4RRSameoTv38ZgZElQ/yZ6crYevnr9mL8sc2j5uunZk0/7h3ImgPFsXXUcM14+8HyEDsNe+NXiZdrELwDfi/w9DSRk0c3OpubaX/9D1ljRTdlzTvfdq2TIoPKKsbO9LGI4JFBdaIn;24:YzYEuxAxXq6u3/Qc0gcY9tjlfbGmYA5rYasfOLZHoJEZdWHHMHYCLP7+KJG2KquQiGJxNakKQUL+LJthsp2rVPOUkqZzkjFuRvPZ/4nXn+c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;7:PmOxS2NWWJW/sACHO3xAeU9pW2Qi9brc1kYYTG5D1vaPMgI68omYZXJboyRM2cI//sx7AE9dDBVHU7+mM0U3pYvgXUhxwuNLZaBePItsTpPOXX+8xpT9HFj0Vb2PhSh51Kq3o8texLDIWWQLZZQ2ysTjR19BMJebJGIVO9j09aqigC5Ea9gCGDD4j5Qb0bRZbIrVD36r727wLTf/ulWjabONH0o1keeVds8HNsdAo7a5Uv+mCFpAQnIgCOmie4WbZCGZybj0MC810N0FPDsPNEw2q8m5po00Az4YswPYaOuxEo4xinziZ4ntB4/jjjlq0bGWoJmg1mNf3xcmiqsHIIiWqf8i1gHW/DgojRHbbMzGatxVP/2190RFHVeJMFEZNwG2xzZ3dM5T86jXu2dM3LP6F68Dm//iKTZU9yWXPgG0qG69EEgOXJ2mknAVDzdv2a69G6/RGSQKkfIOef68MxQgg7/EEhal7h46gukkURIXZJGvWuJ+yg5K1xiA1f1tNBcf0eKr2CQrt8yOs9cM20l1ieRkW4lf0wEBIfoEcnSx7fSlvmP/VaEfpkd+TwRl3DOQl30fwD8XJKrXmD+Er+nRjWL4zCmhiC/DuVWdDY1+bHAaurTreFr469gEXw5m1zMm7Pqdbvk1jWMTY+d47LbWhirVB2+mVEm7dGhPkbMUja/onSwC8qU8kqHUQMJbSNvohqrZ4OmVA7yRLulyyh0P/WIuTvVlLGabw5EWaExPRYB8WtZSzRall4Z/42DvjbgraG3SqcOcwqqMfRwIjUfLbnScuCQh3Rn32wbkYds= X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;20:mjLpGcMv0FoU1718REZjr2oOj0IWOwgr50ZbupMmPWdOqWFy8AAm0rYI2fjyKPeP0bL/PgekcA5mRMcmtmJIeYrgpdBQB+L1YP7XQsHr8QlkqAGvw/XsL2uOi8zXxLUDzHXQlHwulZVUzOuvl9gahZHZH8ls167uniifIpeU1PE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2017 13:44:50.7957 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1340 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1558 Lines: 44 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 CC: 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..20819df98125 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;