All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] apt: Fix build on musl when seccomp is enabled
@ 2021-04-25 16:01 Khem Raj
  2021-04-25 18:59 ` Armin Kuster
  0 siblings, 1 reply; 2+ messages in thread
From: Khem Raj @ 2021-04-25 16:01 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj, Armin Kuster

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Armin Kuster <akuster808@gmail.com>
---
 ...atat64-and-prlimit64-defines-on-musl.patch | 48 +++++++++++++++++++
 meta/recipes-devtools/apt/apt_2.2.2.bb        |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch

diff --git a/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch b/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch
new file mode 100644
index 0000000000..f1816836b5
--- /dev/null
+++ b/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch
@@ -0,0 +1,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
+
diff --git a/meta/recipes-devtools/apt/apt_2.2.2.bb b/meta/recipes-devtools/apt/apt_2.2.2.bb
index 7d1bce558d..27bc1c75fd 100644
--- a/meta/recipes-devtools/apt/apt_2.2.2.bb
+++ b/meta/recipes-devtools/apt/apt_2.2.2.bb
@@ -12,6 +12,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
            file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
            file://0001-srvrec-Keep-support-for-older-resolver.patch \
            file://0001-cmake-Do-not-build-po-files.patch \
+           file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
            "
 
 SRC_URI_append_class-native = " \
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] apt: Fix build on musl when seccomp is enabled
  2021-04-25 16:01 [PATCH] apt: Fix build on musl when seccomp is enabled Khem Raj
@ 2021-04-25 18:59 ` Armin Kuster
  0 siblings, 0 replies; 2+ messages in thread
From: Armin Kuster @ 2021-04-25 18:59 UTC (permalink / raw)
  To: Khem Raj, openembedded-core



On 4/25/21 9:01 AM, Khem Raj wrote:
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Armin Kuster <akuster808@gmail.com>
> ---
>  ...atat64-and-prlimit64-defines-on-musl.patch | 48 +++++++++++++++++++
>  meta/recipes-devtools/apt/apt_2.2.2.bb        |  1 +
>  2 files changed, 49 insertions(+)
>  create mode 100644 meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch
>
> diff --git a/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch b/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch
> new file mode 100644
> index 0000000000..f1816836b5
> --- /dev/null
> +++ b/meta/recipes-devtools/apt/apt/0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch
> @@ -0,0 +1,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

Thanks. This builds now.

-armin
> +
> +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
> +
> diff --git a/meta/recipes-devtools/apt/apt_2.2.2.bb b/meta/recipes-devtools/apt/apt_2.2.2.bb
> index 7d1bce558d..27bc1c75fd 100644
> --- a/meta/recipes-devtools/apt/apt_2.2.2.bb
> +++ b/meta/recipes-devtools/apt/apt_2.2.2.bb
> @@ -12,6 +12,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/a/apt/${BPN}_${PV}.tar.xz \
>             file://0001-CMakeLists.txt-avoid-changing-install-paths-based-on.patch \
>             file://0001-srvrec-Keep-support-for-older-resolver.patch \
>             file://0001-cmake-Do-not-build-po-files.patch \
> +           file://0001-Hide-fstatat64-and-prlimit64-defines-on-musl.patch \
>             "
>  
>  SRC_URI_append_class-native = " \


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-25 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 16:01 [PATCH] apt: Fix build on musl when seccomp is enabled Khem Raj
2021-04-25 18:59 ` Armin Kuster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.