[Bug 109695] qemu using spice gl and sandbox resourcecontrol=deny crashes with SIGSYS on radeonsi
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Feb 21 17:15:56 UTC 2019
https://bugs.freedesktop.org/show_bug.cgi?id=109695
--- Comment #2 from Ahzo at tutanota.com ---
To check for the availability of the syscall, one can try it in a child process
and see if the child is terminated by a signal, e.g. like this:
#include <stdbool.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <sys/wait.h>
static bool
can_set_affinity()
{
pid_t pid = fork();
int status = 0;
if (!pid) {
/* Disable coredumps, because a SIGSYS crash is expected. */
struct rlimit limit = { 0 };
limit.rlim_cur = 1;
limit.rlim_max = 1;
setrlimit(RLIMIT_CORE, &limit);
/* Test the syscall in the child process. */
syscall(SYS_sched_setaffinity, 0, 0, 0);
_exit(0);
} else if (pid < 0) {
return false;
}
if (waitpid(pid, &status, 0) < 0) {
return false;
}
if (WIFSIGNALED(status)) {
/* The child process was terminated by a signal,
* thus the syscall cannot be used.
*/
return false;
}
return true;
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190221/06d5985e/attachment.html>
More information about the dri-devel
mailing list