From nobody Wed Jan 01 20:24:41 2025 X-Original-To: dev-commits-src-main@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 4YNhCF5YmJz5j96m; Wed, 01 Jan 2025 20:24:41 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YNhCF3KbPz4gfy; Wed, 1 Jan 2025 20:24:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735763081; 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=QGDThNI06O74hBUfeJ3mprNl22LLkV2NEIsH7EVlTGw=; b=pZxuIAqnpY9o3tiEu2LAtvjt7BNV03SV3Xa+uGkhhQya2hN652n/hC4rRLrGuRmYcDT+RI oEeAPJF8h0vJeeBXSku5YIA595GIvpS20kEzzuPpGxX+zySfYSxaing4iIXTkCjn0V/mI1 ZSLk2/Dk+L06x1ov+ipHKtgbbKpR+7Kex8b2e5UsWbKKnUX9rANaEgPRZCeiLf0vop2gOS YF3ZG/Oc6ezOBTx3jnwmbmX1RESGdM+J2Q52B8BJxk1ev5+/Iits6bV0ISaqMZWH+cq6SL dVqKWq3c3bDUMmKiqHNocsIjTC3LVS+w8sFiyUk6NjwqhPwmIdvHm/mmzmKS8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735763081; 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=QGDThNI06O74hBUfeJ3mprNl22LLkV2NEIsH7EVlTGw=; b=fjNdmuRbLpU5r/QdLhasFDyu8Hp4cwyVB7rTs38j5SSXpbWEYZB1isBiPpPYsJXxqcpeUk 9+MtVX7AZIdtXWgKy5CKajGv9x1PZD7n6ya3YkJpP6vlAu0BqwYwhNh04i4QRzULAYb1f7 vRVk6/WcUOgIHtaUAY0v8wkNevrqjzlCeZIbkyrfp67cHkbRCZ9yVi9SHSsDKcG5xeZp65 y3c3xcYf7ASdETzVN5AzaY7nP1tFGjsprqo+ueW4HNAgYMMaxxdACmv/O06iEtO5bT3MTZ WD+SOKyXLhcysrbzvrndvTcf7YMqDdDsPP5ioehbKPn7m2AQOuk5/UzT0z5N7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735763081; a=rsa-sha256; cv=none; b=IeoZ+5jzk8OJIgbfVbnMn2RWVpMZc6Sv4RGVYeH5F6DdxYa7622Wi16JH6DzmU4zWfIJop uOsC5nBaSkn/JlJBB7LOhSBL9lT9Z4DkW4Tl5DpkTieQTL16qzWK3PKrpJ/NGE8nUKMSLO QxCVEjw8mW0tw6UM80VLE0SKnZ+fff/8r1l+2I8S34o2m0MXQ+EzNNrpiX4SLOBYBK+Iha G8yxyIgamyCkdfKUHJuPo595+3VNgBatKp+mAhHAJRLBnJ7XcKEMlXAR9mYEKitx77vu4M 6IvysI7O4zSW1KwOsuRJIUZR78qSZX3CDLnZF+V64963LBXRdt5cRMRuh3Vxww== 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 4YNhCF2d94zfgd; Wed, 1 Jan 2025 20:24:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 501KOfHg090366; Wed, 1 Jan 2025 20:24:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 501KOfOq090363; Wed, 1 Jan 2025 20:24:41 GMT (envelope-from git) Date: Wed, 1 Jan 2025 20:24:41 GMT Message-Id: <202501012024.501KOfOq090363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: d11904b35021 - main - Fix lib/libc/nss/getgr_test with large numbers of groups List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d11904b350214943dedb64c7121d4602799d7afd Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=d11904b350214943dedb64c7121d4602799d7afd commit d11904b350214943dedb64c7121d4602799d7afd Author: Alan Somers AuthorDate: 2024-12-31 20:41:01 +0000 Commit: Alan Somers CommitDate: 2025-01-01 20:23:47 +0000 Fix lib/libc/nss/getgr_test with large numbers of groups These tests create a linked list with one entry for every group on the running system. On a system with about 30,000 groups, the test took 69 seconds to run, and crashed Kyua with the below error: kyua: E: string or blob too big (sqlite op: sqlite3_bind_blob) (sqlite db: /root/.kyua/store/results.usr_tests.20241231-203317-570235.db). Fix the test by limiting it to operating on the first 1024 groups. Apply the same change to getpw_test and getserv_test too, which are vulnerable to the same problem. MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D48275 --- lib/libc/tests/nss/getgr_test.c | 4 ++++ lib/libc/tests/nss/getpw_test.c | 4 ++++ lib/libc/tests/nss/getserv_test.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/lib/libc/tests/nss/getgr_test.c b/lib/libc/tests/nss/getgr_test.c index 7c0e265fa6f6..974632d4b7c7 100644 --- a/lib/libc/tests/nss/getgr_test.c +++ b/lib/libc/tests/nss/getgr_test.c @@ -293,6 +293,8 @@ group_fill_test_data(struct group_test_data *td, int (*cb)(struct group *, void *)) { struct group *grp; + const int limit = 1024; + int count = 0; setgroupent(1); while ((grp = getgrent()) != NULL) { @@ -303,6 +305,8 @@ group_fill_test_data(struct group_test_data *td, } else { return (-1); } + if (++count >= limit) + break; } endgrent(); diff --git a/lib/libc/tests/nss/getpw_test.c b/lib/libc/tests/nss/getpw_test.c index 3a44497cf848..434d86a31591 100644 --- a/lib/libc/tests/nss/getpw_test.c +++ b/lib/libc/tests/nss/getpw_test.c @@ -240,6 +240,8 @@ passwd_fill_test_data(struct passwd_test_data *td, int (*cb)(struct passwd *, void *)) { struct passwd *pwd; + const int limit = 1024; + int count = 0; setpassent(1); while ((pwd = getpwent()) != NULL) { @@ -250,6 +252,8 @@ passwd_fill_test_data(struct passwd_test_data *td, } else { return (-1); } + if (++count >= limit) + break; } endpwent(); diff --git a/lib/libc/tests/nss/getserv_test.c b/lib/libc/tests/nss/getserv_test.c index 486a8c20836f..cc66fdb2fa52 100644 --- a/lib/libc/tests/nss/getserv_test.c +++ b/lib/libc/tests/nss/getserv_test.c @@ -283,6 +283,8 @@ static int servent_fill_test_data(struct servent_test_data *td) { struct servent *serv; + const int limit = 1024; + int count = 0; setservent(1); while ((serv = getservent()) != NULL) { @@ -290,6 +292,8 @@ servent_fill_test_data(struct servent_test_data *td) TEST_DATA_APPEND(servent, td, serv); else return (-1); + if (++count >= limit) + break; } endservent();