From nobody Sun Apr 5 13:12:13 2026 Received: from cae.in-ulm.de (cae.in-ulm.de [217.10.14.231]) (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 80A6F322B83 for ; Fri, 20 Feb 2026 09:39:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.14.231 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771580356; cv=none; b=drqzulzwWVJAAcuc5yOV14N4J6Fo7NKJ55qq34UkrSEYa3djUz5yaeiU+lC4JID5lcIBEGHcN47TsW495TjwO2KuJWPwt6cfeOB6eDqWKJPst1CUFyiicmAOlYeYrNHXx/01vRa2DkVKmsa1nb+hZ4pBlIP/a6pfIv/+IOegkq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771580356; c=relaxed/simple; bh=KlY77azg9o+WZ+GKHUdq9L/EZqwqFwaLSd+pxziXBQI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HnN/e/ev9lyxwYwI37chOQzlb22ig3rGvFjvGCv/3v8miliRx2rZlGTvCpmR92ri6aesaKa/rPvsmPpe4tEndkbke0/JwV2PNRrEYbrzKKfZj69p47poDRl9WB86ir4QJ+50LQxUeziwCOLDqk5Fo74k/TcIWecP9VHvQNPW/Gk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de; spf=pass smtp.mailfrom=c--e.de; arc=none smtp.client-ip=217.10.14.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=c--e.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=c--e.de Received: by cae.in-ulm.de (Postfix, from userid 1000) id CD460140028; Fri, 20 Feb 2026 10:39:12 +0100 (CET) From: "Christian A. Ehrhardt" To: linux-kernel@vger.kernel.org, Andrew Morton Cc: "Christian A. Ehrhardt" , David Howells , Kees Cook , Petr Mladek , David Gow Subject: [PATCH 1/3] lib: kunit_iov_iter: Improve error detection Date: Fri, 20 Feb 2026 10:38:35 +0100 Message-Id: <20260220093837.688841-2-lk@c--e.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260220093837.688841-1-lk@c--e.de> References: <20260220093837.688841-1-lk@c--e.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In the kunit_iov_iter test prevent the kernel buffer from being a single physically contiguous region. Additionally, make sure that the test pattern written to a page in the buffer depends on the offset of the page within the buffer. Cc: David Howells Cc: Andrew Morton Signed-off-by: Christian A. Ehrhardt --- lib/tests/kunit_iov_iter.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/tests/kunit_iov_iter.c b/lib/tests/kunit_iov_iter.c index 48342736d016..c32fbdbb2544 100644 --- a/lib/tests/kunit_iov_iter.c +++ b/lib/tests/kunit_iov_iter.c @@ -13,6 +13,7 @@ #include #include #include +#include #include =20 MODULE_DESCRIPTION("iov_iter testing"); @@ -37,7 +38,7 @@ static const struct kvec_test_range kvec_test_ranges[] = =3D { =20 static inline u8 pattern(unsigned long x) { - return x & 0xff; + return (u8)x + (u8)(x >> 8) + (u8)(x >> 16); } =20 static void iov_kunit_unmap(void *data) @@ -52,6 +53,7 @@ static void *__init iov_kunit_create_buffer(struct kunit = *test, struct page **pages; unsigned long got; void *buffer; + unsigned int i; =20 pages =3D kunit_kcalloc(test, npages, sizeof(struct page *), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pages); @@ -62,6 +64,9 @@ static void *__init iov_kunit_create_buffer(struct kunit = *test, release_pages(pages, got); KUNIT_ASSERT_EQ(test, got, npages); } + /* Make sure that we don't get a physically contiguous buffer. */ + for (i =3D 0; i < npages / 4; ++i) + swap(pages[i], pages[i + npages/2]); =20 buffer =3D vmap(pages, npages, VM_MAP | VM_MAP_PUT_PAGES, PAGE_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buffer); --=20 2.43.0