From nobody Thu Aug 15 19:34:22 2024 X-Original-To: dev-commits-src-main@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 4WlFgM1Ltbz5SkXf; Thu, 15 Aug 2024 19:34:23 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WlFgL6rsWz4vd6; Thu, 15 Aug 2024 19:34:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723750463; 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=yFqh7ibcdH5NH+bFiTgTp/thJkIGQ+4MGMzDYxzMM9I=; b=A6Qs1wu5udY/QNX+yaGjJEyGlOMEjOlt+V0tVXg3zhFRiQrNKI6wEPc6ByiIO+0IvVmbvL TIayPydMgexzXn394V5RsXhQfPi7S2aqI1q2+8RArWpRA1BJIIJZOzVh1GPQIriEMmHsn7 5vBz97P8OtAB+QOW3xnkdpmkdQraOoLhF2OExMoLTKVi71uSs4R8mXwbcX5IpF4qlB8N/G DTboY44gf/3l+L7XyOTs6BvvdseprQUW6efEt1hGRVwpaX+6NyRanHUzr1g+cclCkN7sj6 +n4bxjji5fKBXpe+BAWESnQ4P4eqp8TqPF2WELO+yLqKrZLC6MLVxnsnmzcvhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723750463; a=rsa-sha256; cv=none; b=T/c2S4QLzYlix0Le1t+UMy21dtl1R1IZk2EmzE9H+4AvGeJddADssQJ2Fd55a0jalOmkKX tnAdDdgUExXCwvKWzJDR41CM1IWkNC2vVUHIcDj4+Ac/LEl+779Tj3phqY4YODtguLwxQV cmATiE3fX6YLxbJPDNVY4I2pCTNhGm0t2HtvACfz0Bf1/Xv1nSVDd2qx7k0KjfGsWwUCrU dEJd8aCekmwgfknZ5jwaqoSNk9yhPEMK4HF2dHcd7kB7JqwXD/lzyf49r2om5nLc3SCG3G K2bEleACqW7RCSguGlcs63SIzFMLpHHRuWJsT/cBq700VHiMDfMNu8RQrliU8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723750463; 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=yFqh7ibcdH5NH+bFiTgTp/thJkIGQ+4MGMzDYxzMM9I=; b=UBPvy4ENyUOZ4kFlJZMrG7fRoYFdPKAcgoNR6cZtjU2d9zGKEjIA2NjZ1FPWqFfQXJC6b3 QQwjJ3+1tWukE6cEcDqYDUuCNmTu+drdU119+75x7VUYNaJrwjsohmwB0ikqHe0M7GFyaf 4Mu00VJgZ5cFj7wvBT1aTW/7sBigT5pu10L7bwTtdC+V2GLZXLkMz18w+KwvGfNMcH2O4Z Bsu7f8HKvKDhU5idDumVaYhWHf9Ec7VG0C+yNOrWPeRkxkoEDJSsmO3iMmXfFsKWTIssOV XGJwi44HAajVT5RJsp7oxd/OJm/uWBYx08Fby+2k2OyE9EnFYZ9ApYA77nlnAw== 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 4WlFgL6T4fzc24; Thu, 15 Aug 2024 19:34:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47FJYMla042676; Thu, 15 Aug 2024 19:34:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47FJYMuR042673; Thu, 15 Aug 2024 19:34:22 GMT (envelope-from git) Date: Thu, 15 Aug 2024 19:34:22 GMT Message-Id: <202408151934.47FJYMuR042673@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 3cded0592208 - main - tmpfs: Fix OOB write when setting vfs.tmpfs.memory_percent List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3cded0592208b465761af6db5b7b7c21cb5b28c3 Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=3cded0592208b465761af6db5b7b7c21cb5b28c3 commit 3cded0592208b465761af6db5b7b7c21cb5b28c3 Author: Jessica Clarke AuthorDate: 2024-08-15 19:33:22 +0000 Commit: Jessica Clarke CommitDate: 2024-08-15 19:33:22 +0000 tmpfs: Fix OOB write when setting vfs.tmpfs.memory_percent tmpfs_mem_percent is an int not a long, so on a 64-bit system this writes 4 bytes past the end of the variable. The read above is correct, so this was likely a copy paste error from sysctl_mem_reserved. Found by: CHERI Fixes: 636592343c3e ("tmpfs: increase memory reserve to a percent of available memory + swap") --- sys/fs/tmpfs/tmpfs_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 3f74c383a171..a5eb865f2996 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -428,7 +428,7 @@ sysctl_mem_percent(SYSCTL_HANDLER_ARGS) if ((unsigned) percent > 100) return (EINVAL); - *(long *)arg1 = percent; + *(int *)arg1 = percent; tmpfs_set_reserve_from_percent(); return (0); }