From nobody Tue Oct 13 15:55:43 2026 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 4j3zSv3db3z6vZjD for ; Tue, 13 Oct 2026 15:55:43 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j3zSv17Vhz4Rct for ; Tue, 13 Oct 2026 15:55:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791906943; 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=byaGEBY5RrfG+ILtwE89NDahowDviYxF26n/+SebjR8=; b=WgNN3OxYMZGIc25UBbdm+gCeJ//1eX+6xEL1aBnz1bjI3Q30koDQI6FZ61UvCQCiW+CDkm f+agAQyBBGqB9ooGttX4o1xxab50dH8bFLKP/cy1OBBxL383fih90NvNGpHtYuqRn7QTHD TYiMcwLU3Kqgb+32Y6HXyEYHZEGVcdZj5xb/9cZrrmNf2Nh7VKs/h9NJR0Hgyx5Yiu9Uzt mTtdfA0ibqxBews2sMl66HgDx4LnSCQkOcW/wztB1f0By9c6m2ZRAQ49zi1hvPdG0U4PbG hylMWCKl9EAmBkIgZtSXR7GgkNbguj2VUU/8hsJJpB7LSLG54uClxO0fBgrilg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791906943; b=BM+4nKjx2k3cIr/O7shCMSHELZ5Y3g/KZrLN8x/SM7VNXplS6BlM8fBr1tKmb9Tw5O8RZ3 8gG6KxNzvzLUj2Rj/NIdeQxDt05zZjwzIWe36oUd2xgKazfUgfCFPCuOiw4J/cPzuz7/Qg Rnxm17BfrH/pDLRj3J/CBa3Slv5izrb3+usHWS4xSwQRyTZ1utTp0gT6eMeCHGq86+1sZa lz8ZrRm/ueI+45o3/eI2y9V/nlf6iwqBnG+J2pMYnsV+KW+kXsfXs67t+ygz3Uohno0thf qXy4jSpqDiTV5EwxDq3HPJMn8YveSp21c+yf5FoQt5jKoEgdewlC7vPZxCbSOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791906943; 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=byaGEBY5RrfG+ILtwE89NDahowDviYxF26n/+SebjR8=; b=i8TbgPO/f50sHE0QlyVHOi3nnWa7Y1vPdaanQ1ocidn7SpiqySmErGsLKAwRQwTnwkWT1I xT6X7L+njbNN1w86J1j76xE0rbwmEinr8Ww2ZJG11VD/7A7ykXwaDjT/ElPktx9DpVxiZQ G9Kis7ZUA40mGVKpaTPPWUAlcB7D9TR1zGlEiU9oy3Lj/Erie9cvQU5+xt1BFcPLNnTy7v uEiKHa+FMxQD7lWbUqlqDjpdq7sl5K3qxT32gHEb5Tz4Uqsv6CfKz/cGJqgG90muGhJumV PXV9fSWGl0T6QeLa3o0yWbC33OujQ0SQL1109zNKMn+udZaujaSiQk33tRYBnA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j3zSv07QMzLml for ; Tue, 13 Oct 2026 15:55:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 23824 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 13 Oct 2026 15:55:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 3ca4b8dd162a - main - auditdistd: Use fixed-length protocol names List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ca4b8dd162afbecb8de70dc44f525d708726b07 Auto-Submitted: auto-generated Date: Tue, 13 Oct 2026 15:55:43 +0000 Message-Id: <6ace547f.23824.43bc5c00@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=3ca4b8dd162afbecb8de70dc44f525d708726b07 commit 3ca4b8dd162afbecb8de70dc44f525d708726b07 Author: Dag-Erling Smørgrav AuthorDate: 2026-10-13 15:55:27 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-10-13 15:55:40 +0000 auditdistd: Use fixed-length protocol names All communication between auditdistd senders and receivers and internally between auditdistd and its worker children passes through the same pair of send / receive functions. The receive function uses recv(2) with the MSG_WAITALL flag, which in theory means we should never get a short read. However, when handing off a socket to a worker child, we also pass a variable-length string identifying the type of socket we're passing, and reading this string relies on a short read. This used to work because the arrival of the descriptor would interrupt the recv(2) call, but this bug was fixed when the AF_UNIX code was rewritten a while ago and auditdistd has been broken ever since. Fixing the length of the protocol name to four characters including the terminating null solves the short-read bug by never requiring a short read (nothing else in auditdistd requires one). PR: 296107 MFC after: 1 week Reviewed by: js, kevans Differential Revision: https://reviews.freebsd.org/D59565 --- contrib/openbsm/bin/auditdistd/proto.c | 13 ++++--------- contrib/openbsm/bin/auditdistd/proto_impl.h | 2 +- contrib/openbsm/bin/auditdistd/proto_socketpair.c | 2 +- contrib/openbsm/bin/auditdistd/proto_tls.c | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/contrib/openbsm/bin/auditdistd/proto.c b/contrib/openbsm/bin/auditdistd/proto.c index 4e9bea08354b..206c59a5632d 100644 --- a/contrib/openbsm/bin/auditdistd/proto.c +++ b/contrib/openbsm/bin/auditdistd/proto.c @@ -269,7 +269,6 @@ proto_recv(const struct proto_conn *conn, void *data, size_t size) int proto_connection_send(const struct proto_conn *conn, struct proto_conn *mconn) { - const char *protoname; int error, fd; PJDLOG_ASSERT(conn != NULL); @@ -281,11 +280,9 @@ proto_connection_send(const struct proto_conn *conn, struct proto_conn *mconn) PJDLOG_ASSERT(mconn->pc_proto != NULL); fd = proto_descriptor(mconn); PJDLOG_ASSERT(fd >= 0); - protoname = mconn->pc_proto->prt_name; - PJDLOG_ASSERT(protoname != NULL); error = conn->pc_proto->prt_send(conn->pc_ctx, - (const unsigned char *)protoname, strlen(protoname) + 1, fd); + mconn->pc_proto->prt_name, sizeof(mconn->pc_proto->prt_name), fd); proto_close(mconn); if (error != 0) { errno = error; @@ -303,7 +300,7 @@ proto_wrap(const char *protoname, bool client, int fd, int error; TAILQ_FOREACH(proto, &protos, prt_next) { - if (strcmp(proto->prt_name, protoname) == 0) + if (memcmp(proto->prt_name, protoname, sizeof(proto->prt_name)) == 0) break; } if (proto == NULL) { @@ -332,7 +329,7 @@ int proto_connection_recv(const struct proto_conn *conn, bool client, struct proto_conn **newconnp) { - char protoname[128]; + char protoname[sizeof(conn->pc_proto->prt_name)]; int error, fd; PJDLOG_ASSERT(conn != NULL); @@ -341,10 +338,8 @@ proto_connection_recv(const struct proto_conn *conn, bool client, PJDLOG_ASSERT(conn->pc_proto->prt_recv != NULL); PJDLOG_ASSERT(newconnp != NULL); - bzero(protoname, sizeof(protoname)); - error = conn->pc_proto->prt_recv(conn->pc_ctx, - (unsigned char *)protoname, sizeof(protoname) - 1, &fd); + protoname, sizeof(protoname), &fd); if (error != 0) { errno = error; return (-1); diff --git a/contrib/openbsm/bin/auditdistd/proto_impl.h b/contrib/openbsm/bin/auditdistd/proto_impl.h index 7915ee91b528..7b6a273313c9 100644 --- a/contrib/openbsm/bin/auditdistd/proto_impl.h +++ b/contrib/openbsm/bin/auditdistd/proto_impl.h @@ -54,7 +54,7 @@ typedef void prt_close_t(void *); typedef int prt_exec_t(int, char *[]); struct proto { - const char *prt_name; + char prt_name[4]; prt_connect_t *prt_connect; prt_connect_wait_t *prt_connect_wait; prt_server_t *prt_server; diff --git a/contrib/openbsm/bin/auditdistd/proto_socketpair.c b/contrib/openbsm/bin/auditdistd/proto_socketpair.c index fc65c762b088..96fc39ebed57 100644 --- a/contrib/openbsm/bin/auditdistd/proto_socketpair.c +++ b/contrib/openbsm/bin/auditdistd/proto_socketpair.c @@ -247,7 +247,7 @@ sp_close(void *ctx) } static struct proto sp_proto = { - .prt_name = "socketpair", + .prt_name = "skp", .prt_connect = sp_connect, .prt_wrap = sp_wrap, .prt_send = sp_send, diff --git a/contrib/openbsm/bin/auditdistd/proto_tls.c b/contrib/openbsm/bin/auditdistd/proto_tls.c index 4de2bbd9f9fa..3143d72fe513 100644 --- a/contrib/openbsm/bin/auditdistd/proto_tls.c +++ b/contrib/openbsm/bin/auditdistd/proto_tls.c @@ -854,7 +854,7 @@ tls_wrap(int fd, bool client, void **ctxp) if (tlsctx == NULL) return (errno); - if (proto_wrap("socketpair", client, fd, &sock) == -1) { + if (proto_wrap("skp", client, fd, &sock) == -1) { error = errno; free(tlsctx); return (error);