Skip to content

Commit c8ba214

Browse files
committed
Make linux aware of toggle smep and smap bits
1 parent f5150cf commit c8ba214

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

kernel/sys.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,10 @@ struct SymbiReg {
923923
uint64_t debug : 2; // Bit 3-4
924924
uint64_t no_smep : 1; // Bit 5
925925
uint64_t no_smap : 1; // Bit 6
926-
uint64_t ret : 1; // Bit 7
927-
uint64_t fast_lower : 1; // Bit 8
926+
uint64_t toggle_smep : 1; // Bit 7
927+
uint64_t toggle_smap : 1; // Bit 8
928+
uint64_t ret : 1; // Bit 9
929+
uint64_t fast_lower : 1; // Bit 10
928930
};
929931
};
930932
}__attribute__((packed));
@@ -1117,8 +1119,12 @@ SYSCALL_DEFINE1(elevate, unsigned long, flags)
11171119
return -1;
11181120
}
11191121

1120-
symbi_toggle_nosmap(sreg.no_smap, &sreg);
1121-
symbi_toggle_nosmep(sreg.no_smep);
1122+
if(sreg.toggle_smap){
1123+
symbi_toggle_nosmap(sreg.no_smap, &sreg);
1124+
}
1125+
if(sreg.toggle_smep){
1126+
symbi_toggle_nosmep(sreg.no_smep);
1127+
}
11221128

11231129

11241130
if(sreg.debug){

0 commit comments

Comments
 (0)