Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752779AbdHTKQA (ORCPT ); Sun, 20 Aug 2017 06:16:00 -0400 Received: from mail-he1eur01on0048.outbound.protection.outlook.com ([104.47.0.48]:59108 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752439AbdHTKP6 (ORCPT ); Sun, 20 Aug 2017 06:15:58 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leonro@mellanox.com; Date: Sun, 20 Aug 2017 13:15:48 +0300 From: Leon Romanovsky To: Anton Volkov Cc: matanb@mellanox.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org, Alexey Khoroshilov Subject: Re: Possible race in mlx5_ib.ko Message-ID: <20170820101548.GA1724@mtr-leonro.local> References: <64936cc7-12b2-3a8f-b6dc-54f6f7cf7d6a@ispras.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline In-Reply-To: <64936cc7-12b2-3a8f-b6dc-54f6f7cf7d6a@ispras.ru> User-Agent: Mutt/1.8.3 (2017-05-23) X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: DB6PR0201CA0033.eurprd02.prod.outlook.com (2603:10a6:4:3f::43) To DB5PR0501MB1928.eurprd05.prod.outlook.com (2a01:111:e400:c584::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ac9ed17-8d44-4557-9b7b-08d4e7b4707f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DB5PR0501MB1928; X-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7hP/lAvWoNMAbBBCKdQ4HG26/bQSLORnpjkyfG73SYQX6ZSAsbAuQhpDloq7nd+NaBXlIZ9T9EeiLigv8Exn7uh7/1UWkhVDqcVv6MjNzpbKiehDHeNofQyuSuphW3r5Yp22PVK/ya9j4uc6mdYl6ctnSuYzIPjoovstNjo1Frlhtu3GHLKCqcWcxNxijAHsShqikwneids+j9zctY+NjtqAjSNLZ8NM+uAEIOGUyd/H2EwI9eJsQ1BsWq9M6IWbAPXD7V2jlb8wiykuHBS/8JZbdkfZkPNNx+537Nrt2QxOmaRwCbE3+x2odojYgYYDtYI1Tm7JlCjdQNpzFfZT4SdgqqrEVd4U+16PeYuivEj/axF0bByxbH2RtZqUgDmdrUt7OIx9TIQ;4:KljN2H4mrKYXWpbN0lVAA1X27k2Z+bGgv+r0lE/c00eBqisE1CAo75uJeveyPFVr9elNTF//g/xw+tNOSo9gJzHs6VLBC5yupmkCoHO51C5Au8sm/EsQaxfaJTF19j8HIPQ7yAbdwYUYiNkbLM3r3gn8B+idaE7DdDLC5+exNv1p4RkaUXZ8d3eqWiPQeVfyii6DznAYMA9Gobpev7Z1EV2+QDQShDnLTFMqvrDRM6nJsgS+ePmEGPR56vlZUOJfVcVJqVdO86zK7oOk/pJhowAQLhpZU4VdDvp1E/rg26A= X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB5PR0501MB1928;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB5PR0501MB1928; X-Forefront-PRVS: 040513D301 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(6069001)(39860400002)(51744003)(199003)(252514010)(24454002)(189002)(6666003)(97736004)(5660300001)(83506001)(6916009)(2906002)(21480400003)(2950100002)(84326002)(8676002)(6116002)(3846002)(6486002)(4477795004)(4001350100001)(81166006)(81156014)(86362001)(966005)(1076002)(6306002)(101416001)(6246003)(66066001)(9686003)(98436002)(42186005)(6496005)(4326008)(105586002)(7736002)(305945005)(478600001)(345774005)(68736007)(33656002)(25786009)(189998001)(229853002)(106356001)(7350300001)(53386004)(76506005)(110136004)(50986999)(76176999)(54356999)(53936002)(18370500001)(2700100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0501MB1928;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB5PR0501MB1928;23:Zlr+YM0MCdUQv9WNmYiQ8az1d6M/NJtInkPTa23?= =?us-ascii?Q?ElTAYpSlJWfzJIqXOiNsZc4beji0tKlWlJxMuXt0RYpCFtqEbX5yb+05H7lj?= =?us-ascii?Q?Fmxf3O2bCp0GzBKQz0FC7JkdUxGtD+P3G5tmELa+LW2xcJNpZQnDx5POhfQh?= =?us-ascii?Q?YbHmlSKVXAqVWJKj64dcAHrQ5U7hyDtbjGScCLLzowbgRiZbM13SFvDwu9Xp?= =?us-ascii?Q?8SCvlB4mGHShs1BfZa79kH+nSzUtr/KVO4D10Kvmkb0vbgNdOpDvd3rrhZPL?= =?us-ascii?Q?YDoFvigUhhRy+KpBfCu4BvEjFOs0c5xqfREPAYvUyNtkjNi5SNANeHqr4MMe?= =?us-ascii?Q?/5dqRk1+6pTLdQjknZyp5/cqauwLJ23kGGnrYsSVb7Nv7rzkwXmprzDhsmuD?= =?us-ascii?Q?zyR2eF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xs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2017 10:15:53.1904 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0501MB1928 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2471 Lines: 66 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 18, 2017 at 06:17:15PM +0300, Anton Volkov wrote: > Hello. > > While searching for races in the Linux kernel I've come across > "drivers/infiniband/hw/mlx5/mlx5_ib.ko" module. Here are questions that I > came up with while analyzing results. Lines are given using the info from > Linux v4.12. > > Consider the following case: > > Thread 1: Thread 2: > size_write > ->remove_keys limit_write > ent->cur--; if (ent->cur < ent->limit) > (mr.c: line 234) (mr.c: line 335) > err = add_keys(... ent->limit - ent->cur); > > If size_write and limit_write are able to work concurrently with the same > ent then there is a possibility of a race between the accesses to ent->cur. > In worst case in limit_write new keys wouldn't be added. Is it feasible from > your point of view? If so, is it a benign race or a serious one? Technically yes, it can race, but it gives a little value to protect the ent->check with lock, because the limit_eize instruction is triggered by debugfs write and is used for the debug. Thanks > > Thank you for your time. > > -- Anton Volkov > Linux Verification Center, ISPRAS > web: http://linuxtesting.org > e-mail: avolkov@ispras.ru > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --9jxsPFA5p3P2qPhR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkhr/r4Op1/04yqaB5GN7iDZyWKcFAlmZYVQACgkQ5GN7iDZy WKeOzA/9Gm7PSLmbmLsiDik5T7gP30Uau5WZLVwZ47ZsOa+nSWB6M1TmLPz8S/3m r5KKMGHCDbWROm4bm3D7EOEppApjG6Hd/r9523EhyMlFckDvbAI6U9Pfx8G6et0F qcgRK2bNDrd/VgCq51pi+lAwe1GyVBsmDSq80Ig/zdLUeZcRn6LMeDebS1fHmhfK I0Hg/kilA3+tri1LjPbTqBJFWz2rnGZZRWpa2yTidW5kZ/M6oQTqxQAtaQb59SDk g4LQLQ4K3KI0qhh5wN3EhIxH/VE8PQr06CpUaPeIKEP5Ds4Un3R3wSVCAMLG1pIy 3RMVwHy5yHxA3ibpOmoBS0xPmBiC2etY6zlnDM5Xw8eoNfn7wUwMctWXRmEDksrZ FP44VIRqQeZBdyTgSVtJz99oNvir8uDS7mvKsBhDykkYBINETR0+NivJboTgLG5P Q9A1d84hlLvcjsBZ5VIli4gCtwGZTXuep7gxMbxp0dccXe7pKKzPITWKf7Nebfzi qNF4HPLysHQE6HrlenAMwf4cTMHExVhmFSR/S4KT923N6yPyQTD6zvqhe4AjEql/ 3t0iqe/u74lfu58Q8uPw4Eq2BYZD+vkTix9cihFgkqd4tY/wAzRtlwSzR8xEnVgW C/rzmWjFTHiE7KBuaoPO7GhHFvn4IUlsGm1OAhiZyeSus+qfTPo= =pttY -----END PGP SIGNATURE----- --9jxsPFA5p3P2qPhR--