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