From nobody Wed Feb 1 23:50:44 2023 X-Original-To: dev-commits-src-branches@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 4P6dw46JP6z3cNhJ; Wed, 1 Feb 2023 23:50:44 +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 4P6dw45kSTz3RGf; Wed, 1 Feb 2023 23:50:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675295444; 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=N/bl5rWmVk0J/33Qsg0CL0OdK3yWAmZRlx0F785clNY=; b=siCQ+YHc8ST4wSLOy6ZRjFDOTfUN/KaHh6Eri04UupZ49R6uzDOQRhvSn77Jza3tBPWjeT pQAhkRNpM1HVd+eQi9jkmA3tFp0Blm6lu6J282NAg0lp1p2+vE8zKvEUyirRL78rFfd9SK gmGG9L3JGKUYT5JMXXNbEiP+nnD4NxCBMvKpH1VDT1QEbS0uiFvN4TfOLMYTvzORm5pGBd sGh0pB7f1m0hC6fFJ82bx+ETOb2kF4kofde1X850Zoq/SWtBOLDHsFvKkiNd88MFMNvWJR 3RlnNuUvpUwPjLPz78hG9IgLbSGBkgPzAVfQSKb1krzCkTv/jZcM9V8eaQhJWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675295444; 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=N/bl5rWmVk0J/33Qsg0CL0OdK3yWAmZRlx0F785clNY=; b=qpJY5YvEAOoVCCpOvrbwzMiakJHRpJ9zC9W6+TiEB6wvnBVOvLgLxjTwVGLF7i3DwH8syU pMmUE1N967dGCO+KbfDoPwJA8ph34sFIOQITC6UifU6OAORb0kQcifl5NdwzZxLbK61tJm h3zM/jCU3CX2kreGwLhITUWMLVrgoMAM3rLuiW/Qq+B9Y2ax+OEXPlHSAaU3tZ7bC5Gp6f HwQwBjYyKoV/WyKz/nofBPECWjWPELEpi4K5P64bwHx35yA0EgdoUi+bGYUb162KqXM0d7 XBzppoZwWDoeDVpI9YznmAIAQOqq+C25FGR/uhtxP1G2/iVQx1rGnQAocHCu2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675295444; a=rsa-sha256; cv=none; b=YyB/F8q0a24Spq+97P3MqsCZNc2ggCZiN9+/Nhaal4gp6C2PXmgamjUo52LDZeqIExwJFR P1Z7F3CN0Sm2N2ZNIX4wJ6rU/y5Ovbc+WrZJW3hN+RiuSsD/XLluASkPJ7S3MW2TW2mCqx rN27PvtR5CWQONs7ISZQ2y6o+uchp1SP+nMQcO87VBw3qKJTeEut+a3K4xwd+7xok3vEaJ IMP4dw9CRbCfXk8uKt0BXHrefUwJek2T0rfhgnaZGmUv2NoRq4JDL/FglgleCsZCm0xlVH U1TCppDtCpUQGhGa/AItpfev0FcX9kGVnz57z/hXkEZQbZJzaFAIXFs0/iZ5Tg== 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 4P6dw44nVpzYQs; Wed, 1 Feb 2023 23:50:44 +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 311NoiPS099642; Wed, 1 Feb 2023 23:50:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311Noill099641; Wed, 1 Feb 2023 23:50:44 GMT (envelope-from git) Date: Wed, 1 Feb 2023 23:50:44 GMT Message-Id: <202302012350.311Noill099641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 0c38bb448caa - stable/13 - traceroute6: fix capabilities for the rcv socket List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c38bb448caa426b7f238853d7841219819024be Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0c38bb448caa426b7f238853d7841219819024be commit 0c38bb448caa426b7f238853d7841219819024be Author: Michael Tuexen AuthorDate: 2022-10-04 21:34:58 +0000 Commit: Michael Tuexen CommitDate: 2023-02-01 23:49:35 +0000 traceroute6: fix capabilities for the rcv socket On the receive socket, recvmsg() and poll()/select() is called. Therefore, CAP_EVENT is needed in addition to CAP_RECV. While there, check the socket for readbility before calling recvmsg(). Reviewed by: markj@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D36878 (cherry picked from commit 8ff4fc03e6933dd69f99a8f34f2aa0760300f248) --- usr.sbin/traceroute6/traceroute6.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index a071c084ad07..d887acf5ae53 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -937,7 +937,7 @@ main(int argc, char *argv[]) strerror(errno)); exit(1); } - cap_rights_init(&rights, CAP_RECV); + cap_rights_init(&rights, CAP_RECV, CAP_EVENT); if (caph_rights_limit(rcvsock, &rights) < 0) { fprintf(stderr, "caph_rights_limit rcvsock: %s\n", strerror(errno)); @@ -1039,7 +1039,8 @@ wait_for_reply(int sock, struct msghdr *mhdr) pfd[0].events = POLLIN; pfd[0].revents = 0; - if (poll(pfd, 1, waittime * 1000) > 0) + if (poll(pfd, 1, waittime * 1000) > 0 && + pfd[0].revents & POLLIN) cc = recvmsg(rcvsock, mhdr, 0); return (cc);