git: 0aba5dd2af57 - main - identcpu: Let the hw.model be readable in capability mode

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 04 Jan 2024 13:40:19 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=0aba5dd2af57ea3ae90eb49d7745c4c5b6f0ab6b

commit 0aba5dd2af57ea3ae90eb49d7745c4c5b6f0ab6b
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-01-04 13:26:53 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-04 13:39:53 +0000

    identcpu: Let the hw.model be readable in capability mode
    
    On some platforms this static information can be derived directly from
    the CPU, and there doesn't seem much use in restricting it.
    
    Reviewed by:    emaste, imp, kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D43281
---
 sys/arm/arm/identcpu-v6.c  | 2 +-
 sys/arm64/arm64/identcpu.c | 2 +-
 sys/powerpc/powerpc/cpu.c  | 2 +-
 sys/x86/x86/identcpu.c     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/arm/arm/identcpu-v6.c b/sys/arm/arm/identcpu-v6.c
index 567f576826ee..34663dfa51e6 100644
--- a/sys/arm/arm/identcpu-v6.c
+++ b/sys/arm/arm/identcpu-v6.c
@@ -55,7 +55,7 @@ SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD | CTLFLAG_CAPRD,
 	machine, 0, "Machine class");
 
 static char cpu_model[64];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD,
     cpu_model, sizeof(cpu_model), "Machine model");
 
 static char hw_buf[81];
diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c
index e7657e3aecf8..7cdcc9dfcb56 100644
--- a/sys/arm64/arm64/identcpu.c
+++ b/sys/arm64/arm64/identcpu.c
@@ -108,7 +108,7 @@ SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
 	 "Machine class");
 
 static char cpu_model[64];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD,
 	cpu_model, sizeof(cpu_model), "Machine model");
 
 #define	MAX_CACHES	8	/* Maximum number of caches supported
diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c
index 518623af9de4..19907e3973e7 100644
--- a/sys/powerpc/powerpc/cpu.c
+++ b/sys/powerpc/powerpc/cpu.c
@@ -239,7 +239,7 @@ static void	cpu_6xx_print_cacheinfo(u_int, uint16_t);
 static int	cpu_feature_bit(SYSCTL_HANDLER_ARGS);
 
 static char model[64];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, "");
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD, model, 0, "");
 
 static const struct cputab	*cput;
 
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index 7fa35bd50244..3163053a123f 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -158,7 +158,7 @@ SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD | CTLFLAG_CAPRD,
 #endif
 
 char cpu_model[128];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_MPSAFE,
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD | CTLFLAG_MPSAFE,
     cpu_model, 0, "Machine model");
 
 static int hw_clockrate;