From patchwork Tue Oct 18 10:49:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 1691453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=WnmOm3SO; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=OfeeZ7nB; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Ms9cP1Rdgz23jx for ; Tue, 18 Oct 2022 21:50:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9LOLnXRAMXGufrLNAhHZAu8MtMNwhZVt7oK81cipCxQ=; b=WnmOm3SO7SR+OR OZ/5SpDhc8Hcq25KCb8lCU+yk++CB0hEIJFfXHbkAL9DcCLeKkocoX4/J/8DfeAy6nwoc0vW/mHwa R905JRkH+IzMF5+NEXayNZMdcLhXXIwnBCKwebgUrPBzmGv83hx7ZuLRcLbIITJH77z07yxqt9u+G irz7bGsA7tiwfXm0HuHFNtJgfYE0YcpVgrsxjgTZtBXYu4aPlO908ggREtwo/7Tj3Wf26u0on1lBq ggpxx1+nfxO5TRyLiweBqPmDau2F7FCq/i0cR7wd+SCtAoG1/gJ5MRO5Tx6Q+oKKOctJWGnfJE1j/ n57jgf9PWOoyQ9swwKdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okkAZ-005hrC-JY; Tue, 18 Oct 2022 10:49:59 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:191:4433::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okkAX-005hi5-Cz for linux-um@lists.infradead.org; Tue, 18 Oct 2022 10:49:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=jmlvhRnKaUYB0NmPXDQBpJdgQm3k4K0Hahdue/zlEms=; t=1666090196; x=1667299796; b=OfeeZ7nBWWMcS4ozBTR4YvjPdlPOW3lrg/G7xFPj9oh9kDpwuigKQWmtLuuY77snhAEu49ia8y2 +dI1OlFc5Tkt7cRG+VTedOPYH1tH6eZ6ckq0BEg310NXikTpkL+9U7GGdbtzDMi9Xe/rW6wRFbmXs rHJHCw6LzVSdTp8soJkCd/8Bq/8v0vtM88GriTuuCoFdJrcExNZ+8+0ZsRqw/GvGc3x53qfG2Lhul MjbUmldsJ4VOwO2l+NOMgreTZvNouqNhYBV6AsS0G/qRldrE3Acl5FWLv8HfeTkxwnl4eIi24si+5 iFBQF2nnHrNmsxURhAyoUnGx5tLKPS/OfmOg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1okkAS-00A8Fw-2s; Tue, 18 Oct 2022 12:49:53 +0200 From: Johannes Berg To: linux-um@lists.infradead.org Cc: Matthew Wilcox , Johannes Berg Subject: [PATCH v3] um: protect VMA iteration Date: Tue, 18 Oct 2022 12:49:49 +0200 Message-Id: <20221018124949.44384051d19a.I7b85b7dd326d2d078dabdd4ae40c35dc4ee1f3bc@changeid> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_034957_467114_AADA7CB8 X-CRM114-Status: UNSURE ( 6.88 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Johannes Berg Due to changes in the iteration, there are now lockdep checks indicating that we're missing locking here. Add the missing locking where it's needed. Signed-off-by: Johannes Berg --- v2: use mmap_read_lock() v3: umm, yeah I'm an idiot, tested without rebuilding --- arch/um/kernel/tlb.c | 2 ++ 1 file changed, 2 insertions(+ [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Johannes Berg Due to changes in the iteration, there are now lockdep checks indicating that we're missing locking here. Add the missing locking where it's needed. Signed-off-by: Johannes Berg Acked-By: Anton Ivanov --- v2: use mmap_read_lock() v3: umm, yeah I'm an idiot, tested without rebuilding --- arch/um/kernel/tlb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index ad449173a1a1..fa43bcd9ba0b 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c @@ -597,6 +597,8 @@ void force_flush_all(void) struct vm_area_struct *vma; VMA_ITERATOR(vmi, mm, 0); + mmap_read_lock(mm); for_each_vma(vmi, vma) fix_range(mm, vma->vm_start, vma->vm_end, 1); + mmap_read_unlock(mm); }