This issue was found by a local syzkaller instance running on
qemu-system-ppc64 (POWER10), not by upstream syzbot, so there is no
public syzbot report or Closes tag.
Syzkaller did not generate a standalone reproducer. Based on the crash
trace, I created the reproducer below. It installs a single hardware
watchpoint using perf_event_open() and repeatedly triggers it, while a
second thread continuously sends SIGUSR1 to the watched thread.
This exercises the thread_change_pc() reset path while a watchpoint is
in perf_single_step state.
On a POWER10 LPAR running an unpatched kernel, it crashes immediately
with the NULL pointer dereference. With the proposed fix applied, it
runs to completion.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <linux/perf_event.h>
#include <linux/hw_breakpoint.h>
static volatile int watch_target = 0;
static volatile int running = 1;
/* Signal handler: its delivery forces arch_do_signal_or_restart ->
thread_change_pc */
static void sig_handler(int sig)
{
/* Handled */
}
/* Thread that rapidly fires signals at the main thread */
static void *signal_flooder(void *arg)
{
pthread_t target_thread = *(pthread_t *)arg;
while (running) {
pthread_kill(target_thread, SIGUSR1);
usleep(10);
}
return NULL;
}
int main(void)
{
struct sigaction sa;
struct perf_event_attr pe;
pthread_t flooder;
pthread_t main_thread = pthread_self();
int fd;
/* 1. Register signal handler */
memset(&sa, 0, sizeof(sa));
sa.sa_handler = sig_handler;
sigaction(SIGUSR1, &sa, NULL);
/* 2. Configure 1 hardware watchpoint (slot 0) */
memset(&pe, 0, sizeof(pe));
pe.type = PERF_TYPE_BREAKPOINT;
pe.size = sizeof(struct perf_event_attr);
pe.bp_type = HW_BREAKPOINT_W;
pe.bp_addr = (unsigned long)&watch_target;
pe.bp_len = sizeof(int);
pe.disabled = 0;
fd = syscall(__NR_perf_event_open, &pe, 0, -1, -1, 0);
if (fd < 0) {
perror("perf_event_open");
return 1;
}
printf("[+] HW Watchpoint installed on %p (fd=%d)\n",
&watch_target, fd);
printf("[+] Flooding signals to trigger thread_change_pc() race...\n");
/* 3. Start signal flooding thread */
pthread_create(&flooder, NULL, signal_flooder, &main_thread);
/* 4. Trigger watchpoint writes repeatedly */
for (int i = 0; i < 1000000; i++) {
watch_target = i; /* Triggers watchpoint exception & single-step */
}
running = 0;
pthread_join(flooder, NULL);
close(fd);
printf("[-] Finished without crash (kernel likely patched).\n");
return 0;
}
Thanks,
Sridhar
On 27/11/26 2:49 pm, Gautam Menghani wrote:
Do you also have the reproducer for this issue? Also if this was
reported by upstream syzkaller, you have to put the Reported-by and
Closes tags.
Thanks,
Gautam