Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package glibc for openSUSE:Factory checked in at 2021-03-11 20:06:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/glibc (Old) and /work/SRC/openSUSE:Factory/.glibc.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "glibc" Thu Mar 11 20:06:59 2021 rev:247 rq:878145 version:2.33 Changes: -------- --- /work/SRC/openSUSE:Factory/glibc/glibc.changes 2021-03-07 15:19:37.304551099 +0100 +++ /work/SRC/openSUSE:Factory/.glibc.new.2401/glibc.changes 2021-03-11 20:07:04.140155351 +0100 @@ -1,0 +2,15 @@ +Mon Mar 8 10:43:30 UTC 2021 - Andreas Schwab <sch...@suse.de> + +- nss-database-check-reload.patch: nsswitch: return result when nss + database is locked (BZ #27343) +- nss-load-chroot.patch: nss: Re-enable NSS module loading after chroot + (bsc#1182323, BZ #27389) +- x86-isa-level.patch: x86: Set minimum x86-64 level marker (bsc#1182522, + BZ #27318) +- nss-database-lookup.patch: nss: fix nss_database_lookup2's alternate + handling (bsc#1182247, BZ #27416) +- nss-revert-api.patch: remove +- nscd-netgroupcache.patch: nscd: Fix double free in netgroupcache + (CVE-2021-27645, bsc#1182733, BZ #27462) + +------------------------------------------------------------------- Old: ---- nss-revert-api.patch New: ---- nscd-netgroupcache.patch nss-database-check-reload.patch nss-database-lookup.patch nss-load-chroot.patch x86-isa-level.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ glibc.spec ++++++ --- /var/tmp/diff_new_pack.Klkx9z/_old 2021-03-11 20:07:06.076158363 +0100 +++ /var/tmp/diff_new_pack.Klkx9z/_new 2021-03-11 20:07:06.080158370 +0100 @@ -90,9 +90,6 @@ ExclusiveArch: i586 i686 BuildArch: i686 %endif -%if %{with usrmerged} && %{build_main} -Provides: /sbin/ldconfig -%endif %define __filter_GLIBC_PRIVATE 1 %ifarch i686 @@ -183,6 +180,9 @@ Requires(pre): filesystem Recommends: glibc-extra Provides: rtld(GNU_HASH) +%if %{with usrmerged} +Provides: /sbin/ldconfig +%endif %endif %if %{build_utils} Requires: glibc = %{version} @@ -200,8 +200,6 @@ ### # Patches that upstream will not accept ### -# PATCH-FIX-OPENSUSE Work around for nss-compat brokeness -Patch1: nss-revert-api.patch ### # openSUSE specific patches - won't go upstream @@ -247,6 +245,16 @@ ### # Patches from upstream ### +# PATCH-FIX-UPSTREAM nsswitch: return result when nss database is locked (BZ #27343) +Patch1000: nss-database-check-reload.patch +# PATCH-FIX-UPSTREAM nss: Re-enable NSS module loading after chroot (BZ #27389) +Patch1001: nss-load-chroot.patch +# PATCH-FIX-UPSTREAM x86: Set minimum x86-64 level marker (BZ #27318) +Patch1002: x86-isa-level.patch +# PATCH-FIX-UPSTREAM nscd: Fix double free in netgroupcache (CVE-2021-27645, BZ #27462) +Patch1003: nscd-netgroupcache.patch +# PATCH-FIX-UPSTREAM nss: fix nss_database_lookup2's alternate handling (BZ #27416) +Patch1004: nss-database-lookup.patch ### # Patches awaiting upstream approval @@ -445,7 +453,6 @@ %prep %setup -n glibc-%{version} -q -a 4 -%patch1 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 @@ -465,6 +472,12 @@ %patch304 -p1 %patch306 -p1 +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 + %patch2000 -p1 %patch2001 -p1 @@ -503,16 +516,17 @@ # # Default CFLAGS and Compiler # -BuildFlags="%{optflags} -U_FORTIFY_SOURCE" enable_stack_protector= -for opt in $BuildFlags; do +BuildFlags= +tmp="%{optflags}" +for opt in $tmp; do case $opt in - -fstack-protector-strong) enable_stack_protector=strong ;; - -fstack-protector-all) enable_stack_protector=all ;; + -fstack-protector-*) enable_stack_protector=${opt#-fstack-protector-} ;; -fstack-protector) enable_stack_protector=yes ;; + -ffortify=* | *_FORTIFY_SOURCE*) ;; + *) BuildFlags+=" $opt" ;; esac done -BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##') BuildCC="%__cc" BuildCCplus="%__cxx" # @@ -547,10 +561,6 @@ %ifarch hppa BuildFlags="$BuildFlags -mpa-risc-1-1 -fstrict-aliasing" %endif -# Add flags for all plattforms except AXP -%ifnarch alpha - BuildFlags="$BuildFlags -g" -%endif %if %{disable_assert} BuildFlags="$BuildFlags -DNDEBUG=1" %endif @@ -565,7 +575,7 @@ mkdir cc-base cd cc-base %ifarch %arm aarch64 -# remove asynchronous-unwind-tables during configure as it causes +# remove [asynchronous-]unwind-tables during configure as it causes # some checks to fail spuriously on arm conf_cflags="${BuildFlags/-fasynchronous-unwind-tables/}" conf_cflags="${conf_cflags/-funwind-tables/}" @@ -578,8 +588,6 @@ %else profile="--disable-profile" %endif -# Disable x86 ISA level support for now (bsc#1182522) -export libc_cv_include_x86_isa_level=no ../configure \ CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ CC="$BuildCC" CXX="$BuildCCplus" \ ++++++ glibc-nsswitch-usr.diff ++++++ --- /var/tmp/diff_new_pack.Klkx9z/_old 2021-03-11 20:07:06.180158525 +0100 +++ /var/tmp/diff_new_pack.Klkx9z/_new 2021-03-11 20:07:06.180158525 +0100 @@ -1,15 +1,13 @@ -Index: glibc-2.33/nss/nsswitch.c +Index: glibc-2.33/nss/nss_database.c =================================================================== ---- glibc-2.33.orig/nss/nsswitch.c -+++ glibc-2.33/nss/nsswitch.c -@@ -126,6 +126,10 @@ __nss_database_lookup2 (const char *data - /* Read config file. */ - service_table = nss_parse_file (_PATH_NSSWITCH_CONF); - -+ /* Retry with the OS vendor provided config file. */ -+ if (service_table == NULL) -+ service_table = nss_parse_file ("/usr" _PATH_NSSWITCH_CONF); -+ - /* Test whether configuration data is available. */ - if (service_table != NULL) - { +--- glibc-2.33.orig/nss/nss_database.c ++++ glibc-2.33/nss/nss_database.c +@@ -303,6 +303,8 @@ nss_database_reload (struct nss_database + { + FILE *fp = fopen (_PATH_NSSWITCH_CONF, "rce"); + if (fp == NULL) ++ fp = fopen ("/usr" _PATH_NSSWITCH_CONF, "rce"); ++ if (fp == NULL) + switch (errno) + { + case EACCES: ++++++ nscd-netgroupcache.patch ++++++ >From a151f2e05a64727c552a297d129b8ef242ffb3b6 Mon Sep 17 00:00:00 2001 From: DJ Delorie <d...@redhat.com> Date: Thu, 25 Feb 2021 16:08:21 -0500 Subject: [PATCH] nscd: Fix double free in netgroupcache [BZ #27462] In commit 745664bd798ec8fd50438605948eea594179fba1 a use-after-free was fixed, but this led to an occasional double-free. This patch tracks the "live" allocation better. Tested manually by a third party. Related: RHBZ 1927877 Reviewed-by: Siddhesh Poyarekar <siddh...@sourceware.org> Reviewed-by: Carlos O'Donell <car...@redhat.com> (cherry picked from commit dca565886b5e8bd7966e15f0ca42ee5cff686673) --- nscd/netgroupcache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: glibc-2.33/nscd/netgroupcache.c =================================================================== --- glibc-2.33.orig/nscd/netgroupcache.c +++ glibc-2.33/nscd/netgroupcache.c @@ -248,7 +248,7 @@ addgetnetgrentX (struct database_dyn *db : NULL); ndomain = (ndomain ? newbuf + ndomaindiff : NULL); - buffer = newbuf; + *tofreep = buffer = newbuf; } nhost = memcpy (buffer + bufused, @@ -319,7 +319,7 @@ addgetnetgrentX (struct database_dyn *db else if (status == NSS_STATUS_TRYAGAIN && e == ERANGE) { buflen *= 2; - buffer = xrealloc (buffer, buflen); + *tofreep = buffer = xrealloc (buffer, buflen); } else if (status == NSS_STATUS_RETURN || status == NSS_STATUS_NOTFOUND ++++++ nss-database-check-reload.patch ++++++ >From 17f0ff097887008b2d3dca270c8ffbb4b43a8749 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich <sly...@gentoo.org> Date: Fri, 5 Feb 2021 07:32:18 +0000 Subject: [PATCH] nsswitch: return result when nss database is locked [BZ #27343] Before the change nss_database_check_reload_and_get() did not populate the '*result' value when it returned success in a case of chroot detection. This caused initgroups() to use garage pointer in the following test (extracted from unbound): ``` int main() { // load some NSS modules struct passwd * pw = getpwnam("root"); chdir("/tmp"); chroot("/tmp"); chdir("/"); // access nsswitch.conf in a chroot initgroups("root", 0); } ``` Reviewed-by: DJ Delorie <d...@redhat.com> --- nss/nss_database.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: glibc-2.33/nss/nss_database.c =================================================================== --- glibc-2.33.orig/nss/nss_database.c +++ glibc-2.33/nss/nss_database.c @@ -400,8 +400,9 @@ nss_database_check_reload_and_get (struc && (str.st_ino != local->root_ino || str.st_dev != local->root_dev))) { - /* Change detected; disable reloading. */ + /* Change detected; disable reloading and return current state. */ atomic_store_release (&local->data.reload_disabled, 1); + *result = local->data.services[database_index]; __libc_lock_unlock (local->lock); __nss_module_disable_loading (); return true; ++++++ nss-database-lookup.patch ++++++ ++++ 854 lines (skipped) ++++++ nss-load-chroot.patch ++++++ >From 3e880d733753183696d1a81c34caef3a9add2b0c Mon Sep 17 00:00:00 2001 From: DJ Delorie <d...@redhat.com> Date: Thu, 18 Feb 2021 15:26:30 -0500 Subject: [PATCH] nss: Re-enable NSS module loading after chroot [BZ #27389] The glibc 2.33 release enabled /etc/nsswitch.conf reloading, and to prevent potential security issues like CVE-2019-14271 the re-loading of nsswitch.conf and all mdoules was disabled when the root filesystem changes (see bug 27077). Unfortunately php-lpfm and openldap both require the ability to continue to load NSS modules after chroot. The packages do not exec after the chroot, and so do not cause the protections to be reset. The only solution is to re-enable only NSS module loading (not nsswitch.conf reloading) and so get back the previous glibc behaviour. In the future we may introduce a way to harden applications so they do not reload NSS modules once the root filesystem changes, or that only files/dns are available pre-loaded (or builtin). Reviewed-by: Carlos O'Donell <car...@redhat.com> (cherry picked from commit 58673149f37389495c098421085ffdb468b3f7ad) --- nss/nss_database.c | 1 - nss/tst-reload2.c | 35 +++++++++++++++---- nss/tst-reload2.root/etc/hosts | 1 + nss/tst-reload2.root/etc/nsswitch.conf | 1 + nss/tst-reload2.root/subdir/etc/hosts | 1 + nss/tst-reload2.root/subdir/etc/nsswitch.conf | 1 + 6 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 nss/tst-reload2.root/etc/hosts create mode 100644 nss/tst-reload2.root/subdir/etc/hosts Index: glibc-2.33/nss/nss_database.c =================================================================== --- glibc-2.33.orig/nss/nss_database.c +++ glibc-2.33/nss/nss_database.c @@ -404,7 +404,6 @@ nss_database_check_reload_and_get (struc atomic_store_release (&local->data.reload_disabled, 1); *result = local->data.services[database_index]; __libc_lock_unlock (local->lock); - __nss_module_disable_loading (); return true; } local->root_ino = str.st_ino; Index: glibc-2.33/nss/tst-reload2.c =================================================================== --- glibc-2.33.orig/nss/tst-reload2.c +++ glibc-2.33/nss/tst-reload2.c @@ -26,6 +26,7 @@ #include <pwd.h> #include <grp.h> #include <unistd.h> +#include <netdb.h> #include <support/support.h> #include <support/check.h> @@ -48,7 +49,7 @@ static const char *group_4[] = { "alpha", "beta", "gamma", "fred", NULL }; -static struct group group_table_data[] = +static struct group group_table_data1[] = { GRP (4), GRP_LAST () @@ -58,7 +59,7 @@ void _nss_test1_init_hook (test_tables *t) { t->pwd_table = pwd_table1; - t->grp_table = group_table_data; + t->grp_table = group_table_data1; } static struct passwd pwd_table2[] = @@ -68,10 +69,21 @@ static struct passwd pwd_table2[] = PWD_LAST () }; +static const char *group_5[] = { + "fred", NULL +}; + +static struct group group_table_data2[] = + { + GRP (5), + GRP_LAST () + }; + void _nss_test2_init_hook (test_tables *t) { t->pwd_table = pwd_table2; + t->grp_table = group_table_data2; } static int @@ -79,6 +91,7 @@ do_test (void) { struct passwd *pw; struct group *gr; + struct hostent *he; char buf1[PATH_MAX]; char buf2[PATH_MAX]; @@ -99,7 +112,9 @@ do_test (void) TEST_COMPARE (pw->pw_uid, 1234); /* This just loads the test2 DSO. */ - gr = getgrnam ("name4"); + gr = getgrgid (5); + TEST_VERIFY (gr != NULL); + /* Change the root dir. */ @@ -114,15 +129,21 @@ do_test (void) if (pw) TEST_VERIFY (pw->pw_uid != 2468); - /* The "files" DSO should not be loaded. */ - gr = getgrnam ("test3"); - TEST_VERIFY (gr == NULL); - /* We should still be using the old configuration. */ pw = getpwnam ("test1"); TEST_VERIFY (pw != NULL); if (pw) TEST_COMPARE (pw->pw_uid, 1234); + gr = getgrgid (5); + TEST_VERIFY (gr != NULL); + gr = getgrnam ("name4"); + TEST_VERIFY (gr == NULL); + + /* hosts in the outer nsswitch is files; the inner one is test1. + Verify that we're still using the outer nsswitch *and* that we + can load the files DSO. */ + he = gethostbyname ("test2"); + TEST_VERIFY (he != NULL); return 0; } Index: glibc-2.33/nss/tst-reload2.root/etc/hosts =================================================================== --- /dev/null +++ glibc-2.33/nss/tst-reload2.root/etc/hosts @@ -0,0 +1 @@ +1.2.3.4 test1 Index: glibc-2.33/nss/tst-reload2.root/etc/nsswitch.conf =================================================================== --- glibc-2.33.orig/nss/tst-reload2.root/etc/nsswitch.conf +++ glibc-2.33/nss/tst-reload2.root/etc/nsswitch.conf @@ -1,2 +1,3 @@ passwd: test1 group: test2 +hosts: files Index: glibc-2.33/nss/tst-reload2.root/subdir/etc/hosts =================================================================== --- /dev/null +++ glibc-2.33/nss/tst-reload2.root/subdir/etc/hosts @@ -0,0 +1 @@ +1.2.3.4 test2 Index: glibc-2.33/nss/tst-reload2.root/subdir/etc/nsswitch.conf =================================================================== --- glibc-2.33.orig/nss/tst-reload2.root/subdir/etc/nsswitch.conf +++ glibc-2.33/nss/tst-reload2.root/subdir/etc/nsswitch.conf @@ -1,2 +1,3 @@ passwd: test2 group: files +hosts: test1 ++++++ x86-isa-level.patch ++++++ >From ee9f98d9cac12e843ca59c6e4d4b225f58a66727 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" <hjl.to...@gmail.com> Date: Tue, 2 Feb 2021 13:45:58 -0800 Subject: [PATCH] x86: Set minimum x86-64 level marker [BZ #27318] Since the full ISA set used in an ELF binary is unknown to compiler, an x86-64 ISA level marker indicates the minimum, not maximum, ISA set required to run such an ELF binary. We never guarantee a library with an x86-64 ISA level v3 marker doesn't contain other ISAs beyond x86-64 ISA level v3, like AVX VNNI. We check the x86-64 ISA level marker for the minimum ISA set. Since -march=sandybridge enables only some ISAs in x86-64 ISA level v3, we should set the needed ISA marker to v2. Otherwise, libc is compiled with -march=sandybridge will fail to run on Sandy Bridge: $ ./elf/ld.so ./libc.so ./libc.so: (p) CPU ISA level is lower than required: needed: 7; got: 3 Set the minimum, instead of maximum, x86-64 ISA level marker should have no impact on the glibc-hwcaps directory assignment logic in ldconfig nor ld.so. (cherry picked from commit 339bf918ea4830fb35614632e96f3aab3237adce) --- config.h.in | 6 ++++++ sysdeps/x86/configure | 28 ++++++++++++++++++++++++++++ sysdeps/x86/configure.ac | 16 ++++++++++++++++ sysdeps/x86/isa-level.c | 25 ++++++++++++++----------- 4 files changed, 64 insertions(+), 11 deletions(-) Index: glibc-2.33/config.h.in =================================================================== --- glibc-2.33.orig/config.h.in +++ glibc-2.33/config.h.in @@ -275,4 +275,10 @@ /* Define if x86 ISA level should be included in shared libraries. */ #undef INCLUDE_X86_ISA_LEVEL +/* Define if -msahf is enabled by default on x86. */ +#undef HAVE_X86_LAHF_SAHF + +/* Define if -mmovbe is enabled by default on x86. */ +#undef HAVE_X86_MOVBE + #endif Index: glibc-2.33/sysdeps/x86/configure =================================================================== --- glibc-2.33.orig/sysdeps/x86/configure +++ glibc-2.33/sysdeps/x86/configure @@ -126,6 +126,8 @@ cat > conftest2.S <<EOF 4: EOF libc_cv_include_x86_isa_level=no +libc_cv_have_x86_lahf_sahf=no +libc_cv_have_x86_movbe=no if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 @@ -135,6 +137,24 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l` if test "$count" = 1; then libc_cv_include_x86_isa_level=yes + cat > conftest.c <<EOF +EOF + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } | grep -q "\-msahf"; then + libc_cv_have_x86_lahf_sahf=yes + fi + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } | grep -q "\-mmovbe"; then + libc_cv_have_x86_movbe=yes + fi fi fi rm -f conftest* @@ -145,5 +165,13 @@ if test $libc_cv_include_x86_isa_level = $as_echo "#define INCLUDE_X86_ISA_LEVEL 1" >>confdefs.h fi +if test $libc_cv_have_x86_lahf_sahf = yes; then + $as_echo "#define HAVE_X86_LAHF_SAHF 1" >>confdefs.h + +fi +if test $libc_cv_have_x86_movbe = yes; then + $as_echo "#define HAVE_X86_MOVBE 1" >>confdefs.h + +fi config_vars="$config_vars enable-x86-isa-level = $libc_cv_include_x86_isa_level" Index: glibc-2.33/sysdeps/x86/configure.ac =================================================================== --- glibc-2.33.orig/sysdeps/x86/configure.ac +++ glibc-2.33/sysdeps/x86/configure.ac @@ -98,14 +98,30 @@ cat > conftest2.S <<EOF 4: EOF libc_cv_include_x86_isa_level=no +libc_cv_have_x86_lahf_sahf=no +libc_cv_have_x86_movbe=no if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S); then count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l` if test "$count" = 1; then libc_cv_include_x86_isa_level=yes + cat > conftest.c <<EOF +EOF + if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c) | grep -q "\-msahf"; then + libc_cv_have_x86_lahf_sahf=yes + fi + if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - conftest.c) | grep -q "\-mmovbe"; then + libc_cv_have_x86_movbe=yes + fi fi fi rm -f conftest*]) if test $libc_cv_include_x86_isa_level = yes; then AC_DEFINE(INCLUDE_X86_ISA_LEVEL) fi +if test $libc_cv_have_x86_lahf_sahf = yes; then + AC_DEFINE(HAVE_X86_LAHF_SAHF) +fi +if test $libc_cv_have_x86_movbe = yes; then + AC_DEFINE(HAVE_X86_MOVBE) +fi LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level]) Index: glibc-2.33/sysdeps/x86/isa-level.c =================================================================== --- glibc-2.33.orig/sysdeps/x86/isa-level.c +++ glibc-2.33/sysdeps/x86/isa-level.c @@ -29,32 +29,35 @@ /* ELF program property for x86 ISA level. */ #ifdef INCLUDE_X86_ISA_LEVEL -# if defined __x86_64__ || defined __FXSR__ || !defined _SOFT_FLOAT \ - || defined __MMX__ || defined __SSE__ || defined __SSE2__ +# if defined __SSE__ && defined __SSE2__ +/* NB: ISAs, excluding MMX, in x86-64 ISA level baseline are used. */ # define ISA_BASELINE GNU_PROPERTY_X86_ISA_1_BASELINE # else # define ISA_BASELINE 0 # endif -# if defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \ - || (defined __x86_64__ && defined __LAHF_SAHF__) \ - || defined __POPCNT__ || defined __SSE3__ \ - || defined __SSSE3__ || defined __SSE4_1__ || defined __SSE4_2__ +# if ISA_BASELINE && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \ + && defined HAVE_X86_LAHF_SAHF && defined __POPCNT__ \ + && defined __SSE3__ && defined __SSSE3__ && defined __SSE4_1__ \ + && defined __SSE4_2__ +/* NB: ISAs in x86-64 ISA level v2 are used. */ # define ISA_V2 GNU_PROPERTY_X86_ISA_1_V2 # else # define ISA_V2 0 # endif -# if defined __AVX__ || defined __AVX2__ || defined __F16C__ \ - || defined __FMA__ || defined __LZCNT__ || defined __MOVBE__ \ - || defined __XSAVE__ +# if ISA_V2 && defined __AVX__ && defined __AVX2__ && defined __F16C__ \ + && defined __FMA__ && defined __LZCNT__ && defined HAVE_X86_MOVBE +/* NB: ISAs in x86-64 ISA level v3 are used. */ # define ISA_V3 GNU_PROPERTY_X86_ISA_1_V3 # else # define ISA_V3 0 # endif -# if defined __AVX512F__ || defined __AVX512BW__ || defined __AVX512CD__ \ - || defined __AVX512DQ__ || defined __AVX512VL__ +# if ISA_V3 && defined __AVX512F__ && defined __AVX512BW__ \ + && defined __AVX512CD__ && defined __AVX512DQ__ \ + && defined __AVX512VL__ +/* NB: ISAs in x86-64 ISA level v4 are used. */ # define ISA_V4 GNU_PROPERTY_X86_ISA_1_V4 # else # define ISA_V4 0