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 08A7980027; Mon, 14 Oct 2024 14:48:05 +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=1728917286; cv=none; b=h4wOEsL9YiyNHCQ3zYPc5FoBHrOc4BjZB1Se2PCsDF+tg43BDNJuqinKvlnnfkzOXgLYTZktugHP2qfOwdc27NNfIsQRlbpdY4CdA5GymyXrLuXEHcoT9vndhkljSwYadICRUBuXPTWNA2djQnxkP+goMz0judvtTaYRy+2CtUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917286; c=relaxed/simple; bh=yYuzksFWsuVGvPJ2KOP561wIuFmLKT80rK3H/3YYTCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GcL4uAj6iBq5m8bCEimG5APjMeVklR6XF0J0svJ7cPr53az6GtDYUwz/nlmj2QS0RBkCXp6AZz4m8AdCGqYLNXa5oPhM29g/pePNe/sClCO2VnGWEdNm+uMXCbc4U9HaImo5D7skFqpwUFiew5L6KO72iaJvl+Q47OpctTMikrw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=am1I8Hrf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="am1I8Hrf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D448AC4CEC3; Mon, 14 Oct 2024 14:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728917285; bh=yYuzksFWsuVGvPJ2KOP561wIuFmLKT80rK3H/3YYTCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=am1I8Hrftpmv0U5iUwfFi7vVxTa4e8UIkGLIm22vjmdpynFT/mJH+maUrYtk+q8rb R5BMrRYvHsVGwYzefmlfi4/Sw+7+OD3UMeYwW0lyEK014TAHWGZmUJNogZ7B07Axhr wW4KSuWBs1gS9O3c49Swfjj/eTEM+SpJM1eDzDGM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Donet Tom , Muhammad Usama Anjum , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Kees Cook , Mark Brown , Przemek Kitszel , "Ritesh Harjani (IBM)" , Shuah Khan , Ralph Campbell , Jason Gunthorpe , Andrew Morton Subject: [PATCH 6.6 205/213] selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test Date: Mon, 14 Oct 2024 16:21:51 +0200 Message-ID: <20241014141050.962954131@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141042.954319779@linuxfoundation.org> References: <20241014141042.954319779@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Donet Tom commit 76503e1fa1a53ef041a120825d5ce81c7fe7bdd7 upstream. The hmm2 double_map test was failing due to an incorrect buffer->mirror size. The buffer->mirror size was 6, while buffer->ptr size was 6 * PAGE_SIZE. The test failed because the kernel's copy_to_user function was attempting to copy a 6 * PAGE_SIZE buffer to buffer->mirror. Since the size of buffer->mirror was incorrect, copy_to_user failed. This patch corrects the buffer->mirror size to 6 * PAGE_SIZE. Test Result without this patch ============================== # RUN hmm2.hmm2_device_private.double_map ... # hmm-tests.c:1680:double_map:Expected ret (-14) == 0 (0) # double_map: Test terminated by assertion # FAIL hmm2.hmm2_device_private.double_map not ok 53 hmm2.hmm2_device_private.double_map Test Result with this patch =========================== # RUN hmm2.hmm2_device_private.double_map ... # OK hmm2.hmm2_device_private.double_map ok 53 hmm2.hmm2_device_private.double_map Link: https://lkml.kernel.org/r/20240927050752.51066-1-donettom@linux.ibm.com Fixes: fee9f6d1b8df ("mm/hmm/test: add selftests for HMM") Signed-off-by: Donet Tom Reviewed-by: Muhammad Usama Anjum Cc: Jérôme Glisse Cc: Kees Cook Cc: Mark Brown Cc: Przemek Kitszel Cc: Ritesh Harjani (IBM) Cc: Shuah Khan Cc: Ralph Campbell Cc: Jason Gunthorpe Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/mm/hmm-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/testing/selftests/mm/hmm-tests.c +++ b/tools/testing/selftests/mm/hmm-tests.c @@ -1657,7 +1657,7 @@ TEST_F(hmm2, double_map) buffer->fd = -1; buffer->size = size; - buffer->mirror = malloc(npages); + buffer->mirror = malloc(size); ASSERT_NE(buffer->mirror, NULL); /* Reserve a range of addresses. */