Skip to contentSkip to conversation

pseudo: add macro guard for seccomp

PATCH In review kai 2 participants 3 messages Apr 27, 2020 – Apr 28, 2020

lore
Share & tools
lore

kai

author
#0 lore raw

PATCH 1/1 pseudo: add macro guard for seccomp

From: Kai Kang <[email protected]>

It fails to compile pseudo-native on centos 7:

| ports/linux/pseudo_wrappers.c: In function ‘prctl’:
| ports/linux/pseudo_wrappers.c:129:14: error: ‘SECCOMP_SET_MODE_FILTER’ undeclared (first use in this function)
|    if (cmd == SECCOMP_SET_MODE_FILTER) {
|               ^

Add macro guard for seccomp to avoid the failure.

---
 meta/recipes-devtools/pseudo/files/seccomp.patch | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
meta/recipes-devtools/pseudo/files/seccomp.patch +14 -1
index be42eaf353..2bad8dae28 100644
@@ -7,6 +7,17 @@ Upstream-Status: Pending
 RP 2020/4/3
 Signed-off-by: Richard Purdie <[email protected]>
 
+It fails to compile pseudo-native on centos 7:
+
+| ports/linux/pseudo_wrappers.c: In function ‘prctl’:
+| ports/linux/pseudo_wrappers.c:129:14: error: ‘SECCOMP_SET_MODE_FILTER’ undeclared (first use in this function)
+|    if (cmd == SECCOMP_SET_MODE_FILTER) {
+|               ^
+
+Add macro guard for seccomp to avoid the failure.
+
+Signed-off-by: Kai Kang <[email protected]>
+
 Index: git/ports/linux/pseudo_wrappers.c
 ===================================================================
 --- git.orig/ports/linux/pseudo_wrappers.c
@@ -40,7 +51,7 @@ Index: git/ports/linux/pseudo_wrappers.c
  	/* gcc magic to attempt to just pass these args to syscall. we have to
  	 * guess about the number of args; the docs discuss calling conventions
  	 * up to 7, so let's try that?
-@@ -92,3 +108,42 @@ static long wrap_syscall(long nr, va_lis
+@@ -92,3 +108,44 @@ static long wrap_syscall(long nr, va_lis
  	(void) ap;
  	return -1;
  }
@@ -56,6 +67,7 @@ Index: git/ports/linux/pseudo_wrappers.c
 +		return rc;
 +	}
 +
++#ifdef SYS_seccomp
 +	/* pseudo and seccomp are incompatible as pseudo uses different syscalls
 +	 * so pretend to enable seccomp but really do nothing */
 +	if (option == PR_SET_SECCOMP) {
@@ -67,6 +79,7 @@ Index: git/ports/linux/pseudo_wrappers.c
 +		    return 0;
 +		}
 +	}
++#endif
 +
 +	/* gcc magic to attempt to just pass these args to prctl. we have to
 +	 * guess about the number of args; the docs discuss calling conventions
Signature · 1 line
2.17.1
#1 lore raw
Quoted 3 lines · On Mon, 27 Apr 2020 14:04:16 +0800 "kai" <[email protected]> wrote:

| ports/linux/pseudo_wrappers.c:129:14: error:
‘SECCOMP_SET_MODE_FILTER’ undeclared (first use in this function)
| if (cmd == SECCOMP_SET_MODE_FILTER) {

Should the test be against this being #defined, rather than the separate SYS__seccomp?

-s

author
#2 lore raw
Quoted 8 lines · Seebs
Quoted 3 lines · On Mon, 27 Apr 2020 14:04:16 +0800 "kai" <[email protected]> wrote:

| ports/linux/pseudo_wrappers.c:129:14: error:
‘SECCOMP_SET_MODE_FILTER’ undeclared (first use in this function)
| if (cmd == SECCOMP_SET_MODE_FILTER) {

Should the test be against this being #defined, rather than the separate SYS__seccomp?

It keeps compliance with pre-section in this patch. The patch is to deal with pseudo and seccomp, I suppose it is better to keep the same with macro guard in the pre-section.

Regards,
Kai

Quoted 4 lines

-s

Signature · 2 lines
Kai Kang
Wind River Linux