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 B05E93537CF; Fri, 6 Mar 2026 22:57:21 +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=1772837841; cv=none; b=rzrl5avIkZTCZya/8E9YTr9qta72114nv1obEpw+iSbu0GFVdZmDIIz22cLuLcFjS5yha2sOSagwDvKwLoKlMI4H2RzQo1cuZ9T6PuC9Ew1G/bwYd7U0knk9kMHdN0UXGabW/l9kBjHKQcTJ/DofhAzSWH3mZglW6g0GE/xwJWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772837841; c=relaxed/simple; bh=+UpDJ8R8P09+MTeCv2vqlFR2qoA2D9Oi9pY9w7S2NpM=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=fwEwM044mEknpEeNe8pY9GSlpRmks1P/f/BV70iAvQs2sWqhixYHGpiq+uhJ42UD8/6z3Fsm3d/JK1uly/L9qmXjvgIa4J3Y7UjT75YbgrlD5N1uZSQkLV5fm73heGFIG7/z7X6RSCStFnJ3bAwDc4e1MXT0O3KRnhLib8IUKhI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=rQU6mmxZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="rQU6mmxZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A959C4CEF7; Fri, 6 Mar 2026 22:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1772837841; bh=+UpDJ8R8P09+MTeCv2vqlFR2qoA2D9Oi9pY9w7S2NpM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rQU6mmxZ5Jx7rNAFejrpaxCnUme6UV8ASDx6caVu2UEP2Z5rvv8f8noKKML98jSYW gLPBxBg3xU8hRkRMUlNTucpcKCuIMcsT4FuxToJfCoZ53Ugt4Yimi9tEFEOS8zJFlg FAK+BOgor9qTaGFy4UZVgKNV5kmZQ1SfXEk7+BT4= Date: Fri, 6 Mar 2026 14:57:20 -0800 From: Andrew Morton To: Josh Law Cc: Liam Howlett , Matthew Wilcox , Alice Ryhl , Andrew Ballance , stable@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Law Subject: Re: [PATCH v2] lib/maple_tree: fix swapped arguments in mas_safe_pivot() call Message-Id: <20260306145720.e8b6afd26aeb9b5caa277026@linux-foundation.org> In-Reply-To: <20260306223219.2824040-1-objecting@objecting.org> References: <20260306223219.2824040-1-objecting@objecting.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Fri, 6 Mar 2026 22:32:19 +0000 Josh Law wrote: > From: Josh Law > > The call to mas_safe_pivot() in mas_wr_extend_null() has the pivot index > and maple type arguments swapped. The function signature expects > (mas, pivots, piv, type) but the call passes (mas, pivots, type, piv). > > This causes the pivot index to be interpreted as a maple node type and > vice versa, leading to incorrect pivot lookups. In practice, this means > a null-extending store into a maple tree node can read the wrong pivot > value, potentially corrupting the range tracked by the maple state. For > a VMA maple tree, this could cause an incorrect vm_area_struct range to > be returned during operations like mmap or munmap, leading to silent > memory mapping corruption. > > Every other mas_safe_pivot() call site in the file passes the arguments > in the correct (piv, type) order; this is the only one with them > reversed. This all appears to be identical to v1? > Link: https://lkml.kernel.org/r/20260306200820.2819999-1-objecting@objecting.org > Fixes: 54a611b60590 ("Maple Tree: add new data structure") > Signed-off-by: Josh Law > Cc: stable@vger.kernel.org > Cc: Alice Ryhl > Cc: Andrew Ballance > Cc: Liam Howlett > Signed-off-by: Andrew Morton > --- Right here after the --- is where people add their what-i-changed-since-last time notes. > lib/maple_tree.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)