From nobody Tue Nov 30 00:13:23 2021 X-Original-To: bugs@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 B40CF18C0CEE for ; Tue, 30 Nov 2021 00:13:23 +0000 (UTC) (envelope-from bugzilla-noreply@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 4J32kC2xLYz4mWX for ; Tue, 30 Nov 2021 00:13:23 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4543E452A for ; Tue, 30 Nov 2021 00:13:23 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 1AU0DNRI074997 for ; Tue, 30 Nov 2021 00:13:23 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1AU0DNu2074996 for bugs@FreeBSD.org; Tue, 30 Nov 2021 00:13:23 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 260126] syslog(3) spins the CPU with 4180 byte messages Date: Tue, 30 Nov 2021 00:13:23 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: asomers@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638231203; 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: in-reply-to:in-reply-to:references:references; bh=6EM65iHQ2vv+6xZ+W/fJ8NwT9IEfoS7R83n1rReima0=; b=isTIfwPinR0FifFHf3u2nD+9tPxLtfnb4M19zTym1GS1DqtE4kJkZaqg01abgZNrvFVPzM HHkqsZFUQC6u4Y71CV6ttrFO/IT0Rn0plnzlxR7eefLNkRrf0oOOzQfYVoxGY1yi/rKDsm va0IbptUh3K2FvXLKE+ZoDTiC8x+K8p8jaY9xuzcvBvVd7KbPETH8wnAYKCxFVYTgZOR4f kf5mwsKBPaB00JD6X8D4ZKUNGu7Wjsdws+CEMtWEL2PfubuD5dac11LkS5guPI+bhbEYSI z81CHJaOc41so2B67/MbEnyFe0MnxDEjaExNbIQB6eMoAVCXz4x/CIcklM5dnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638231203; a=rsa-sha256; cv=none; b=cdl/8y5smUYWjzsoAMdM2gE9B7NoxdQ5m3UX5JAvzjs72xPDEdlwYDAShU2O6kIOhjT/hf Kh5weAOouuoAy0RswPABPqFNVqLKbzLFPUPwSeq896ay8IaWVZdkeQqzNwO6hbcTk5y5rF vu/GWTmrqsrIY/dZyUYUDFtQ5J3Lt18rYvSo0zSRiLHpZskCqNDeohOBhsHkXGKYW695aV yZLy1qkS6jlrGy0/kU56zWEIM3F2J6JQAd2D3E9VpWEj0PgSheLE+n6LlmoQgXgJRTzenN 9TJJ83UXpjfS5+yryKJwQ4tqT3nU7s7nAHqaHdxDg1VRXLVdvvBh7m33jXTuhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260126 Alan Somers changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Open --- Comment #1 from Alan Somers --- So the problem seems to be that: * The default receive buffer size for a unix domain socket is 4 kB * connectlog() sets SO_SNDBUF to 8 kB * BUT, unix domain datagram sockets don't really have a send buffer. Unlike inet sockets, they stay on one host, so everything goes straight to the rec= eive buffer. See uipc_send(); it writes into so2->so_rcv, not so->so_snd. * syslogd sets SO_RCVBUF to 80 kB, which is why nobody noticed the problem there. * rsyslogd uses the default SO_RCVBUF of 4 kB * syslog(3) chops up messages that are longer than MAXLINE. But now MAXLIN= E is 8 kB, and the SO_RCVBUF is only 4 kB. So the chopped up messages are too l= arge for the buffer. * syslog(3) loops while (errno =3D=3D ENOBUFS), which is not appropriate if= the message is too big to ever fit. BUT, it fails fast if the socket is privileged. Many daemons are, so their operators won't notice this bug, bu= t my daemon is not. --=20 You are receiving this mail because: You are the assignee for the bug.=