NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-evbarm/58683: pthread_setaffinity_np() results on SIGSEGV on aarch64



The following reply was made to PR port-evbarm/58683; it has been noted by GNATS.

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-evbarm/58683: pthread_setaffinity_np() results on SIGSEGV on aarch64
Date: Fri, 20 Sep 2024 20:04:00 -0000 (UTC)

 cryintothebluesky%gmail.com@localhost writes:
 
 >Run some program which calls pthread_setaffinity_np() as unprivileged user:
 >$ ./a.out
 >...
 
 % cat c.c
 #include <pthread.h>
 #include <sched.h>
 #include <stdio.h>
 #include <err.h>
 
 int main(int argc, char *argv[])
 {
         cpuset_t *c;
         int error;
 
         c = cpuset_create();
         if (c == NULL)
                 err(1, "cpuset_create");
 
         cpuset_set(0, c);
 
         error = pthread_setaffinity_np(pthread_self(), cpuset_size(c), c);
         if (error)
                 err(1, "pthread_setaffinity_np");
 
         return 0;
 }
 
 % cc -pthread c.c
 % ./a.out
 a.out: pthread_setaffinity_np: Operation not permitted
 
 Seems to work.
 


Home | Main Index | Thread Index | Old Index