Skip to contentSkip to conversation

nfs-utils: Fix host path contamination building locktest

PATCH Superseded Khem Raj 2 participants 4 messages Jul 25, 2023 – Aug 4, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 nfs-utils: Fix host path contamination building locktest

---
 ...t-Makefile.am-Do-not-use-build-flags.patch | 36 +++++++++++++++++++
 .../nfs-utils/nfs-utils_2.6.3.bb              |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-locktest-Makefile.am-Do-not-use-build-flags.patch
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-locktest-Makefile.am-Do-not-use-build-flags.patch new file +36 -0
new file mode 100644
index 00000000000..351407ddcd4
@@ -0,0 +1,36 @@
+From 9efa7a0d37665d9bb0f46d2407883a5ab42c2b84 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 24 Jul 2023 20:39:16 -0700
+Subject: [PATCH] locktest: Makefile.am: Do not use build flags
+
+Using CFLAGS_FOR_BUILD etc. here means it is using wrong flags
+when thse flags are speficied different than target flags which
+is common when cross-building. It can pass wrong paths to linker
+and it would find incompatible libraries during link since they
+are from host system and target maybe not same as build host.
+
+Fixes subtle errors like
+| aarch64-yoe-linux-ld.lld: error: /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/nfs-utils/2.6.3-r0/recipe-sysroot-native/usr/lib/libsqlite3.so is incompatible with elf64-littleaarch64
+
+Upstream-Status: Submitted [https://marc.info/?l=linux-nfs&m=169025681008001&w=2]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tools/locktest/Makefile.am | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/tools/locktest/Makefile.am b/tools/locktest/Makefile.am
+index e8914655..2fd36971 100644
+--- a/tools/locktest/Makefile.am
++++ b/tools/locktest/Makefile.am
+@@ -2,8 +2,5 @@
+ 
+ noinst_PROGRAMS = testlk
+ testlk_SOURCES = testlk.c
+-testlk_CFLAGS=$(CFLAGS_FOR_BUILD)
+-testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+-testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD)
+ 
+ MAINTAINERCLEANFILES = Makefile.in
+-- 
+2.41.0
+
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.3.bb +1 -0
index 44542857897..02b62e218c0 100644
@@ -31,6 +31,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
            file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \
            file://clang-warnings.patch \
            file://0001-configure.ac-libevent-and-libsqlite3-checked-when-nf.patch \
+	   file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \
            "
 SRC_URI[sha256sum] = "38d89e853a71d3c560ff026af3d969d75e24f782ff68324e76261fe0344459e1"
 
Signature · 1 line
2.41.0
author
#1 lore raw

PATCH 2/2 glibc: Enable mathvec when sve is available as tune feature

---
 meta/recipes-core/glibc/glibc_2.37.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/glibc/glibc_2.37.bb +2 -1
index 8ff9801ed4b..4290f3e6e4f 100644
@@ -85,7 +85,8 @@ EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
 EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}"
 EXTRA_OECONF:append:x86-64 = " --enable-cet"
 
-PACKAGECONFIG ??= "nscd memory-tagging"
+PACKAGECONFIG ??= "nscd memory-tagging ${@bb.utils.filter('TUNE_FEATURES', 'sve', d)}"
+
 PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd"
 PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging"
 PACKAGECONFIG[sve] = "--enable-mathvec,--disable-mathvec"
Signature · 1 line
2.41.0
#2 lore raw

Re: [OE-core] [PATCH 2/2] glibc: Enable mathvec when sve is available as tune feature

Quoted 17 lines · Khem Raj via lists.openembedded.org

---
meta/recipes-core/glibc/glibc_2.37.bb | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/glibc/glibc_2.37.bb +0 -0
index 8ff9801ed4b..4290f3e6e4f 100644
@@ -85,7 +85,8 @@ EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"

EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}" EXTRA_OECONF:append:x86-64 = " --enable-cet"

meta/recipes-core/glibc/glibc_2.37.bb +2 -1
-PACKAGECONFIG ??= "nscd memory-tagging"
+PACKAGECONFIG ??= "nscd memory-tagging ${@bb.utils.filter('TUNE_FEATURES', 'sve', d)}"
+
Quoted 3 lines

PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd" PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging" PACKAGECONFIG[sve] = "--enable-mathvec,--disable-mathvec"

This is the wrong thing to do, imho.

mathvec has existed since glibc 2.22 for x86-64 and only with 2.38 did it gain aarch64 support, where it has both NEON and SVE (optional in 8.2+) implementations.

Fedora 38 and Debian 11 both have a libmvec.so, so it looks like we should be turning it on by default for the relevant architectures (x86-64 for <2.38, x86-64 and aarch64 for 2.38+).

Ross

author
#3 lore raw

Re: [OE-core] [PATCH 2/2] glibc: Enable mathvec when sve is available as tune feature

Quoted 25 lines · Ross Burton
Quoted 17 lines · Khem Raj via lists.openembedded.org

---
meta/recipes-core/glibc/glibc_2.37.bb | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/glibc/glibc_2.37.bb +0 -0
index 8ff9801ed4b..4290f3e6e4f 100644
@@ -85,7 +85,8 @@ EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"

EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}" EXTRA_OECONF:append:x86-64 = " --enable-cet"

meta/recipes-core/glibc/glibc_2.37.bb +2 -1
-PACKAGECONFIG ??= "nscd memory-tagging"
+PACKAGECONFIG ??= "nscd memory-tagging ${@bb.utils.filter('TUNE_FEATURES', 'sve', d)}"
+
Quoted 3 lines

PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd" PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging" PACKAGECONFIG[sve] = "--enable-mathvec,--disable-mathvec"

This is the wrong thing to do, imho.

Quoted 3 lines

mathvec has existed since glibc 2.22 for x86-64 and only with 2.38 did it gain aarch64 support, where it has both NEON and SVE (optional in 8.2+) implementations.

Fedora 38 and Debian 11 both have a libmvec.so, so it looks like we should be turning it on by default for the relevant architectures (x86-64 for <2.38, x86-64 and aarch64 for 2.38+).

these distros do not specify -mcpu like OE does and it lets glibc override these options which it does when detecting SVE
but it fails for OE due to compiler flags because it inserts itself on top of glibc defaults

Quoted 2 lines

Ross