From nobody Sun Jan 16 22:15:30 2022 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 08C51195EBBA for ; Sun, 16 Jan 2022 22:15:31 +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 4JcTr266zcz4rGn for ; Sun, 16 Jan 2022 22:15:30 +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 AFB0A22427 for ; Sun, 16 Jan 2022 22:15:30 +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 20GMFUGg082766 for ; Sun, 16 Jan 2022 22:15:30 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 20GMFUJW082765 for bugs@FreeBSD.org; Sun, 16 Jan 2022 22:15:30 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 240573] sysctl() does not return ENOMEM but silently truncate returned data Date: Sun, 16 Jan 2022 22:15:30 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: markj@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=1642371330; 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=t+dga9PoQEdv9Z4iZe5/El+Bx4pbknz2TtcEjNq89Uc=; b=nLtcrw8dWcFfp9Stqw6xPn746ebLXGUMjIw4RMuk9hnxGxViEX41/jxBmO/3nfP3jDkOm+ wXTvdHI8IxI6JewEvhsQ+of/tcmDXuXvBQpDDjLTtV72z+HfoGlq9NdWMQylEA3EA+Lb9a 3mBV6OATEoAmlozFdCn7HWiFdDxj5sKmIRO31do8nHxorABmH5CisJQBS32S6YTdhp/H0D DWVGM0HiKIslP7eXfpHY6UD3/eZIGa8fUqAscz5JMadseSUqN7p6KISHP+MAUvcMh8H29M +eNV+cmF22j0W2MUG7XwegoGNEWmoNAQoKMcnlFGZ4Qt1NsJMmwW5WZrmAzjEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642371330; a=rsa-sha256; cv=none; b=TKCTDSExU6rIiiu9WxtJgE8AGS/wYZfyKIUoOD3O3HoC1X3pJaa2s8Gd4bjZWvGznZLddf BneD07vEubUKFI91PnFdHtwR7gDzf/UVls0oyizBqXVWs+5VEaEyMzMgoJt7ty6o3W1lMK WJZxJ8QO1MGphWv5QrXJ5JCHSdCtrIxzrqMu3TgSVFgYZLnCeWaSm0gR7h9cQXEAPiT2P2 qDO6Bl9Yxz/cJjTgce7mVrIZBUCLxOQfn6E43OAz7J/bmR/1jG51DiAFmfgtbB4dlwCoDL 7BE6rsfqRIepr/8qV+rBNIYlULCLXrBfh3m6seF01auJXY1tzW+pMgVf7r7r1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240573 Mark Johnston changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Open --- Comment #2 from Mark Johnston --- For kern_proc_vmmap_out(), we have: /* Halt filling and truncate rather than exceeding maxlen */ if (maxlen !=3D -1 && maxlen < kve->kve_structsize) { error =3D 0; vm_map_lock_read(map); break; } else if (maxlen !=3D -1) maxlen -=3D kve->kve_structsize; if (sbuf_bcat(sb, kve, kve->kve_structsize) !=3D 0) error =3D ENOMEM; Note that when filling out info for the KERN_PROC_VMMAP sysctl, we have max= len =3D=3D -1. So we just end up calling sbuf_bcat(), which will indeed return= an error if the output buffer is too small. I think there is no bug there. I think you are right about sysctl_posix_shm_list(), we should return an er= ror if req->oldptr is non-NULL and the buffer is truncated. I believe it would= be sufficient to just remove the referenced check, sbuf_bcat() will signal an error. --=20 You are receiving this mail because: You are the assignee for the bug.=