Message ID | tencent_912BC3E8B0291DA4A0028AB424076375DA07@qq.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFBC3C4345F for <linux-mm@archiver.kernel.org>; Sat, 27 Apr 2024 06:30:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE3416B007B; Sat, 27 Apr 2024 02:30:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D92A36B0082; Sat, 27 Apr 2024 02:30:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5A0C6B0083; Sat, 27 Apr 2024 02:30:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A7F026B007B for <linux-mm@kvack.org>; Sat, 27 Apr 2024 02:30:21 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 04142809DA for <linux-mm@kvack.org>; Sat, 27 Apr 2024 06:30:20 +0000 (UTC) X-FDA: 82054337442.15.B4FDD71 Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) by imf20.hostedemail.com (Postfix) with ESMTP id 3524D1C0008 for <linux-mm@kvack.org>; Sat, 27 Apr 2024 06:30:17 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=qq.com header.s=s201512 header.b=fHxrhBo8; spf=pass (imf20.hostedemail.com: domain of lilinke99@qq.com designates 162.62.57.252 as permitted sender) smtp.mailfrom=lilinke99@qq.com; dmarc=pass (policy=quarantine) header.from=qq.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714199419; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=X5DBZvPMjk/9nShMiTcsNTRbxldm349WVIluxfS6Ssg=; b=3N3T10nboQsznt3eWJBPbtmklebiHZ7o7nTe0ZTr/xfXOaTtbvN/j/ndvTOD/8MtcdUWms xrLTbfVsBXHx0M3ftG9f57hMs62S/FlxxrNy95S9vmfPd60SWo+5Owr8yhrFUe/H7NHZH3 3jvezzlGwCQ2idDJe5Lza795DP0VDeQ= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=qq.com header.s=s201512 header.b=fHxrhBo8; spf=pass (imf20.hostedemail.com: domain of lilinke99@qq.com designates 162.62.57.252 as permitted sender) smtp.mailfrom=lilinke99@qq.com; dmarc=pass (policy=quarantine) header.from=qq.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714199419; a=rsa-sha256; cv=none; b=WWvV/YNEHHg0SAd9Dhnqozhvie3wJ/ICX1F5lLoAaJ0k7+cTqMusl63FUSd+lEiv+Tld1P JXe0ZgXCXVG1dBZ/RmX0Qb7DbAgM4gjbWwPjHPL+l2oAuVN2uai0/0UUGsslSn/ZF5HiJ3 GIyIa8kUdadQWxXSyRP+He6SehWKdAo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1714199400; bh=X5DBZvPMjk/9nShMiTcsNTRbxldm349WVIluxfS6Ssg=; h=From:To:Cc:Subject:Date; b=fHxrhBo8ZZb0ttLtFrMMuRies1B7OLR1Ce1agXPp1zB3VV5qVsgD+GHfwljbiD9Wb NpsvQBwP0RaDf1aHLdnG2RNsrVSCJqEA+UitNmeS6Dq/NrY3YBao9i1r66kbGCTWUu tS6So32jPhqh21hpJxRb4T5jmYPfHV4toE2g0vjo= Received: from localhost.localdomain ([58.213.8.145]) by newxmesmtplogicsvrsza15-1.qq.com (NewEsmtp) with SMTP id 77A02271; Sat, 27 Apr 2024 14:29:58 +0800 X-QQ-mid: xmsmtpt1714199398tq9lrmogb Message-ID: <tencent_912BC3E8B0291DA4A0028AB424076375DA07@qq.com> X-QQ-XMAILINFO: NMGzQWUSIfvTyHfvpZyEukJJaftmDSBmHLya5dmQPuN5OP4w6O8yn4Xa+KHxe7 0pBeg0y8gfl0tG1LF1PdSIwTVvFeTou/TwA8pOkUK3kWRxyXCa84XuqG6JypXzXvwisa/CP6VKZL wfrhn2Cqh8toswp1ltTtpx5qVjfcy7b1WTfHrzCivn0m4RC3MSWeniilTDLX2ihiNm3HpkyQq9xK peCsNUUQ+IzMnWENODCPKuxxLKuTz2H1uv48n3/b9RciEK68rNlKB06JzH4CgjOp6UJfGcQD6Dto fYGxZA6ShZXgfI+lVc6GKr0RsdMcyyQTR7UkPHzw3W4BnLCRrzZ+af7j2J73dZGycj8TX4bNqHSx LJ9hXt/P3mH9EAFPT3gASQvwd2acHzfEAqUwE+HueGHSHdWgjR8BYKhAOjz8HWtZzPvsqeeprD1v Ag4efn9KTodE2HdHjLzvl9WdD8TgL73F58qZIrOS91b9Nwbo2WVUN/duaEjE5IUs9scZMo6sZUoD uzi1jv+L8MCUMjUvYXLhGWnIaX9CdUp8FqBNo8yfdZk6Q3hD4/ef+C3imesa1H7VBdKRmErClDUV 7phGv54DufRGcuhed0Sv4qWQZghxaaiox0Zvr6OnGzZiKSY5CBv3VyyKS6ncYsG6bX0UGx4Y+Tje rox5l3dzMJ9GFDsrCIZ5jdNEqTykGRk0hkDdYonQOZ8CFSsxDHjzP239nWg50hxtMwv8cq2W6nOX uoMP98j00kdCTmhJokAN8N2ZtTEtFqo7bqznmRdrSBmkK3+DmeCMfWDynLJtVl37U6WULe2NgSjj epUUIpnjdjDccFhizmMu9Vk5+BQ5MCRJRr10jJfGr1B/PxC4XiQk4+caS19shhtZRwwhF+orBYIS Y8nnRk4yX0f7FNY+kBf0JvniQ+SDufgRF+GYmoP8IAhZWeloJk3jLMvCKPi5I93KjGgzXSdOL4XL uGuF7WfbJYoEmryHPTYHQkbqWf/t49em8q1jbn3GQWhj/EIH15Bq2P40Wq+fa1fs7rSvm1ezryRb jZpILpH6idUkOA7mY8 X-QQ-XMRINFO: MSVp+SPm3vtS1Vd6Y4Mggwc= From: linke li <lilinke99@qq.com> To: Cc: xujianhao01@gmail.com, linke li <lilinke99@qq.com>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/swapfile: mark racy access on si->highest_bit Date: Sat, 27 Apr 2024 14:29:56 +0800 X-OQ-MSGID: <20240427062956.31079-1-lilinke99@qq.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: mtsiwiufa49ikuii9wk8pu6tq8rbnkdz X-Rspam-User: X-Rspamd-Queue-Id: 3524D1C0008 X-Rspamd-Server: rspam05 X-HE-Tag: 1714199417-469827 X-HE-Meta: U2FsdGVkX1+J4J1cCilYDT4RpmbWPAc/58gekqaOf222JcIUmAykwZjiFkpt3BljFnN6Qq54f87st/q29XpKbMoJVaTpI9veuFkdJI5xyj90JZb5vCVizlDnDoJbI84rE1hisJ7ZH4PaQ0jP+Xsb0HCUpyuB7LLu3OFQNdVYaoSibfcwkr1ggP3tmNj6+LZecapEg2n28KKpPMU+3f1ANxgyuzL7oQvmeUkvaR1hU1+/XVf9dhq4YFKf1Ai35QF7Vv+CZx7gE3xWu/nuhYk9Pm+6T5b8A6SP09IljEbrKSYFamLlW2mJ91Q1Q2nz/BqFLKUNEQYjxSpoRHnDVup7KZTyMeb5r4c4hQpO/LegkgvvxkBc9CAbe+jrpR7pnc7ENl/VcK1w+gquITEpudW5McOEIq8XwR+Z+7b6gyCI+NO/rqEFEGhBSs7Go71CRBRCm2u2HfLJ7AgBT5v2t3+omWDEZWuLfbJHrQutSCo/k/MzzjmRGlezkMmqcoR0QVBgPu2z+QV1AU804BlNo2wvMreNpxFsnFQlQX911Y7hJkhtL0hoMwrBT66gqP9n0wVeRi1GhmNyC+Pode5MLyJGO0xsSMERmgQ2GNrhtdNPJLD9mxBxPXXsjN1QMwIW868UQHXyjCeC/TNK7TGHtsWoVqECZf1CayXaUwFIA8zuvbSLpxdm5OEB0uc6on2z0cBy6F7U7pJWL2Wn41K/fNJcYUHhBtIdugc0D2OmH84p53VdRbeH1KuVbdbkcghKWnO3PXW061vV2sDGAr0Bhvx74z5RIaNQhabQgX1hryhW79qcwHJUDCdVCSlOPJShUypfMTIIGgCAiCVDKVcDaOsaK8UoRnUfnxzX8x3RLQz03B5pfBTBr7jzcHML6Rt3xSqB809bvSI9y/yQM5+tCq6+Z2cOyXGal/h9I69J19Terac= X-Bogosity: Ham, tests=bogofilter, spamicity=0.258784, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/swapfile: mark racy access on si->highest_bit
|
expand
|
diff --git a/mm/swapfile.c b/mm/swapfile.c index 556ff7347d5f..fb2243f7f06b 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -854,7 +854,7 @@ static int scan_swap_map_slots(struct swap_info_struct *si, last_in_cluster = offset + SWAPFILE_CLUSTER - 1; /* Locate the first empty (unaligned) cluster */ - for (; last_in_cluster <= si->highest_bit; offset++) { + for (; last_in_cluster <= READ_ONCE(si->highest_bit); offset++) { if (si->swap_map[offset]) last_in_cluster = offset + SWAPFILE_CLUSTER; else if (offset == last_in_cluster) {
In scan_swap_map_slots(), si->highest_bit can by changed by swap_range_alloc() concurrently. All reads on si->highest_bit except one is either protected by lock or read using READ_ONCE. So mark the one racy read on si->highest_bit as benign using READ_ONCE. This patch is aimed at reducing the number of benign races reported by KCSAN in order to focus future debugging effort on harmful races. Signed-off-by: linke li <lilinke99@qq.com> --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)