aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Swiecki <robert@swiecki.net>2022-02-18 16:11:20 +0100
committerRobert Swiecki <robert@swiecki.net>2022-02-18 16:12:27 +0100
commit02458084fec6391c28c8e88cf3d825aa958fe7e6 (patch)
treecfae3766c02ae25dd8ae690c476be5f6c0f5de3a
parent8e4cc83eb254be5b49e195119314f89d9aa2e67e (diff)
downloadnsjail-02458084fec6391c28c8e88cf3d825aa958fe7e6.tar.gz
contain: call prctl(PR_SET_TSC) under x86/x86-64 only
-rw-r--r--contain.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/contain.cc b/contain.cc
index 2ccf333..5a27cae 100644
--- a/contain.cc
+++ b/contain.cc
@@ -121,10 +121,16 @@ static bool containCPU(nsjconf_t* nsjconf) {
static bool containTSC(nsjconf_t* nsjconf) {
if (nsjconf->disable_tsc) {
+#if defined(__x86_64__) || defined(__i386__)
if (prctl(PR_SET_TSC, PR_TSC_SIGSEGV, 0, 0, 0) == -1) {
- PLOG_E("prctl(PR_SET_TSC, PR_TSC_SIGSEGV, 0, 0, 0)");
+ PLOG_E("prctl(PR_SET_TSC, PR_TSC_SIGSEGV)");
return false;
}
+#else /* defined(__x86_64__) || defined(__i386__) */
+ LOG_W(
+ "prctl(PR_SET_TSC, PR_TSC_SIGSEGV) requested, but it's supported under "
+ "x86/x86-64 CPU architectures only. Ignoring it!");
+#endif /* defined(__x86_64__) || defined(__i386__) */
}
return true;
}