From nobody Wed Apr 1 22:18:26 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 83F3037AA72 for ; Wed, 1 Apr 2026 15:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775056054; cv=none; b=kMJ8UgyeQLyWxejsoKRO2WrlrfLpxoCq4dFAIhqEYfQLasMr8ih3UmL2MeP7JdpzWcp6i8TD9pt+bbsXHQKqzRFmiYUQGS5P79bVJwTt05Uva72EJlSVXO59ww8F/417/zmya7H2mLq8GEEQgSOCPwc36tmaM0mZbL11MDjt6/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775056054; c=relaxed/simple; bh=fpzsIRMbryf+nK9NF52ngLB8833ix8t2jhIwCD6eTfo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QpThJEnEWiBNk2TxNksMRe70WguCn73TAV+qDqXfUN6UUxnn8zobGIsCeieESN+sh7RLhzjgIm98O7zCRWbpwwDibyyvbOisgTD2iCkOYfzMJXlE1MwU1426+OPGjF0TQFKeNhJSgvSecMAndAU7w6KBaV3rMF1XuO8O+A+KExM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=CqZ856PW; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="CqZ856PW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1775056050; bh=fpzsIRMbryf+nK9NF52ngLB8833ix8t2jhIwCD6eTfo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CqZ856PWKB3hlZZRGRGPIEkeFJ53DDA+YWzcVS+YkjGLdNlpjnsb9YfPx28ys1cop /CwwodAE1Rsp6ik1pu+WbfiGoieyRUlsX2+h2rBN9/eqON9rj7oyxRDDI8pfhnivu5 Jd+IyiVQN7h6L3pFlHszZ59IaWK1RxDX4WPLoc+w= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 01 Apr 2026 17:07:28 +0200 Subject: [PATCH 2/3] selftests/nolibc: test the memory allocator 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260401-nolibc-asprintf-v1-2-46292313439f@weissschuh.net> References: <20260401-nolibc-asprintf-v1-0-46292313439f@weissschuh.net> In-Reply-To: <20260401-nolibc-asprintf-v1-0-46292313439f@weissschuh.net> To: Willy Tarreau Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1775056050; l=1453; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=fpzsIRMbryf+nK9NF52ngLB8833ix8t2jhIwCD6eTfo=; b=lPdWGbEtRNjnmFwczM13yT59bbmyt5sg4NsLKxMQb+OPKyZFVZX/qIH2tm/qG/QbOrzjs9PhO EwgZsxKa5zQBrdb9h8B+pSrJOEaCrgEBi+RdoFqc/uNtPOHyAe+ZDy7 X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The memory allocator has not seen any testing so far. Add a simple testcase for it. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/s= elftests/nolibc/nolibc-test.c index 1efd10152e83..c888e13c6bd8 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1554,6 +1554,30 @@ int test_time_types(void) return 0; } =20 +int test_malloc(void) +{ + void *ptr1, *ptr2, *ptr3; + + ptr1 =3D malloc(100); + if (!ptr1) + return 1; + + ptr2 =3D realloc(ptr1, 200); + if (!ptr2) { + free(ptr1); + return 2; + } + + ptr3 =3D realloc(ptr2, 2 * getpagesize()); + if (!ptr3) { + free(ptr2); + return 3; + } + + free(ptr3); + return 0; +} + int run_stdlib(int min, int max) { int test; @@ -1680,6 +1704,7 @@ int run_stdlib(int min, int max) CASE_TEST(memchr_foobar6_o); EXPECT_STREQ(1, memchr("foobar", 'o'= , 6), "oobar"); break; CASE_TEST(memchr_foobar3_b); EXPECT_STRZR(1, memchr("foobar", 'b'= , 3)); break; CASE_TEST(time_types); EXPECT_ZR(is_nolibc, test_time_types= ()); break; + CASE_TEST(malloc); EXPECT_ZR(1, test_malloc()); break; =20 case __LINE__: return ret; /* must be last */ --=20 2.53.0