From nobody Sun Jan 16 06:49:14 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 69D46194F412; Sun, 16 Jan 2022 06:49:14 +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 4Jc5HG2W8Rz52MJ; Sun, 16 Jan 2022 06:49:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642315754; 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=uLs4vldnFTj37d2nB5FE0qZ9k5G4Va9mFSHKpMUK4z8=; b=Xfi+zqTl72KnsO2DDImaT5F/fgqrdeA88A4rkviYzCizMCuf6hV6z59xmOvX5HIOEhZ0TZ vukWebkuo+ooIzYsLsGm8RLGjyvRd2eAjDNgWKDI7oHNCK3jZzu8/VjptOrHkwt9W9kMfN YMAEfGJ5ki0YuRSrVePoM16xmL/e2ozMlxcjeoHeBmy19IwowP+asFn7qb5tVo1qKzEnZK ZB+mV3ksIEsXz23mcgQR9/uKdDsQ/42yVQOVCU5pDcl3NVVB/utg+OtS/NzMs1Ez0Lswa6 1Iz31t5fQb5sGh7SjQ9Yo/o2lbN+1ySlGjeu9iAUFvNc7Dm+/daTwN29C/DQdg== 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 2BA9C15F92; Sun, 16 Jan 2022 06:49:14 +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 20G6nEkH021891; Sun, 16 Jan 2022 06:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20G6nELC021890; Sun, 16 Jan 2022 06:49:14 GMT (envelope-from git) Date: Sun, 16 Jan 2022 06:49:14 GMT Message-Id: <202201160649.20G6nELC021890@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 90c5fd4875df - main - stress2: Added a regression test 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: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90c5fd4875df4e46b455746768d6b67aca64b337 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642315754; 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=uLs4vldnFTj37d2nB5FE0qZ9k5G4Va9mFSHKpMUK4z8=; b=Iv+EXYK+WNpQBTHHQVf9vSiO71S9x+4YVolcvuwcRXV/D7XNPp/X1dpiAeq0sOLFDZ33Mo zDrui9Z5yFAkyKa7UD+0y0G6Ec4fqv5sWe4xMrAg4rCTcPbP9Fgb9cWIzaBSMTQG8Je04q ulHikUldhpuwnQCNN6QixjNldle+eSCmc/Gi8Yt/0p07DjAFiXo8ns4Fb5BBdlthDbol7L EdfGdAlZPVuigBFZb585kn+RLrGrS0A779BuvsqBL05g/5kRD2mfck6rRl++kN0IcLKxlH KBb3rMc0e+gtsG1w4Sp/S1SW0V/rkxilmzq3uKajk/isUcuITfmkVyivrtbnIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642315754; a=rsa-sha256; cv=none; b=CiNCXOqvOc78Sb8HEzG7lqcineF5YTKMKt4DUgWd1ANvjob20leNjnYGLfKHyEDA+GWz8Y 78xBZk43SPujFPGNEHZ6fZ5Lu/LyQKLVic9OM8QpQnzgxSf8aHb0oHs5mlygGJYvLQb+B+ xqguXAk2WDbMNPH0cYwGdzbOF8uTdfXT/xDXNJbiJd6+9fnx5OdaeWbE9i/WvGV1HlF7OR c6ptUP7AIK40+tiTW41p5ZHVYmkTSEI/yxDBh2mzyGEOTZz759nV/iO/Me/+l36nsx6Wkh kD5OgSHX+WTW/inT9LnOIUoGin1l490WOfuryU+3jstVB6ETNYjDMk/OlPi+Vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=90c5fd4875df4e46b455746768d6b67aca64b337 commit 90c5fd4875df4e46b455746768d6b67aca64b337 Author: Peter Holm AuthorDate: 2022-01-16 06:48:55 +0000 Commit: Peter Holm CommitDate: 2022-01-16 06:48:55 +0000 stress2: Added a regression test --- tools/test/stress2/misc/kevent16.sh | 92 +++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tools/test/stress2/misc/kevent16.sh b/tools/test/stress2/misc/kevent16.sh new file mode 100755 index 000000000000..23dd222821da --- /dev/null +++ b/tools/test/stress2/misc/kevent16.sh @@ -0,0 +1,92 @@ +#!/bin/sh + +# Bug 258310 - kevent() does not see signal with zero timeout +# Test scenario copied from the bug report. + +# Fixed by: 98168a6e6c12 - main - kqueue: drain kqueue taskqueue if syscall tickled it + +cat > /tmp/kevent16.c < + +#include + +#include +#include +#include +#include + +#include +#include + +int +main(void) +{ + long l; + int rv; + + sigset_t set; + rv = sigemptyset(&set); + assert(rv == 0); + rv = sigaddset(&set, SIGUSR1); + assert(rv == 0); + + rv = sigprocmask(SIG_BLOCK, &set, NULL); + assert(rv == 0); + + int skq = kqueue(); + assert(skq >= 0); + + struct kevent kev; + EV_SET(&kev, SIGUSR1, EVFILT_SIGNAL, EV_ADD, 0, 0, 0); + rv = kevent(skq, &kev, 1, NULL, 0, NULL); + assert(rv == 0); + + int kq = kqueue(); + assert(kq >= 0); + + EV_SET(&kev, skq, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); + rv = kevent(kq, &kev, 1, NULL, 0, NULL); + assert(rv == 0); + + for (l = 0; l < 1000000; l++) { + rv = kill(getpid(), SIGUSR1); + assert(rv == 0); + + /* Turn this into `#if 1` to avoid the race. */ +#if 0 + rv = kevent(kq, NULL, 0, &kev, 1, NULL); +#else + rv = kevent(kq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); +#endif + assert(rv == 1); + rv = kevent(kq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); + assert(rv == 0); + + rv = kevent(skq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); + assert(rv == 1); + rv = kevent(skq, NULL, 0, &kev, 1, &(struct timespec) { 0, 0 }); + assert(rv == 0); + + siginfo_t siginfo; + + rv = sigtimedwait(&set, &siginfo, &(struct timespec) { 0, 0 }); + assert(rv == SIGUSR1); + + rv = sigtimedwait(&set, &siginfo, &(struct timespec) { 0, 0 }); + assert(rv < 0); + assert(errno == EAGAIN); + } +} +EOF +cc -o /tmp/kevent16 -Wall -Wextra -O2 /tmp/kevent16.c || exit 1 + +/tmp/kevent16; s=$? + +rm -f /tmp/kevent16.c kevent16 kevent16.core +exit $s