Skip to contentSkip to conversation

configure: Relax check for libseccomp

PATCH Superseded Helge Deller 7 participants 15 messages Apr 3, 2019 – Apr 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Relax check for libseccomp

On a non-release architecture, the configure program aborts if the --enable-seccomp flag was given (with no way to work around it on the command line):

ERROR: User requested feature libseccomp
configure was not able to find it. libseccomp is not supported for host cpu parisc64

Instead of aborting, fall back to require libseccomp version 2.2.0 (or any higher version currently installed) which should be OK for non-release architectures.

configure +0 -1
index 1c563a7027..8632267049 100755
@@ -2389,7 +2389,6 @@ if test "$seccomp" != "no" ; then
         libseccomp_minver="2.3.0"
         ;;
     *)
-        libseccomp_minver=""
         ;;
     esac
#1 lore raw

On Wed, 3 Apr 2019 at 19:51, Helge Deller <[email protected]> wrote:

[cc'ing Eduardo as the seccomp submaintainer]

Quoted 7 lines

On a non-release architecture, the configure program aborts if the --enable-seccomp flag was given (with no way to work around it on the command line):

ERROR: User requested feature libseccomp
configure was not able to find it. libseccomp is not supported for host cpu parisc64

Surely the workaround is "don't pass --enable-seccomp on the configure command line" ?

Our general approach with configure arguments is:
--disable-foo means "don't try to look for or use foo" --enable-foo means "use foo, and stop with an error if we can't use
foo for any reason (eg not found, version too old)"
passing nothing means "look for foo, use it if we can,
but if we can't then just silently don't use foo"

So I think if the user specifically asks us to use seccomp on a host architecture where it won't work then configure should fail.

Is the underlying problem here:
* we use a whitelist of host architectures to enable seccomp for and we should not do that (eg blacklist instead, or just allow it for any host architecture)?
* using a whitelist is ok, but we should add some more host archs to it?
* something else?

What particular host arch are you using?

thanks
-- PMM

#2 lore raw
Quoted 9 lines · Peter Maydell

On Wed, 3 Apr 2019 at 19:51, Helge Deller <[email protected]> wrote:

[cc'ing Eduardo as the seccomp submaintainer]

Quoted 4 lines

On a non-release architecture, the configure program aborts if the --enable-seccomp flag was given (with no way to work around it on the command line):

Quoted 5 lines
Quoted 3 lines

ERROR: User requested feature libseccomp
configure was not able to find it. libseccomp is not supported for host cpu parisc64

What particular host arch are you using?

Doh, just noticed that the error message has the answer to this!

thanks
- PMM

#3 lore raw
In reply to Peter Maydell
Quoted 8 lines · Peter Maydell

On Wed, 3 Apr 2019 at 19:51, Helge Deller <[email protected]> wrote:

[cc'ing Eduardo as the seccomp submaintainer]

Quoted 4 lines

On a non-release architecture, the configure program aborts if the --enable-seccomp flag was given (with no way to work around it on the command line):

Quoted 6 lines
Quoted 3 lines

ERROR: User requested feature libseccomp
configure was not able to find it. libseccomp is not supported for host cpu parisc64

Surely the workaround is "don't pass --enable-seccomp on the configure command line" ?

Sure, that's the easy solution but doesn't work for me. The only reason why I come up with this patch, is that on Debian the qemu package fails to build on parisc because of this issue, as can be seen here:
https://buildd.debian.org/status/logs.php?pkg=qemu&arch=hppa
Debian sets the -enable-seccomp flags, so it fails on parisc (already in the qemu 1.3 release).

Quoted 4 lines

Our general approach with configure arguments is:
--disable-foo means "don't try to look for or use foo" --enable-foo means "use foo, and stop with an error if we can't use
foo for any reason (eg not found, version too old)"

Yes, that's OK.

Quoted 5 lines

passing nothing means "look for foo, use it if we can,
but if we can't then just silently don't use foo"

So I think if the user specifically asks us to use seccomp on a host architecture where it won't work then configure should fail.

True, it should fail if it's not useable.
But In my case, latest libseccomp is avaialble & functional, but nevertheless configure fails because parisc is not in the white list.

Quoted 4 lines

Is the underlying problem here:
* we use a whitelist of host architectures to enable seccomp for and we should not do that (eg blacklist instead, or just allow it for any host architecture)?

Yes, that's one option.
My patch partly does that by allowing -enble-seccomp as long as a libseccomp package is found.

Quoted 1 line

* using a whitelist is ok, but we should add some more host archs to it?

I think for non-release architectures there is no need to be too strict. If something is available, just use it, independend of the architecture. This solves it not just for parisc...

I'm fine with any solution as long as it works :-)

Quoted 1 line

What particular host arch are you using?

You already found out in your other mail: hppa/parisc.

Helge

Reviewed-by on v1 1/1
#6 lore raw
In reply to Helge Deller
Quoted 19 lines · Helge Deller

On a non-release architecture, the configure program aborts if the --enable-seccomp flag was given (with no way to work around it on the command line):

ERROR: User requested feature libseccomp
configure was not able to find it. libseccomp is not supported for host cpu parisc64

Instead of aborting, fall back to require libseccomp version 2.2.0 (or any higher version currently installed) which should be OK for non-release architectures.

configure +0 -0
index 1c563a7027..8632267049 100755

configure if test "$seccomp" != "no" ; then · line 2393

Quoted 6 lines
configure +0 -1
@@ -2389,7 +2389,6 @@ if test "$seccomp" != "no" ; then
         libseccomp_minver="2.3.0"
         ;;
     *)
-        libseccomp_minver=""
         ;;
     esac

This makes sense to me. From a QEMU source POV we are able to build with libseccomp >= 2.2.0, which our default libseccomp_minver= env expresses a few lines earlier.

If libseccomp isn't supported on a platform, then I think we should just assume that libseccomp won't be present in the OS install we are building against. I don't think QEMU needs to second-guess whether or not it is supported on the given architecture. In fact I'd go as far as to say we could probably just remove all this per-arch checking and just have a generic >= 2.2.0 check, and just rely on fact libseccomp won't exist on a s390/ppc/etc host if the distro had version < 2.3.0

Anyway, this particular patch is better than what we have so on that basis I think we can just apply this as-is:

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
In reply to Peter Maydell

CCing the right Eduardo. :)

Quoted 36 lines · Peter Maydell

On Wed, 3 Apr 2019 at 19:51, Helge Deller <[email protected]> wrote:

[cc'ing Eduardo as the seccomp submaintainer]

Quoted 7 lines

On a non-release architecture, the configure program aborts if the --enable-seccomp flag was given (with no way to work around it on the command line):

ERROR: User requested feature libseccomp
configure was not able to find it. libseccomp is not supported for host cpu parisc64

Surely the workaround is "don't pass --enable-seccomp on the configure command line" ?

Our general approach with configure arguments is:
--disable-foo means "don't try to look for or use foo" --enable-foo means "use foo, and stop with an error if we can't use
foo for any reason (eg not found, version too old)"
passing nothing means "look for foo, use it if we can,
but if we can't then just silently don't use foo"

So I think if the user specifically asks us to use seccomp on a host architecture where it won't work then configure should fail.

Is the underlying problem here:
* we use a whitelist of host architectures to enable seccomp for and we should not do that (eg blacklist instead, or just allow it for any host architecture)?
* using a whitelist is ok, but we should add some more host archs to it?
* something else?

What particular host arch are you using?

thanks
-- PMM

Signature · 1 line
Eduardo
#5 lore raw
Quoted 3 lines · Eduardo Habkost

CCing the right Eduardo. :)

Oops, sorry! Can I blame my email client's autocompletion? :-)

-- PMM

#7 lore raw
In reply to Daniel P. Berrangé
Quoted 18 lines · Daniel P. Berrangé

configure if test "$seccomp" != "no" ; then · line 2393

Quoted 11 lines · Helge Deller
configure +0 -1
index 1c563a7027..8632267049 100755
@@ -2389,7 +2389,6 @@ if test "$seccomp" != "no" ; then
         libseccomp_minver="2.3.0"
         ;;
     *)
-        libseccomp_minver=""
         ;;
     esac

This makes sense to me. From a QEMU source POV we are able to build with libseccomp >= 2.2.0, which our default libseccomp_minver= env expresses a few lines earlier.

Quoted 4 lines

If libseccomp isn't supported on a platform, then I think we should just assume that libseccomp won't be present in the OS install we are building against. I don't think QEMU needs to second-guess whether or not it is supported on the given architecture.

If we want to do this then we should handle all the archs which don't need to special case the seccomp version identically, ie remove the x86/mips case which with this patch would be the same as the default case.

Quoted 4 lines

In fact I'd go as far as to say we
could probably just remove all this per-arch checking and just have a generic >= 2.2.0 check, and just rely on fact libseccomp won't exist on a s390/ppc/etc host if the distro had version < 2.3.0

The arm case at least is present because libseccomp 2.2.0 was being built but didn't actually work for us. See commit ae6e8ef11e6cb43ec83.

thanks
-- PMM

#8 lore raw
Quoted 29 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé

configure if test "$seccomp" != "no" ; then · line 2393

Quoted 11 lines · Helge Deller
configure +0 -1
index 1c563a7027..8632267049 100755
@@ -2389,7 +2389,6 @@ if test "$seccomp" != "no" ; then
         libseccomp_minver="2.3.0"
         ;;
     *)
-        libseccomp_minver=""
         ;;
     esac

This makes sense to me. From a QEMU source POV we are able to build with libseccomp >= 2.2.0, which our default libseccomp_minver= env expresses a few lines earlier.

Quoted 4 lines

If libseccomp isn't supported on a platform, then I think we should just assume that libseccomp won't be present in the OS install we are building against. I don't think QEMU needs to second-guess whether or not it is supported on the given architecture.

If we want to do this then we should handle all the archs which don't need to special case the seccomp version identically, ie remove the x86/mips case which with this patch would be the same as the default case.

Quoted 7 lines
Quoted 4 lines

In fact I'd go as far as to say we
could probably just remove all this per-arch checking and just have a generic >= 2.2.0 check, and just rely on fact libseccomp won't exist on a s390/ppc/etc host if the distro had version < 2.3.0

The arm case at least is present because libseccomp 2.2.0 was being built but didn't actually work for us. See commit ae6e8ef11e6cb43ec83.

Looking at https://repology.org/project/libseccomp/versions it seems like all major distro versions that we want to support feature at least version 2.3.0 ... so I think we can simplify the check here for all architectures and only test for a version >= 2.3.0.

Thomas

#9 lore raw
Quoted 35 lines · Thomas Huth
Quoted 34 lines · Peter Maydell
Quoted 18 lines · Daniel P. Berrangé

configure if test "$seccomp" != "no" ; then · line 2393

Quoted 11 lines · Helge Deller
configure +0 -1
index 1c563a7027..8632267049 100755
@@ -2389,7 +2389,6 @@ if test "$seccomp" != "no" ; then
         libseccomp_minver="2.3.0"
         ;;
     *)
-        libseccomp_minver=""
         ;;
     esac

This makes sense to me. From a QEMU source POV we are able to build with libseccomp >= 2.2.0, which our default libseccomp_minver= env expresses a few lines earlier.

Quoted 4 lines

If libseccomp isn't supported on a platform, then I think we should just assume that libseccomp won't be present in the OS install we are building against. I don't think QEMU needs to second-guess whether or not it is supported on the given architecture.

If we want to do this then we should handle all the archs which don't need to special case the seccomp version identically, ie remove the x86/mips case which with this patch would be the same as the default case.

Quoted 4 lines

In fact I'd go as far as to say we
could probably just remove all this per-arch checking and just have a generic >= 2.2.0 check, and just rely on fact libseccomp won't exist on a s390/ppc/etc host if the distro had version < 2.3.0

Quoted 7 lines
Quoted 2 lines

The arm case at least is present because libseccomp 2.2.0 was being built but didn't actually work for us. See commit ae6e8ef11e6cb43ec83.

Looking at https://repology.org/project/libseccomp/versions it seems like all major distro versions that we want to support feature at least version 2.3.0 ... so I think we can simplify the check here for all architectures and only test for a version >= 2.3.0.

That sounds good to me.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#10 lore raw

PATCH v2 1/1 configure: Relax check for libseccomp

All major distributions do support libseccomp version >= 2.3.0, so there is no need to special-case on various architectures any longer.

configure +4 -24
index 1c563a7027..8fe4fc84d8 100755
@@ -2377,36 +2369,16 @@ fi
 ##########################################
 # libseccomp check
 
-libseccomp_minver="2.2.0"
 if test "$seccomp" != "no" ; then
-    case "$cpu" in
-    i386|x86_64|mips)
-        ;;
-    arm|aarch64)
-        libseccomp_minver="2.2.3"
-        ;;
-    ppc|ppc64|s390x)
-        libseccomp_minver="2.3.0"
-        ;;
-    *)
-        libseccomp_minver=""
-        ;;
-    esac
-
-    if test "$libseccomp_minver" != "" &&
-       $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
+    libseccomp_minver="2.3.0"
+    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
         seccomp_cflags="$($pkg_config --cflags libseccomp)"
         seccomp_libs="$($pkg_config --libs libseccomp)"
         seccomp="yes"
     else
         if test "$seccomp" = "yes" ; then
-            if test "$libseccomp_minver" != "" ; then
-                feature_not_found "libseccomp" \
-                    "Install libseccomp devel >= $libseccomp_minver"
-            else
-                feature_not_found "libseccomp" \
-                    "libseccomp is not supported for host cpu $cpu"
-            fi
+            feature_not_found "libseccomp" \
+                 "Install libseccomp devel >= $libseccomp_minver"
         fi
         seccomp="no"
     fi
Reviewed-by on v2 1/1
#11 lore raw
Quoted 40 lines · Helge Deller

All major distributions do support libseccomp version >= 2.3.0, so there is no need to special-case on various architectures any longer.

configure +2 -19
index 1c563a7027..8fe4fc84d8 100755
@@ -2377,36 +2369,16 @@ fi
 ##########################################
 # libseccomp check
 
-libseccomp_minver="2.2.0"
 if test "$seccomp" != "no" ; then
-    case "$cpu" in
-    i386|x86_64|mips)
-        ;;
-    arm|aarch64)
-        libseccomp_minver="2.2.3"
-        ;;
-    ppc|ppc64|s390x)
-        libseccomp_minver="2.3.0"
-        ;;
-    *)
-        libseccomp_minver=""
-        ;;
-    esac
-
-    if test "$libseccomp_minver" != "" &&
-       $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
+    libseccomp_minver="2.3.0"
+    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
         seccomp_cflags="$($pkg_config --cflags libseccomp)"
         seccomp_libs="$($pkg_config --libs libseccomp)"
         seccomp="yes"
     else
         if test "$seccomp" = "yes" ; then
-            if test "$libseccomp_minver" != "" ; then
-                feature_not_found "libseccomp" \

configure fi · line 2384

Quoted 10 lines
configure +2 -5
-                    "Install libseccomp devel >= $libseccomp_minver"
-            else
-                feature_not_found "libseccomp" \
-                    "libseccomp is not supported for host cpu $cpu"
-            fi
+            feature_not_found "libseccomp" \
+                 "Install libseccomp devel >= $libseccomp_minver"
         fi
         seccomp="no"
     fi
Reviewed-by on v2 1/1
#13 lore raw
In reply to Helge Deller
Quoted 4 lines · Helge Deller

All major distributions do support libseccomp version >= 2.3.0, so there is no need to special-case on various architectures any longer.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Reviewed-by on v2 1/1
#14 lore raw
In reply to Helge Deller
Quoted 41 lines · Helge Deller

All major distributions do support libseccomp version >= 2.3.0, so there is no need to special-case on various architectures any longer.

configure +2 -19
index 1c563a7027..8fe4fc84d8 100755
@@ -2377,36 +2369,16 @@ fi
 ##########################################
 # libseccomp check
 
-libseccomp_minver="2.2.0"
 if test "$seccomp" != "no" ; then
-    case "$cpu" in
-    i386|x86_64|mips)
-        ;;
-    arm|aarch64)
-        libseccomp_minver="2.2.3"
-        ;;
-    ppc|ppc64|s390x)
-        libseccomp_minver="2.3.0"
-        ;;
-    *)
-        libseccomp_minver=""
-        ;;
-    esac
-
-    if test "$libseccomp_minver" != "" &&
-       $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
+    libseccomp_minver="2.3.0"
+    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
         seccomp_cflags="$($pkg_config --cflags libseccomp)"
         seccomp_libs="$($pkg_config --libs libseccomp)"
         seccomp="yes"
     else
         if test "$seccomp" = "yes" ; then
-            if test "$libseccomp_minver" != "" ; then
-                feature_not_found "libseccomp" \

configure fi · line 2384

Quoted 10 lines
configure +2 -5
-                    "Install libseccomp devel >= $libseccomp_minver"
-            else
-                feature_not_found "libseccomp" \
-                    "libseccomp is not supported for host cpu $cpu"
-            fi
+            feature_not_found "libseccomp" \
+                 "Install libseccomp devel >= $libseccomp_minver"
         fi
         seccomp="no"
     fi
Acked-by
#12 lore raw
In reply to Thomas Huth
Quoted 45 lines · Thomas Huth
Quoted 44 lines · Helge Deller

All major distributions do support libseccomp version >= 2.3.0, so there is no need to special-case on various architectures any longer.

configure +2 -23
index 1c563a7027..8fe4fc84d8 100755
@@ -2377,36 +2369,16 @@ fi
 ##########################################
 # libseccomp check
 
-libseccomp_minver="2.2.0"
 if test "$seccomp" != "no" ; then
-    case "$cpu" in
-    i386|x86_64|mips)
-        ;;
-    arm|aarch64)
-        libseccomp_minver="2.2.3"
-        ;;
-    ppc|ppc64|s390x)
-        libseccomp_minver="2.3.0"
-        ;;
-    *)
-        libseccomp_minver=""
-        ;;
-    esac
-
-    if test "$libseccomp_minver" != "" &&
-       $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
+    libseccomp_minver="2.3.0"
+    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
         seccomp_cflags="$($pkg_config --cflags libseccomp)"
         seccomp_libs="$($pkg_config --libs libseccomp)"
         seccomp="yes"
     else
         if test "$seccomp" = "yes" ; then
-            if test "$libseccomp_minver" != "" ; then
-                feature_not_found "libseccomp" \
-                    "Install libseccomp devel >= $libseccomp_minver"
-            else
-                feature_not_found "libseccomp" \
-                    "libseccomp is not supported for host cpu $cpu"
Quoted 8 lines

configure fi · line 2384

Quoted 6 lines
configure +2 -1
-            fi
+            feature_not_found "libseccomp" \
+                 "Install libseccomp devel >= $libseccomp_minver"
         fi
         seccomp="no"
     fi
Signature · 5 lines
Eduardo Otubo

Red Hat GmbH,http://www.de.redhat.com/, Sitz: Grasbrunn,
Handelsregister: Amtsgericht München, HRB 153243,
Geschäftsführer: Charles Cachera, Michael O'Neill, Tom Savage, Eric Shander