Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp717970lqd; Wed, 24 Apr 2024 15:03:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVArZ5V0CzOmLAT5upmty45xQcq50rGy3Jj+HI6hN+Msi3ff1R8m+/Lec/zn+G1uhpW9we88z7/bMEjsXig+JBI8sK/uVRLM1U3fwgDyg== X-Google-Smtp-Source: AGHT+IF+3LZRpeZgO2ki5I+bLLDcNcelL/dSwrB/FdhdiWCMPDmIi7TsI55hnsEsYHszuHurokU5 X-Received: by 2002:a0c:f8c6:0:b0:6a0:585d:a4c6 with SMTP id h6-20020a0cf8c6000000b006a0585da4c6mr3848472qvo.6.1713996179980; Wed, 24 Apr 2024 15:02:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713996179; cv=pass; d=google.com; s=arc-20160816; b=0+nLamMNjocTJni9TZGVwa2nMQj7K6ZrLMKWAbQyJamROptK4Fsst3QDuC3bq0bxe4 2NVPc5XjX8Ixr7ofiRxUoCgoRY4h4peMFdKa6jTtLbPyTaA+igBc5aZQp+OKpu26tZXB HNZ5/dHNBq5WwRmY3eAEm8Dk8u//yw7AuS+oSjXUfgDJV6sKXWJQq5iVOqyhE1voe5it 02dr9YuNx4DS5g3IMpDl5QZZb9vcRCSq5l2Vcj3PDmwE6U4A3O3Fg4SXUCveGJPq/Vjc Dt+xZriO1z0BrSkHRCMcVfT6npH+8J0gWOzI+jVrHT8Ytmmov4orOk+uwaXkBpuUGe8Y NZew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:references:message-id:subject:cc:to:from:date; bh=5cy7R0/IxaotDXv1VGwlwxQZzm8svsDRJHgDMn7SWr4=; fh=/BVtLbFl6Hwn8bf6AJviCWsBIkb+hTsz3ejK2psM9CI=; b=idvAW+9LSy4Y1hFfRQTYOBIAdBmtRRMr4hC4Rxn2NNu28sRGOE4S+Z2hxykbSZGJ6D yZZT/ZdRkPrE5XOptqT/i8UWFVc9bXbpDNFmCoxwGoGrMw0POsnUraL8NCZJHcM2aNnS Fvvxkf5S2F7d4EhfuCXumU7iFZu/RJBiyJIuVJX+a1n9UW0zSwx03btKVhSplK7dN5CM imJuwdb+aQE6W47xxQfR69Pa8GQfhcrWxS816NXso/9KCZOwvj5W9va9CBB/s6BoMRLu rVnDPQQWgb+aVzTGTIOLZTPiyPC9dNqJ5nYhL03DHXmoGpHHZ6bEmnmBz1xcv5foY21o Mk/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=1wt.eu); spf=pass (google.com: domain of linux-kernel+bounces-157761-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157761-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gy9-20020a056214242900b0069b299cf931si15725020qvb.11.2024.04.24.15.02.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 15:02:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157761-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=1wt.eu); spf=pass (google.com: domain of linux-kernel+bounces-157761-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157761-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B459B1C21FBD for ; Wed, 24 Apr 2024 22:02:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26F9415959E; Wed, 24 Apr 2024 22:02:54 +0000 (UTC) Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBFD0157474; Wed, 24 Apr 2024 22:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=163.172.96.212 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713996173; cv=none; b=mXl/a3+0uz1DjaAdW8W7nj3cq7KNwQf+bh5/Cf6XaL6GLkw60Qaz3RIcbZh/wXaKjBjZ+ztyLbJQhquC8Oaz2b5BNkx6NN0BsE4usbKiDP5nmnIqsdzwCkf2WeqVxvUgOYywQHjJpnR08Z54/tshSlQENv52k5I+7pMWA/pgpl8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713996173; c=relaxed/simple; bh=889DZ02S6SUVQkUhisDCWyheeMIzXijzcmfyta4BrzA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XxnUdwm19JGgbGrTE2dw4jAPlfrV/m8zAn1bx3ZtlBHLPNu5W6vka8h6Uka7fjq2Bq/X5R4XXYNlKuM/SsAGDKGbAZhgWEQrP5WFAHBRh1MLhBHnfdjrWFTgxI4QzDUK+EPI0Pz2PbMQKWhO7RLXeaQf1GJYce93JAGdO6Ek2Ac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; arc=none smtp.client-ip=163.172.96.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 43OM2bnN010288; Thu, 25 Apr 2024 00:02:37 +0200 Date: Thu, 25 Apr 2024 00:02:37 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] selftests/nolibc: disable brk()/sbrk() tests on musl Message-ID: <20240424220237.GA10281@1wt.eu> References: <20240424-nolibc-musl-brk-v1-1-b49882dd9a93@weissschuh.net> <20240424021313.GA7774@1wt.eu> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240424021313.GA7774@1wt.eu> User-Agent: Mutt/1.10.1 (2018-07-13) On Wed, Apr 24, 2024 at 04:13:13AM +0200, Willy Tarreau wrote: > On Wed, Apr 24, 2024 at 12:15:33AM +0200, Thomas Wei?schuh wrote: > > On musl calls to brk() and sbrk() always fail with ENOMEM. > > Detect this and skip the tests on musl. > > > > Tested on glibc 2.39 and musl 1.2.5 in addition to nolibc. > > > > Signed-off-by: Thomas Wei?schuh > > --- > > tools/testing/selftests/nolibc/nolibc-test.c | 10 +++++++--- > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > > index 94bb6e11c16f..89be9ba95179 100644 > > --- a/tools/testing/selftests/nolibc/nolibc-test.c > > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > > @@ -942,6 +942,7 @@ int run_syscall(int min, int max) > > int ret = 0; > > void *p1, *p2; > > int has_gettid = 1; > > + int has_brk; > > > > /* indicates whether or not /proc is mounted */ > > proc = stat("/proc", &stat_buf) == 0; > > @@ -954,6 +955,9 @@ int run_syscall(int min, int max) > > has_gettid = __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 30); > > #endif > > > > + /* on musl setting brk()/sbrk() always fails */ > > + has_brk = brk(0) == 0; > > + > > for (test = min; test >= 0 && test <= max; test++) { > > int llen = 0; /* line length */ > > > > @@ -969,9 +973,9 @@ int run_syscall(int min, int max) > > CASE_TEST(kill_0); EXPECT_SYSZR(1, kill(getpid(), 0)); break; > > CASE_TEST(kill_CONT); EXPECT_SYSZR(1, kill(getpid(), 0)); break; > > CASE_TEST(kill_BADPID); EXPECT_SYSER(1, kill(INT_MAX, 0), -1, ESRCH); break; > > - CASE_TEST(sbrk_0); EXPECT_PTRNE(1, sbrk(0), (void *)-1); break; > > - CASE_TEST(sbrk); if ((p1 = p2 = sbrk(4096)) != (void *)-1) p2 = sbrk(-4096); EXPECT_SYSZR(1, (p2 == (void *)-1) || p2 == p1); break; > > - CASE_TEST(brk); EXPECT_SYSZR(1, brk(sbrk(0))); break; > > + CASE_TEST(sbrk_0); EXPECT_PTRNE(has_brk, sbrk(0), (void *)-1); break; > > + CASE_TEST(sbrk); if ((p1 = p2 = sbrk(4096)) != (void *)-1) p2 = sbrk(-4096); EXPECT_SYSZR(has_brk, (p2 == (void *)-1) || p2 == p1); break; > > + CASE_TEST(brk); EXPECT_SYSZR(has_brk, brk(sbrk(0))); break; > > CASE_TEST(chdir_root); EXPECT_SYSZR(1, chdir("/")); chdir(getenv("PWD")); break; > > CASE_TEST(chdir_dot); EXPECT_SYSZR(1, chdir(".")); break; > > CASE_TEST(chdir_blah); EXPECT_SYSER(1, chdir("/blah"), -1, ENOENT); break; > > Looks good, thank you Thomas! BTW, Acked-by: Willy Tarreau Willy