Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp152316lqd; Tue, 23 Apr 2024 19:13:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVck7/AaGKFibxhJC1SsU3kusbE7jw8Sc7xmzrR/aINGhSoaHMQMYK4oAAipG52h/ne8pHWIZn/5aKjypviALTuFDqDCLCfHlw8M6VjqQ== X-Google-Smtp-Source: AGHT+IFZgMZAU73lIncT+fxDIRvWn6Eh4FTvgjPdTH9TJ21OXti71VR05xcX8J0AVN4BkLqJd262 X-Received: by 2002:a05:6358:5b0c:b0:17e:69cf:2105 with SMTP id h12-20020a0563585b0c00b0017e69cf2105mr1117063rwf.29.1713924815595; Tue, 23 Apr 2024 19:13:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713924815; cv=pass; d=google.com; s=arc-20160816; b=VFiliKTRzE8Uqhg+AXi8DnOa8eE07pVq3eRcBW1ofj0B5SUpWF9ro1/Rdko3QjnEf9 IaooKQrc9yVKXb87B1mkAMtHLGex8I86ib9jk3BVx4PBHnAYETFS/3yMMhFDcaS5mm+D X4wi2zTUpTi3lT+EyAgGe5DQl/LWkseLXOI2Oc8yrKh7HhQHRujXZrzc8KN4nHZ0rZD7 MynFwysj1r6A2zy/Irr/MOVQBxxQlrC7jcNNofqIw2mADfzxzv16bIulbnD+0Yp7XzKD FCWRWOa5uhA5LRBJTnnfg7MEyigQ95kbs/i2Btlu7SS7e4xL2fdQobOZvnMrMeWlJDDu c2bA== 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=BlS6nTPidNI6nZWQS0pBt2DANs3HSkzg0mgUkn0QLdM=; fh=/BVtLbFl6Hwn8bf6AJviCWsBIkb+hTsz3ejK2psM9CI=; b=HJYwQjymVZkYEzJL0pXL2BNaAeISGiQWalEYB4O0LjOB+yppekL1FStFU0T+02UrQV 2CfTfqmgBlWsHHZ9I2vl5imQCrJLXdZjkWnj8lH7OIUbDUPVIIO+O3XJKd49OLyoTNoa rifauHuhdOpB7bL2837l+pkCEZbkvkJhLfF7VKaZk3lsb2OYDgF8rNEXSV5ghhenqRdv GKhNcgTlP9AuV56RODQhrcxUjibefZhvT88MMOZ5BGoP3iSdFvmn3dXjrtUEPlQeJakm JnCV78dLL8rT1qGSR+/oiMnSCIB4zcMQLoj6A6dieb1Tm4FrLMYqYXOqZ7oQS1v4v33j 3DvQ==; 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-156125-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156125-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s15-20020a05622a178f00b0043765a24b3dsi14271243qtk.253.2024.04.23.19.13.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 19:13:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156125-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=1wt.eu); spf=pass (google.com: domain of linux-kernel+bounces-156125-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156125-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 51EE01C22383 for ; Wed, 24 Apr 2024 02:13:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A0B712E78; Wed, 24 Apr 2024 02:13:30 +0000 (UTC) Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 826A2125C1; Wed, 24 Apr 2024 02:13:25 +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=1713924809; cv=none; b=qJAKKvux/FeLLpCYJY4cCiqq96eteayw9V00bP9Eh4lMhPEnKCbTV0q5wjqV/BWT90INBYj/jlcF/PSEP3qqISdmAgpGZHnq0IL2oH8J6jtuQ+hk3TP0sS8UYW3UVfSr/s1Bb6wZOZO91rtbouIoaHMY/4+xkztzG0Y4k3jHYtE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713924809; c=relaxed/simple; bh=lUse8f6nu8h1oEGZ9yjkkS7WlVOhsvKS4neUAaFNvl4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=s7GQsNIRSR/46yzKMQichRuyz+5d0FxopCozYGdgPCd2jL8ZbvbrZy76fFwZDamC+5XOH/UP2dljEspXgfH/l80qSIsWCEFr+cobodBrdN8oairC9faZob25RsSh6Y+/3+Db+pypy5LrTTB6RPHL1nRc1wYzZJjdXdEH9U33S8E= 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 43O2DDbW007803; Wed, 24 Apr 2024 04:13:13 +0200 Date: Wed, 24 Apr 2024 04:13:13 +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: <20240424021313.GA7774@1wt.eu> References: <20240424-nolibc-musl-brk-v1-1-b49882dd9a93@weissschuh.net> 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: <20240424-nolibc-musl-brk-v1-1-b49882dd9a93@weissschuh.net> User-Agent: Mutt/1.10.1 (2018-07-13) 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! Willy