aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux
diff options
context:
space:
mode:
authorMickaël Salaün <mic@linux.microsoft.com>2021-03-05 14:49:06 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-03-05 18:12:06 +0100
commit800618b02f4f840756eb4218603a313113f94f05 (patch)
tree15f0a00c5ba18c431eb1906ad3c60a31dcb7628d /sys/linux
parent7325cd4db12e532ea1ed4b021a03063f31fb740e (diff)
sys/linux: fix prctl variants
Because there is not a proper prctl syscall but only variants, it happens that the logic to infer the number of syscall argument doesn't work (cf. callArgSizes in pkg/compiler/gen.go). As a result, the kernel rejects multiple prctl calls by returning -EINVAL because the fifth argument is not zero: * PR_MCE_KILL * PR_MCE_KILL_GET * PR_SET_MM * PR_SET_NO_NEW_PRIVS * PR_GET_NO_NEW_PRIVS * PR_GET_THP_DISABLE * PR_SET_THP_DISABLE * PR_GET_SPECULATION_CTRL * PR_SET_SPECULATION_CTRL Fix this by adding a new dummy prctl variant with all 5 arguments. Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/prctl.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/linux/prctl.txt b/sys/linux/prctl.txt
index 0ad8899c6..56bddb17b 100644
--- a/sys/linux/prctl.txt
+++ b/sys/linux/prctl.txt
@@ -9,6 +9,12 @@ include <uapi/linux/capability.h>
include <uapi/linux/securebits.h>
include <asm/prctl.h>
+# Use this variant (which will always return -EINVAL) to explicitly set the 5
+# syscall arguments that will enable to properly infer callArgSizes for all
+# prctl variants.
+
+prctl$0(option const[0], arg2 const[0], arg3 const[0], arg4 const[0], arg5 const[0]) (disabled)
+
# Only some commands break return values.
# PR_GET_TIMERSLACK and maybe more produce random errno's.
# When/if we have stricter enforcement of arguments for syscall variants, we may remove some of breaks_returns attributes.