Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1 | From e849b161ce1d87ab369b921438abcf5b3a03e186 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 25 Apr 2021 08:57:03 -0700 |
| 4 | Subject: [PATCH] Hide fstatat64 and prlimit64 defines on musl |
| 5 | |
| 6 | musl defines fstatat64 and prlimit64 as macros which confuses the |
| 7 | seccomp sysall rewiring since there are syscalls with same names |
| 8 | |
| 9 | Upstream-Status: Pending |
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | --- |
| 12 | methods/aptmethod.h | 12 ++++++++++-- |
| 13 | 1 file changed, 10 insertions(+), 2 deletions(-) |
| 14 | |
| 15 | diff --git a/methods/aptmethod.h b/methods/aptmethod.h |
| 16 | index 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 | -- |
| 47 | 2.31.1 |
| 48 | |