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 64B3C1AAE08; Mon, 14 Oct 2024 14:35:06 +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=1728916506; cv=none; b=ZMi3Hw0sOIAN+qEaC6JNoOiOtwmVTvOOva/6Z88ONw5+Wk8KMKKmL6VACH5abgnJiTE8zs84MUE3zjhO6VsYvdp0Ye0fpRyvIpnxp040nCU2L34AqUNJ3AyflWLuNXBjsXZvQ000KsB0eELV5fuGuURsPit7fisPL0ekCmotvb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728916506; c=relaxed/simple; bh=MgNb5yWnowP30fo1Z6WAkffMnXdC7C3g1pmaoNrBzWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RMwCDRtk8XCxWkvR/1rBZczzmUybYgT+ZlIxvCS+qSaHK+Meq5khzfia/74Y0SUyG5TZPe2BccLcAPqevIR/hqqPwglrpOPq8kAL2ApKbIiZEde14ASgQdBVBqM9ErQGPr6z4jfJxWd9OiyZ3degqa9NIpb6ayrnYhN/C3C6fzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xVC5hr80; 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="xVC5hr80" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8C7BC4CEC3; Mon, 14 Oct 2024 14:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728916506; bh=MgNb5yWnowP30fo1Z6WAkffMnXdC7C3g1pmaoNrBzWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xVC5hr80homVszeNn2Yymxax/bw40V8X5XL+NklL/nYE9bJUi6VpzX7IzpGfILgqG glp4zdRDcm7bDQaYwjLQXTE/Xa2yF6g1u3Jbl5KgnlFezCjpHDKASVwkOoSDody2Ds k7Phj/9ev5z2LiPVV/VITphlPUtQRL8jL8ott04Y= 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.11 204/214] selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test Date: Mon, 14 Oct 2024 16:21:07 +0200 Message-ID: <20241014141052.937830058@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141044.974962104@linuxfoundation.org> References: <20241014141044.974962104@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.11-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. */