From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D1A93CF03D for ; Wed, 11 Mar 2026 16:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773247193; cv=none; b=AKiW/8LdQA5SY7vkz6XyW3zvgcexZb+Fcn7ubN7bpMfYU0Jj467a0KmznGcCqCBWwqkB9MqHsss8xKtzWOLYaPlzknSSM8Qi0hEtHoUR5e1nKMiokLPtH/PW33kp9PjGTruhotr3glf49CgMLHkRwQLDFljx5g1XbWyshIMifuo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773247193; c=relaxed/simple; bh=sGpXyALhfc9ipUvUx2Rb3/Cd1rhguI2Q8MDX4D4dbLI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=F/t/zv6yygI4fd2bk1Z4o+pRjaWpKVRNNYRY2ELNiE6tE4m4PQdF2AhhiJQfup1jVQnbbnqjmEYucd+WEK+RqXGm9HoMQnW203cbYUKTSp2YjR2VxXFRO+v84my9RREOvAwGX8uxmAB5lhSKLInNE/CaizZrkCJO1m/pzlAYPvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BvffOP3n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BvffOP3n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8770C4CEF7; Wed, 11 Mar 2026 16:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773247192; bh=sGpXyALhfc9ipUvUx2Rb3/Cd1rhguI2Q8MDX4D4dbLI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BvffOP3ncDcKlNtNMsTMQistyIfSztVrCJQPOZ2HzPGHem2ozXIJFuRof8aTDuGl+ ffDtSyzeUfE8ED2h1dGDHLkFJpfxNLkAPlD3xmsPrWI/ukYrdArKTpmRWfz4P/XttV vENoSeMlovMxFyXtuKXyN+DLSmcg6/zpz2pbdM7zxJMr8aiknMcaOhhsovNeBVvDWM Z039ULAcS+Vg7jcSg+2U2qhj1oV51vIrB/LAsBce3wW1YsKQLmz92hFwxPn9hVeaCo axLAtRQse4yPVCtXMz/CgJXetVk0h8MSaXKIkJ+nvVe0cqnNIKCOz3472hXF2Ybny+ YQbAh/kARzirw== Date: Wed, 11 Mar 2026 16:39:48 +0000 From: "Lorenzo Stoakes (Oracle)" To: Pedro Falcato Cc: Jianzhou Zhao , akpm@linux-foundation.org, Liam.Howlett@oracle.com, vbabka@suse.cz, jannh@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: BUG: KCSAN: data-race in do_mremap / vma_complete Message-ID: <7464e0be-7e5a-47a1-afd7-1ef20ec57aa5@lucifer.local> References: <1a7d4c26.6b46.19cdbe7eaf0.Coremail.luckd0g@163.com> <3c0873a2-6b9c-4842-b2d3-c3ffe908afbe@lucifer.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3c0873a2-6b9c-4842-b2d3-c3ffe908afbe@lucifer.local> On Wed, Mar 11, 2026 at 04:17:13PM +0000, Lorenzo Stoakes (Oracle) wrote: > On Wed, Mar 11, 2026 at 10:27:32AM +0000, Pedro Falcato wrote: > > Well, the problem is that the data_race() is incorrect. It would only be okay > > if the check could fail (with no bad side-effects). Otherwise, we need READ_ONCE() > > and WRITE_ONCE(). > > Yeah true, also a user can update sysctl_max_map_count without any mmap locks > held obviously. > > So we're probably in a state of sin generally that we've previously tolerated. > > Anyway, that check seems to be wrong, so I'm going to send a patch that fixes > it, and I'll update the logic to READ_ONCE() this variable. (proc_int_conv() > already does a WRITE_ONCE()). Also, updating to only check this once mmap write lock held, so avoid the racey situation altogether. Cheers, Lorenzo