From 800618b02f4f840756eb4218603a313113f94f05 Mon Sep 17 00:00:00 2001 From: Mickaël Salaün Date: Fri, 5 Mar 2021 14:49:06 +0100 Subject: sys/linux: fix prctl variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- sys/linux/prctl.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/linux') 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 include include +# 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. -- cgit mrf-deployment