Allow sysctl hw.machine/hw.machine_arch in capability mode
There's no harm in reading strings like 'amd64'. Reviewed by: emaste, manu Sponsored by: https://www.patreon.com/valpackett Differential Revision: https://reviews.freebsd.org/D28703
This commit is contained in:
parent
61593cb297
commit
4a1c4de232
@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
char machine[] = "arm";
|
char machine[] = "arm";
|
||||||
|
|
||||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
|
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD | CTLFLAG_CAPRD,
|
||||||
machine, 0, "Machine class");
|
machine, 0, "Machine class");
|
||||||
|
|
||||||
static char cpu_model[64];
|
static char cpu_model[64];
|
||||||
|
@ -98,7 +98,8 @@ sysctl_hw_machine(SYSCTL_HANDLER_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
|
SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
|
||||||
CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A", "Machine class");
|
CTLFLAG_CAPRD | CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A",
|
||||||
|
"Machine class");
|
||||||
|
|
||||||
static char cpu_model[64];
|
static char cpu_model[64];
|
||||||
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
|
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
|
||||||
|
@ -315,7 +315,7 @@ sysctl_hw_machine_arch(SYSCTL_HANDLER_ARGS)
|
|||||||
return (SYSCTL_OUT(req, machine_arch, strlen(machine_arch) + 1));
|
return (SYSCTL_OUT(req, machine_arch, strlen(machine_arch) + 1));
|
||||||
}
|
}
|
||||||
SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD |
|
SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD |
|
||||||
CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A",
|
CTLFLAG_CAPRD | CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A",
|
||||||
"System architecture");
|
"System architecture");
|
||||||
|
|
||||||
#ifndef MACHINE_ARCHES
|
#ifndef MACHINE_ARCHES
|
||||||
|
@ -155,7 +155,7 @@ static char init_kenv[2048];
|
|||||||
static struct trapframe frame0;
|
static struct trapframe frame0;
|
||||||
|
|
||||||
char machine[] = "powerpc";
|
char machine[] = "powerpc";
|
||||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, "");
|
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD | CTLFLAG_CAPRD, machine, 0, "");
|
||||||
|
|
||||||
static void cpu_startup(void *);
|
static void cpu_startup(void *);
|
||||||
SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
|
SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
|
||||||
|
@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
char machine[] = "riscv";
|
char machine[] = "riscv";
|
||||||
|
|
||||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0,
|
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD | CTLFLAG_CAPRD, machine, 0,
|
||||||
"Machine class");
|
"Machine class");
|
||||||
|
|
||||||
/* Hardware implementation info. These values may be empty. */
|
/* Hardware implementation info. These values may be empty. */
|
||||||
|
@ -153,9 +153,9 @@ sysctl_hw_machine(SYSCTL_HANDLER_ARGS)
|
|||||||
|
|
||||||
}
|
}
|
||||||
SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
|
SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
|
||||||
CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A", "Machine class");
|
CTLFLAG_CAPRD | CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A", "Machine class");
|
||||||
#else
|
#else
|
||||||
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
|
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD | CTLFLAG_CAPRD,
|
||||||
machine, 0, "Machine class");
|
machine, 0, "Machine class");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user