1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
From e849b161ce1d87ab369b921438abcf5b3a03e186 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 25 Apr 2021 08:57:03 -0700
Subject: [PATCH] Hide fstatat64 and prlimit64 defines on musl
musl defines fstatat64 and prlimit64 as macros which confuses the
seccomp sysall rewiring since there are syscalls with same names
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
methods/aptmethod.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/methods/aptmethod.h b/methods/aptmethod.h
index bd50e80..3085aed 100644
--- a/methods/aptmethod.h
+++ b/methods/aptmethod.h
@@ -121,6 +121,12 @@ protected:
if (ctx == NULL)
return _error->FatalE("HttpMethod::Configuration", "Cannot init seccomp");
+#ifndef __GLIBC__
+#pragma push_macro("fstatat64")
+#pragma push_macro("prlimit64")
+#undef fstatat64
+#undef prlimit64
+#endif
#define ALLOW(what) \
if ((rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(what), 0))) \
return _error->FatalE("HttpMethod::Configuration", "Cannot allow %s: %s", #what, strerror(-rc));
@@ -320,9 +326,11 @@ protected:
if ((rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, seccomp_syscall_resolve_name(custom.c_str()), 0)))
return _error->FatalE("aptMethod::Configuration", "Cannot allow %s: %s", custom.c_str(), strerror(-rc));
}
-
#undef ALLOW
-
+#ifndef __GLIBC__
+#pragma pop_macro("fstatat64")
+#pragma pop_macro("prlimit64")
+#endif
rc = seccomp_load(ctx);
if (rc == -EINVAL)
{
--
2.31.1
|