From nobody Tue May 03 14:04:45 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EE6C21ABA1CC; Tue, 3 May 2022 14:04:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Kt1tQ20zWz3R5W; Tue, 3 May 2022 14:04:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651586686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hC21PJPge65ZU7cuiEXCWJu/wAx0C6MvSCCeiHSLJp0=; b=FTMa3ExKoSlCU1+9kFOAH5Q36Rp8sCiWBrANLX4eB4wV/2sAFJZVTqUDPLnRCCcV3vMjir JfMF8TM25ubjB51RtAqMr88VEnQoUz63UsjXS5TKa/wVyAbjrgDVqF0PO/8QGXnP2SIa+P //VS21To5AZBe3w/fxDVZxxmjrVl/N97ZcajFL/9nrpqVizt9MgZFaKXDpd7ZAZiWQQG2F p67Hr/QnDA1s6hbMtF0ufwoaYZmhujuwDKSQqkU1doZX16X1alCMsitzxt73jtU9ZNzSpO ocWyOht5Wu9ycUChpQiuzTtK+NzdJpYTQjkIjFgKPv8Lfujykf//EBHxLR8rSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FFB91FB16; Tue, 3 May 2022 14:04:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 243E4jDa077953; Tue, 3 May 2022 14:04:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 243E4jHR077952; Tue, 3 May 2022 14:04:45 GMT (envelope-from git) Date: Tue, 3 May 2022 14:04:45 GMT Message-Id: <202205031404.243E4jHR077952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: 3935c58c2157 - stable/13 - Have stpncpy tests ask the kernel for the page size List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3935c58c2157388f973d24495d4187ce4bfbd379 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651586686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hC21PJPge65ZU7cuiEXCWJu/wAx0C6MvSCCeiHSLJp0=; b=NbvmdQEZl3dYvNd3qdT48Eobz2BtOc8gBGpOLUd6WNCuNQOuPSxywPZq67/Lq0M75cOy6i N3CLMCGG/XsVZcMqjnAiY1w63E4VkbOdpOQXUgab+HUthgEBeeOxGTDjIT2SMDLzJRISeW hDbh9poOxMkboYnJtRAa3W8BQZiVQmLv0ssZ0My6UT9rA4bgXVbv0n8frshVOCa3jw5RAx I2be0e4bfR+6NYSpfRK2fnAN+1YAtWY9RfAYhZv4hscaWc7LxEphSBMaesFljBz/IrUoOu 6TmjgXg1TendKyFvFmm/6YkI/KwiC0OKtDXg44d9LkxP4a70SeGTy734VNQ+7A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651586686; a=rsa-sha256; cv=none; b=WVc7Cl3Gxa0tRxFWd9xomFRVvC72yFJyTW/c6lCN5Mk096RmpgM49X8N4Xi865HtxbdQhX +YK+WFAYcMCLYNvxpDiavi5hiJ2G/izxbjzU1y8tvJz2wUwFrUHhBGjJ0yk2/8OLmBZOxe JCqZIruT4Gdn+EEGJl4utxaBJBV1XaD7JlPuAx+ND72tI3t7Sid/HmNLOysbHX2IKm2rtQ bnkPlKT1hAoic2/O4XzDn89GA95jcOUVJqpfkAuA/AQlR2gLt0eXOhtwGKDw74/TgXRj8z jZPzU+yPtXaIyT6qftXpshr3i99YjbkM/yJ/LZDeb864kTu0kvSFI3cV55IJ8g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=3935c58c2157388f973d24495d4187ce4bfbd379 commit 3935c58c2157388f973d24495d4187ce4bfbd379 Author: Andrew Turner AuthorDate: 2022-04-07 15:05:57 +0000 Commit: Andrew Turner CommitDate: 2022-05-03 14:04:04 +0000 Have stpncpy tests ask the kernel for the page size It may be dynamic so we can't rely on PAGE_SIZE being present or correct. (cherry picked from commit 748f7c8db756361f3ba43623612fcfd13cece268) --- lib/libc/tests/string/stpncpy_test.c | 13 ++++++++----- lib/libc/tests/string/wcsnlen_test.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/libc/tests/string/stpncpy_test.c b/lib/libc/tests/string/stpncpy_test.c index 0a7b1d28e9c1..618fa7d0a2ce 100644 --- a/lib/libc/tests/string/stpncpy_test.c +++ b/lib/libc/tests/string/stpncpy_test.c @@ -40,16 +40,19 @@ static char * makebuf(size_t len, int guard_at_end) { char *buf; - size_t alloc_size = roundup2(len, PAGE_SIZE) + PAGE_SIZE; + size_t alloc_size, page_size; + + page_size = getpagesize(); + alloc_size = roundup2(len, page_size) + page_size; buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); assert(buf); if (guard_at_end) { - assert(munmap(buf + alloc_size - PAGE_SIZE, PAGE_SIZE) == 0); - return (buf + alloc_size - PAGE_SIZE - len); + assert(munmap(buf + alloc_size - page_size, page_size) == 0); + return (buf + alloc_size - page_size - len); } else { - assert(munmap(buf, PAGE_SIZE) == 0); - return (buf + PAGE_SIZE); + assert(munmap(buf, page_size) == 0); + return (buf + page_size); } } diff --git a/lib/libc/tests/string/wcsnlen_test.c b/lib/libc/tests/string/wcsnlen_test.c index 07870e3a5ca0..7bcd046de5af 100644 --- a/lib/libc/tests/string/wcsnlen_test.c +++ b/lib/libc/tests/string/wcsnlen_test.c @@ -41,16 +41,19 @@ static void * makebuf(size_t len, int guard_at_end) { char *buf; - size_t alloc_size = roundup2(len, PAGE_SIZE) + PAGE_SIZE; + size_t alloc_size, page_size; + + page_size = getpagesize(); + alloc_size = roundup2(len, page_size) + page_size; buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); ATF_CHECK(buf); if (guard_at_end) { - ATF_CHECK(munmap(buf + alloc_size - PAGE_SIZE, PAGE_SIZE) == 0); - return (buf + alloc_size - PAGE_SIZE - len); + ATF_CHECK(munmap(buf + alloc_size - page_size, page_size) == 0); + return (buf + alloc_size - page_size - len); } else { - ATF_CHECK(munmap(buf, PAGE_SIZE) == 0); - return (buf + PAGE_SIZE); + ATF_CHECK(munmap(buf, page_size) == 0); + return (buf + page_size); } }