From nobody Thu Jan 11 14:35:22 2024 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 4T9nJV4Rkcz568GL; Thu, 11 Jan 2024 14:35:22 +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 4T9nJV3BKMz4XTj; Thu, 11 Jan 2024 14:35:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704983722; 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=wVyuePKJ5c863FgjweH7zHl2Yj7jFKIXS3ypNTvyou4=; b=REfcqTsAOBtjy4ivpE6mU6Fmd8a3ZZg9nQsHymtWiA+UBRUPwUFvW977hWKvbwcW5An56J J37iGDliFvfWDerEJpPOId72CMx5u1DWm1ql5A5hccsfmtfnANS0WysRnb/4seWzw7N29T PVWHIrQyWjth4qchT24MdPB84ae2ruK3rvH3V+Qf7k6KQ0spOl2qP+vB6/yt9pwSvtHvSb Q0NrU+J58Ln6WzR5QnoSqsHIvPb6S7V9rNOtyMPMyfv/ypDj1wUf+uIa1j657gE8gJOHOR 5m7tQSiwdTy4JdSCWQWPxX/vfc764+28sUs7Nh+OINr8rjIGqaTOYGdDhLGx0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704983722; 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=wVyuePKJ5c863FgjweH7zHl2Yj7jFKIXS3ypNTvyou4=; b=leROcoHZWpLO64NZyEOApWVsupU36YooWVT4xFd+dNCgT1KlyhH11TAF6QkavsAbFvcSZC 64Fvkc6T5MK2XWlq5FhWgaaLMmnsZ1fNysilSYe9DLZCp+u+zaeIeRdZXLZ5mWVudFkGjs IT6ozUWYD1vWm7jzXnGpqyLTpyZq9P482fpRj8WHa4bWuY4r0bnqH8I9CewSV+VosxwDL5 t3pXNgm1PtgH05Nq0QRvU6X6tOhRYb3qsMNMSHkyDC84tF34iq1h/UbwnG8JfOPy3eRtgZ qCKdbqELiwK1VSCYJKnQRMFpOz6g9iSKkfCrW+1B8oIzes5Ezhqr4OC7Gyi6tQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704983722; a=rsa-sha256; cv=none; b=QyYEu1nJGw39QvH3PNcLz2YHGZ+wFkJGuE02os2/DkYJvVRhqaHp5j0eaxSYBrO2Y7NXgq 2hiJAIUQ7E5OK73EDEDZcWZ1G71qe8rvUYkkFVek7RB5/AODLB89cGS8gwgUxkUoP2KLvG HYvkQ/Qp8pkqHYK5S9F2Vs41zYV7j0OTUxf+QB/Zl8RzRxCDDnPyRuhfMId2v8B1qnjViC FQYXJ4kUIsuVd6fxLfc9Y+cFdc0lrqrw/gl0GDCB11Dgyx+fBOjBrRqakmtloVSL7CLbj+ NKkhc0MzGws6IQvDRP9Ac31OM4N3MeibiOTbgYReWnBenhO0Hq2ekyHHlICSGA== 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 4T9nJV1XN3zMXK; Thu, 11 Jan 2024 14:35:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40BEZMnS025234; Thu, 11 Jan 2024 14:35:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40BEZMBM025231; Thu, 11 Jan 2024 14:35:22 GMT (envelope-from git) Date: Thu, 11 Jan 2024 14:35:22 GMT Message-Id: <202401111435.40BEZMBM025231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e3212b779ae2 - stable/13 - linprocfs: Avoid using a sysctl to get the CPU model string List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e3212b779ae2938428e087ac05c52e484cf2a6c2 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e3212b779ae2938428e087ac05c52e484cf2a6c2 commit e3212b779ae2938428e087ac05c52e484cf2a6c2 Author: Mark Johnston AuthorDate: 2024-01-04 13:25:05 +0000 Commit: Mark Johnston CommitDate: 2024-01-11 14:33:15 +0000 linprocfs: Avoid using a sysctl to get the CPU model string This will fail if the reading process is in capability mode. Just copy the string directly. PR: 276043 Reviewed by: emaste, imp, kib Reported and tested by: Ricardo Branco MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43281 (cherry picked from commit d74a742704eb81f0c6f4aa83e4cb0de26a81c400) --- sys/compat/linprocfs/linprocfs.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 3608a800dc9c..f8bbb0d8fbfc 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -202,10 +202,7 @@ linprocfs_domeminfo(PFS_FILL_ARGS) static int linprocfs_docpuinfo(PFS_FILL_ARGS) { - int hw_model[2]; - char model[128]; uint64_t freq; - size_t size; u_int cache_size[4]; u_int regs[4] = { 0 }; int fqmhz, fqkhz; @@ -305,12 +302,6 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "acc_power", }; - hw_model[0] = CTL_HW; - hw_model[1] = HW_MODEL; - model[0] = '\0'; - size = sizeof(model); - if (kernel_sysctl(td, hw_model, 2, &model, &size, 0, 0, 0, 0) != 0) - strcpy(model, "unknown"); #ifdef __i386__ switch (cpu_vendor_id) { case CPU_VENDOR_AMD: @@ -354,7 +345,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "cpuid level\t: %d\n" "wp\t\t: %s\n", i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), - CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING, + CPUID_TO_MODEL(cpu_id), cpu_model, cpu_id & CPUID_STEPPING, fqmhz, fqkhz, (cache_size[2] >> 16), 0, mp_ncpus, i, mp_ncpus, i, i, /*cpu_id & CPUID_LOCAL_APIC_ID ??*/