Skip to content

Commit

Permalink
[AArch64] Guarded Control Stack (GCS)
Browse files Browse the repository at this point in the history
* Moved BTI under Security Features section
  • Loading branch information
cyring committed Jan 29, 2024
1 parent 32a33ae commit ae93cc2
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 10 deletions.
2 changes: 2 additions & 0 deletions aarch64/corefreq-cli-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ void JsonSysInfo(RO(SHM_STRUCT) *RO(Shm))
json_start_object(&s);
json_key(&s, "BTI");
json_literal(&s, "%u", (unsigned) RO(Shm)->Proc.Features.BTI);
json_key(&s, "GCS");
json_literal(&s, "%u", (unsigned) RO(Shm)->Proc.Features.GCS);
json_key(&s, "MTE");
json_literal(&s, "%u", (unsigned) RO(Shm)->Proc.Features.MTE);
json_key(&s, "NMI");
Expand Down
1 change: 1 addition & 0 deletions aarch64/corefreq-cli-rsc-en.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@
#define RSC_FEATURES_BTI_CODE_EN "Branch Target Identification"
#define RSC_FEATURES_EBEP_CODE_EN "Exception-based event profiling"
#define RSC_FEATURES_DIT_CODE_EN "Data Independent Timing"
#define RSC_FEATURES_GCS_CODE_EN "Guarded Control Stack"
#define RSC_FEATURES_GIC_CODE_EN "Generic Interrupt Controller"
#define RSC_FEATURES_MPAM_CODE_EN "Memory Partitioning and Monitoring"
#define RSC_FEATURES_MTE_CODE_EN "Memory Tagging Extension"
Expand Down
1 change: 1 addition & 0 deletions aarch64/corefreq-cli-rsc-fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ do echo -en "$h$l\t""\xc3""\x$h$l""\t"; done; done;echo
"Profilage d'""\xa9""v""\xa9""nements en fonction des exceptions"

#define RSC_FEATURES_DIT_CODE_FR RSC_FEATURES_DIT_CODE_EN
#define RSC_FEATURES_GCS_CODE_FR RSC_FEATURES_GCS_CODE_EN
#define RSC_FEATURES_GIC_CODE_FR \
"Contr""\xb4""leur d'interruption g""\xa9""n""\xa9""rique"

Expand Down
1 change: 1 addition & 0 deletions aarch64/corefreq-cli-rsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ RESOURCE_ST Resource[] = {
LDT(RSC_FEATURES_BTI),
LDT(RSC_FEATURES_EBEP),
LDT(RSC_FEATURES_DIT),
LDT(RSC_FEATURES_GCS),
LDT(RSC_FEATURES_GIC),
LDT(RSC_FEATURES_MPAM),
LDT(RSC_FEATURES_MTE),
Expand Down
1 change: 1 addition & 0 deletions aarch64/corefreq-cli-rsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ enum {
RSC_FEATURES_BTI,
RSC_FEATURES_EBEP,
RSC_FEATURES_DIT,
RSC_FEATURES_GCS,
RSC_FEATURES_GIC,
RSC_FEATURES_MPAM,
RSC_FEATURES_MTE,
Expand Down
26 changes: 17 additions & 9 deletions aarch64/corefreq-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,14 +1598,6 @@ REASON_CODE SysInfoFeatures( Window *win,
RSC(FEATURES_AMU).CODE(), width - 23 - RSZ(FEATURES_AMU),
NULL
},
{
NULL,
RO(Shm)->Proc.Features.BTI == 1,
attr_Feat,
2, "%s%.*sBTI [%7s]", RSC(FEATURES_BTI).CODE(),
width - 18 - RSZ(FEATURES_BTI),
NULL
},
{
NULL,
RO(Shm)->Proc.Features.EBEP == 1,
Expand Down Expand Up @@ -1709,7 +1701,7 @@ REASON_CODE SysInfoFeatures( Window *win,
},
{
NULL,
RO(Shm)->Proc.Features.UAO,
RO(Shm)->Proc.Features.UAO == 1,
attr_Feat,
2, "%s%.*sUAO [%9s]", RSC(FEATURES_UAO).CODE(),
width - 18 - RSZ(FEATURES_UAO),
Expand Down Expand Up @@ -1791,6 +1783,22 @@ REASON_CODE SysInfoFeatures( Window *win,
0,
NULL
},
{
NULL,
RO(Shm)->Proc.Features.BTI == 1,
attr_Feat,
2, "%s%.*sBTI [%7s]", RSC(FEATURES_BTI).CODE(),
width - 18 - RSZ(FEATURES_BTI),
NULL
},
{
NULL,
RO(Shm)->Proc.Features.GCS == 1,
attr_Feat,
2, "%s%.*sGCS [%7s]", RSC(FEATURES_GCS).CODE(),
width - 18 - RSZ(FEATURES_GCS),
NULL
},
{
NULL,
RO(Shm)->Proc.Features.RME == 1,
Expand Down
9 changes: 9 additions & 0 deletions aarch64/corefreqk.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,15 @@ static void Query_Features(void *pArg)
iArg->Features->NMI = 0;
break;
}
switch (pfr1.GCS) {
case 0b0001:
iArg->Features->GCS = 1;
break;
case 0b0000:
default:
iArg->Features->GCS = 0;
break;
}

if (Experimental && (iArg->HypervisorID == HYPERV_NONE)) {
/* Query the Cluster Configuration */
Expand Down
3 changes: 2 additions & 1 deletion aarch64/coretypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,8 @@ typedef struct /* BSP features. */
AMU_frac : 20-19,
RME : 21-20,
MTE : 23-21,
_Unused2_ : 64-23;
GCS : 24-23,
_Unused2_ : 64-24;

Bit64 InvariantTSC : 8-0,
HyperThreading : 9-8,
Expand Down

0 comments on commit ae93cc2

Please sign in to comment.