From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECA20E7719A for ; Mon, 13 Jan 2025 05:00:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7691E6B007B; Mon, 13 Jan 2025 00:00:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 719AF6B0083; Mon, 13 Jan 2025 00:00:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E1056B0085; Mon, 13 Jan 2025 00:00:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 405946B007B for ; Mon, 13 Jan 2025 00:00:49 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0167CB1B61 for ; Mon, 13 Jan 2025 05:00:48 +0000 (UTC) X-FDA: 83001228618.27.31AC4D6 Received: from out-175.mta1.migadu.com (out-175.mta1.migadu.com [95.215.58.175]) by imf11.hostedemail.com (Postfix) with ESMTP id 1738D40011 for ; Mon, 13 Jan 2025 05:00:46 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=DjpA+yJG; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf11.hostedemail.com: domain of hao.ge@linux.dev designates 95.215.58.175 as permitted sender) smtp.mailfrom=hao.ge@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736744447; a=rsa-sha256; cv=none; b=X+np7TqZibgYeHfQbbKmwscGb7XIiBB7LZHf1Rc+NcQpAHofkOlxWePbfwSaBgHpdVAvBp S1JHcgqvigd35LlSW3qPVBLqsQaUDPvXUNQjxGRjjHpj9G5b7Ksr9GnDWGfU786m9Lrq8V xrTXxU+MBz659gI/uGpbuuv3H8RM/Yk= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=DjpA+yJG; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf11.hostedemail.com: domain of hao.ge@linux.dev designates 95.215.58.175 as permitted sender) smtp.mailfrom=hao.ge@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736744447; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FmXuMINrSQ9tkbb9LL/ewhBUDF2cOwbuY0kHl/709N0=; b=fzAkSG4M9Y+RhhUIeMxFzVveRWf3EK5VEspweQXN8PxHVljjVBaglCpTQwbZHPfs47LI2g uuTGpKMTGPSBOZq3y4yre+5aKZURbXx2/2Tm/tX/DQ2571scw/D4r0sGQvyWHfUzq25sHe AywEh26jipwzLoX/xl7M8GjOdg0Nh7c= Message-ID: <1514aee8-e75c-4c05-8943-65681254feda@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1736744445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FmXuMINrSQ9tkbb9LL/ewhBUDF2cOwbuY0kHl/709N0=; b=DjpA+yJGuuD854niQtAPwBTfGEjrzhDTxSnyGHz4FDH/nt/7QrONOLWzE5Z9lejgPuQ4rr G77A0CJdQBE2CF6I7SWdNcxoTC3lC5KTFfOZ9OvRi+nBgPrqM11bCtc4ssjqb8RdH1pNfy Nh2fIiY9IUiSH0FTLSEuUHJLBm9tv5o= Date: Mon, 13 Jan 2025 12:59:52 +0800 MIME-Version: 1.0 Subject: Re: [PATCH] selftests/mm/cow: Modify the incorrect checking parameters To: Anshuman Khandual , akpm@linux-foundation.org, shuah@kernel.org Cc: sj@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Hao Ge References: <20250113032858.63670-1-hao.ge@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Hao Ge In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Stat-Signature: a6mjpr7kyipz75zw8c56np8bstzce6hb X-Rspam-User: X-Rspamd-Queue-Id: 1738D40011 X-Rspamd-Server: rspam08 X-HE-Tag: 1736744446-648715 X-HE-Meta: U2FsdGVkX19BEyv9GQcFp4xJ78KWnbItN8D6Aqbpj5OfurLnM4ypq2uAdEvtt5obVlVTBq0+Y6cZCNzXfemHiE7eJjqQm6zlvP2O3Yc4qU/sZUIQ/COHG4cDFwvL+0rCUqtCRMuHxyJ9olzPdvOGbGw8sSDwfDgZ+vjBsJ9PMv6YitNWgDq8w/J9B1t7rPVBpwLwsB2w2Ge3UlmhCqgzJO6iX86T3knrq34BQ7TM9MUbfxHIUfJj8GuugwHvPT/5kf4x4NRn8vj0w+22PSlh+yIamcG6+Ffsm+ZGkPpw5p5Zo3FYGsNEaHK9+kdeZZw8f5MA2VKhUZfP0gDWwKF9rmxtzAsdl/QfqXH54QOG/ZMtv2fYEU9Do13Eg4tf4DW3sIa4fbfQZB2/Vr3cXGhAn2cA81EIzPv9GfJiisbkleDQQolcWcV6AuPq7ea6JlklmdQsJXeYI8z4fZrfIhQfCkt+cfiRWZZReRMzI4ooQSHNKrlL4k54CiDvTyNRl7KePkbiWb7nOy4NFsc2GJG57auAa/cdA0M5O7XSBkhmu8glWh//kcBxkzZWbBfLVx/3s9liyU6BZk/PuHYXk6HWpMwJl2D/DMH5M3uK1cRtgWkjMrfzPrBYE7G2QpDI3BnQY5N3l7Z4lQyoKKGpAxjtersyC9uQgyBGfB2ubxYfKlAixqfYJ2myQimDLBPn+f/Cqiklfo4xJEu/1bTeXqaIdv22CVE4qUC1OCi/4j4jcdokF80SA/UdBURxQZXh/L7CxDbeU6nTtcpCRR84d5S1G84FdBymtUxncqYwyDkSwMGho+VA6lQofuWRRg94Px4wlmXGzlfUJuf8Pt+SQ6xl0qWEQYbV3whUsg998K21tXY/dbkSxCnIx1eh80MSCfj1dd0TpcN4fkB8njwAUlava2WkGifh/M6IS9kMetHD3F89V1jCdO0dUJ5QzNNrMa0rFXwGDf/qfNQVlfL6ib1 Z5+IXRw7 +EjQhNxJiTRzLRZsd8Zk/4A2UNfPRegamhk0gVKP8qhaNbxAh6aIJQQDpddKPEY8yPGxce38RKp264SQg7c1uuutHx9hS/oB3yIjDbki4UCtNE4Pn3LnTeT+/61BmlUXz2tI95n06Odq3The3VLXXxNY2CtX0LrYBrfR+tOj8ovvLZdw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Anshuman Thanks for your revirew. On 2025/1/13 12:26, Anshuman Khandual wrote: > Hello Hao, > > On 1/13/25 08:58, Hao Ge wrote: >> From: Hao Ge >> >> In the run_with_memfd_hugetlb function, some error handle >> have passed incorrect parameters. >> It should be "smem", but it was mistakenly written as "mem". > I guess there are couple of more instances where the returned address > 'smem' is not getting tested for MAP_FAILED. Hence the commit message > here needs to be bit more generic rather than run_with_memfd_hugetlb() > specific. Thank you for bringing it to my attention. Upon reviewing, I confirm that you are correct. > > --- a/tools/testing/selftests/mm/cow.c > +++ b/tools/testing/selftests/mm/cow.c > @@ -1482,7 +1482,7 @@ static void run_with_zeropage(non_anon_test_fn fn, const char *desc) > } > > smem = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE | MAP_ANON, -1, 0); > - if (mem == MAP_FAILED) { > + if (smem == MAP_FAILED) { > ksft_test_result_fail("mmap() failed\n"); > goto munmap; > } > @@ -1583,7 +1583,7 @@ static void run_with_memfd(non_anon_test_fn fn, const char *desc) > goto close; > } > smem = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, fd, 0); > - if (mem == MAP_FAILED) { > + if (smem == MAP_FAILED) { > ksft_test_result_fail("mmap() failed\n"); > goto munmap; > } > > >> Let's fix it. >> >> Fixes: baa489fabd01 ("selftests/vm: rename selftests/vm to selftests/mm") > This commit just renamed the directory from vm/ to mm/ directory. The following > commit introduced the problem instead. Please update the Fixes: tag as required. > > f8664f3c4a08f799 ("selftests/vm: cow: basic COW tests for non-anonymous pages") Yes, I accidentally copied the wrong information. I will resend a v2  to address these issues. Thank you very much Thanks Best Regards Hao >> Signed-off-by: Hao Ge >> --- >> tools/testing/selftests/mm/cow.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c >> index 32c6ccc2a6be..7a89680d1566 100644 >> --- a/tools/testing/selftests/mm/cow.c >> +++ b/tools/testing/selftests/mm/cow.c >> @@ -1684,7 +1684,7 @@ static void run_with_memfd_hugetlb(non_anon_test_fn fn, const char *desc, >> goto close; >> } >> smem = mmap(NULL, hugetlbsize, PROT_READ, MAP_SHARED, fd, 0); >> - if (mem == MAP_FAILED) { >> + if (smem == MAP_FAILED) { >> ksft_test_result_fail("mmap() failed\n"); >> goto munmap; >> } >> @@ -1696,7 +1696,7 @@ static void run_with_memfd_hugetlb(non_anon_test_fn fn, const char *desc, >> fn(mem, smem, hugetlbsize); >> munmap: >> munmap(mem, hugetlbsize); >> - if (mem != MAP_FAILED) >> + if (smem != MAP_FAILED) >> munmap(smem, hugetlbsize); >> close: >> close(fd);