All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc
@ 2018-07-26 17:15 Marcin Niestroj
  2018-07-26 17:15 ` [Buildroot] [PATCH v3 2/2] package/lvm2: bump version to 2.02.180 Marcin Niestroj
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Marcin Niestroj @ 2018-07-26 17:15 UTC (permalink / raw)
  To: buildroot

When using uclibc libdevmapper.so was calling dm_task_get_info_base()
function recursively, leading to segmentation fault. This was
happening because uclibc linker loader just takes first existing
'dm_task_get_info' (which is 'dm_task_get_info_base') symbol in elf
binary, instead of default version.

Add upstreamable lvm2 patch [1], which introduces
--enable-symvers[=STYLE] switch. Use that switch to disable symbol
versions, as we do not plan to support binaries compiled against
old libdevmapper library.

[1] https://www.redhat.com/archives/dm-devel/2018-July/msg00187.html

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
---
Changes v2 -> v3: none

Changes v1 -> v2:
 * Add SoB in patch itself (suggested by Thomas)
 * Make this patch first in series, so it can be applied for LTS
   branches (sugested by Thomas)
 * Rebase patch on current lvm2 Buildroot master version (2.02.173),
   so it can apply cleanly

 ...gure-Introduce-enable-symvers-option.patch | 277 ++++++++++++++++++
 package/lvm2/lvm2.mk                          |   3 +-
 2 files changed, 279 insertions(+), 1 deletion(-)
 create mode 100644 package/lvm2/0001-configure-Introduce-enable-symvers-option.patch

diff --git a/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch b/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch
new file mode 100644
index 0000000000..8ca39c2cab
--- /dev/null
+++ b/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch
@@ -0,0 +1,277 @@
+From f563334a76e31442f7b8693d2d350e6981c51c46 Mon Sep 17 00:00:00 2001
+From: Marcin Niestroj <m.niestroj@grinn-global.com>
+Date: Fri, 20 Jul 2018 14:26:44 +0200
+Subject: [PATCH] configure: Introduce --enable-symvers option
+
+Only few libc (e.g. glibc) libraries support full symbol version
+resolution in runtime. There are lot of standard libraries that do not
+support that, such as dietlibc, musl and uclibc. Hence there is no
+reason to generate symbol versions when compiling against them.
+
+Additionally libdevmapper.so was broken when compiled against
+uclibc. Runtime linker loader caused calling dm_task_get_info_base()
+function recursively, leading to segmentation fault.
+
+Introduce --enable-symvers[=STYLE] option, which allows to choose
+between gnu and disabled symbol versioning. By default gnu symbol
+versioning is used to provide backward compatibility.
+__GNUC__ check is replaced now with GNU_SYMVER, which is generated by
+configure script. Additionally ld version script is included only in
+case of gnu option, which slightly reduces output size.
+
+Providing --disable-symvers to configure script when building against
+uclibc library fixes segmentation fault error described above, due to
+lack of several versions of the same symbol in libdevmapper.so
+library.
+
+Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
+---
+ configure                 | 32 ++++++++++++++++++++++++++++++--
+ configure.in              | 28 +++++++++++++++++++++++++---
+ include/configure.h.in    |  3 +++
+ lib/misc/lib.h            | 10 +++++-----
+ libdm/datastruct/bitset.c |  5 +----
+ libdm/ioctl/libdm-iface.c |  2 +-
+ libdm/libdm-deptree.c     |  2 +-
+ libdm/libdm-stats.c       |  2 +-
+ 8 files changed, 67 insertions(+), 17 deletions(-)
+
+diff --git a/configure b/configure
+index e1ae0e884..c5d11c1b6 100755
+--- a/configure
++++ b/configure
+@@ -985,6 +985,7 @@ enable_fsadm
+ enable_blkdeactivate
+ enable_dmeventd
+ enable_selinux
++enable_symvers
+ enable_nls
+ with_localedir
+ with_confdir
+@@ -1729,6 +1730,9 @@ Optional Features:
+   --disable-blkdeactivate disable blkdeactivate
+   --enable-dmeventd       enable the device-mapper event daemon
+   --disable-selinux       disable selinux support
++  --enable-symvers[=STYLE]
++                          enables symbol versioning of the shared library
++                          [default=gnu]
+   --enable-nls            enable Native Language Support
+ 
+ Optional Packages:
+@@ -3169,7 +3173,6 @@ if test -z "$CFLAGS"; then :
+ fi
+ case "$host_os" in
+ 	linux*)
+-		CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ 		ELDFLAGS="-Wl,--export-dynamic"
+ 		# FIXME Generate list and use --dynamic-list=.dlopen.sym
+ 		CLDWHOLEARCHIVE="-Wl,-whole-archive"
+@@ -3190,7 +3193,6 @@ case "$host_os" in
+ 		;;
+ 	darwin*)
+ 		CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
+-		CLDFLAGS="$CLDFLAGS"
+ 		ELDFLAGS=
+ 		CLDWHOLEARCHIVE="-all_load"
+ 		CLDNOWHOLEARCHIVE=
+@@ -14609,6 +14611,32 @@ done
+ 	LIBS=$lvm_saved_libs
+ fi
+ 
++################################################################################
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable symbol versioning" >&5
++$as_echo_n "checking whether to enable symbol versioning... " >&6; }
++# Check whether --enable-symvers was given.
++if test "${enable_symvers+set}" = set; then :
++  enableval=$enable_symvers;
++  case "$enableval" in
++    gnu|no) ;;
++    *) as_fn_error $? "Unknown argument to enable/disable symvers" "$LINENO" 5 ;;
++  esac
++else
++  enable_symvers=gnu
++fi
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_symvers" >&5
++$as_echo "$enable_symvers" >&6; }
++
++if test x$GCC = xyes && test x$enable_symvers = xgnu ; then
++
++$as_echo "#define GNU_SYMVER 1" >>confdefs.h
++
++  case "$host_os" in
++    linux*) CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym" ;;
++  esac
++fi
++
+ ################################################################################
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable internationalisation" >&5
+ $as_echo_n "checking whether to enable internationalisation... " >&6; }
+diff --git a/configure.in b/configure.in
+index 2e5e015c8..09c390850 100644
+--- a/configure.in
++++ b/configure.in
+@@ -30,12 +30,10 @@ AC_CANONICAL_TARGET([])
+ AS_IF([test -z "$CFLAGS"], [COPTIMISE_FLAG="-O2"])
+ case "$host_os" in
+ 	linux*)
+-		CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ 		ELDFLAGS="-Wl,--export-dynamic"
+ 		# FIXME Generate list and use --dynamic-list=.dlopen.sym
+ 		CLDWHOLEARCHIVE="-Wl,-whole-archive"
+ 		CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
+-		LDDEPS="$LDDEPS .export.sym"
+ 		LIB_SUFFIX=so
+ 		DEVMAPPER=yes
+ 		BUILD_LVMETAD=no
+@@ -51,7 +49,6 @@ case "$host_os" in
+ 		;;
+ 	darwin*)
+ 		CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
+-		CLDFLAGS="$CLDFLAGS"
+ 		ELDFLAGS=
+ 		CLDWHOLEARCHIVE="-all_load"
+ 		CLDNOWHOLEARCHIVE=
+@@ -1742,6 +1739,31 @@ package as well (which may be called readline-devel or something similar).])
+ 	LIBS=$lvm_saved_libs
+ fi
+ 
++################################################################################
++dnl -- Symbol versioning
++AC_MSG_CHECKING(whether to enable symbol versioning)
++AC_ARG_ENABLE(symvers,
++              AC_HELP_STRING([--enable-symvers[[[=STYLE]]]],
++                             [enables symbol versioning of the shared library [default=gnu]]),
++                             [
++  case "$enableval" in
++    gnu|no) ;;
++    *) AC_MSG_ERROR(Unknown argument to enable/disable symvers) ;;
++  esac],
++                             enable_symvers=gnu)
++AC_MSG_RESULT($enable_symvers)
++
++if test x$GCC = xyes && test x$enable_symvers = xgnu ; then
++  AC_DEFINE(GNU_SYMVER, 1,
++            [Define to use GNU versioning in the shared library.])
++  case "$host_os" in
++    linux*)
++      CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
++      LDDEPS="$LDDEPS .export.sym"
++      ;;
++  esac
++fi
++
+ ################################################################################
+ dnl -- Internationalisation stuff
+ AC_MSG_CHECKING(whether to enable internationalisation)
+diff --git a/include/configure.h.in b/include/configure.h.in
+index 51726506c..3fc181b1e 100644
+--- a/include/configure.h.in
++++ b/include/configure.h.in
+@@ -151,6 +151,9 @@
+ /* Path to fsadm binary. */
+ #undef FSADM_PATH
+ 
++/* Define to use GNU versioning in the shared library. */
++#undef GNU_SYMVER
++
+ /* Define to 1 if you have the `alarm' function. */
+ #undef HAVE_ALARM
+ 
+diff --git a/lib/misc/lib.h b/lib/misc/lib.h
+index 8ed06f81d..9b3ce8a03 100644
+--- a/lib/misc/lib.h
++++ b/lib/misc/lib.h
+@@ -42,16 +42,16 @@
+  * macro DM_EXPORT_SYMBOL to export the function and bind it to the
+  * specified version string.
+  *
+- * Since versioning is only available when compiling with GCC the entire
+- * compatibility version should be enclosed in '#if defined(__GNUC__)',
+- * for example:
++ * Since versioning is only available when compiling with GCC
++ * and GLIBC the entire compatibility version should be enclosed
++ * in '#if defined(GNU_SYMVER)', for example:
+  *
+  *   int dm_foo(int bar)
+  *   {
+  *     return bar;
+  *   }
+  *
+- *   #if defined(__GNUC__)
++ *   #if defined(GNU_SYMVER)
+  *   // Backward compatible dm_foo() version 1.02.104
+  *   int dm_foo_v1_02_104(void);
+  *   int dm_foo_v1_02_104(void)
+@@ -68,7 +68,7 @@
+  * versions of library symbols prior to the introduction of symbol
+  * versioning: it must never be used for new symbols.
+  */
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ #define DM_EXPORT_SYMBOL(func, ver) \
+ 	__asm__(".symver " #func "_v" #ver ", " #func "@DM_" #ver )
+ #define DM_EXPORT_SYMBOL_BASE(func) \
+diff --git a/libdm/datastruct/bitset.c b/libdm/datastruct/bitset.c
+index b0826e1eb..2ec3f8f84 100644
+--- a/libdm/datastruct/bitset.c
++++ b/libdm/datastruct/bitset.c
+@@ -242,7 +242,7 @@ bad:
+ 	return NULL;
+ }
+ 
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ /*
+  * Maintain backward compatibility with older versions that did not
+  * accept a 'min_num_bits' argument to dm_bitset_parse_list().
+@@ -253,7 +253,4 @@ dm_bitset_t dm_bitset_parse_list_v1_02_129(const char *str, struct dm_pool *mem)
+ 	return dm_bitset_parse_list(str, mem, 0);
+ }
+ DM_EXPORT_SYMBOL(dm_bitset_parse_list, 1_02_129);
+-
+-#else /* if defined(__GNUC__) */
+-
+ #endif
+diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
+index c47e08467..b98afb15d 100644
+--- a/libdm/ioctl/libdm-iface.c
++++ b/libdm/ioctl/libdm-iface.c
+@@ -2137,7 +2137,7 @@ void dm_lib_exit(void)
+ 	_version_checked = 0;
+ }
+ 
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ /*
+  * Maintain binary backward compatibility.
+  * Version script mechanism works with 'gcc' compatible compilers only.
+diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
+index cf4fd62e7..474871da5 100644
+--- a/libdm/libdm-deptree.c
++++ b/libdm/libdm-deptree.c
+@@ -4110,7 +4110,7 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode,
+ 	dnode->callback_data = data;
+ }
+ 
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ /*
+  * Backward compatible implementations.
+  *
+diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
+index bc498675f..d424928c7 100644
+--- a/libdm/libdm-stats.c
++++ b/libdm/libdm-stats.c
+@@ -5064,7 +5064,7 @@ int dm_stats_start_filemapd(int fd, uint64_t group_id, const char *path,
+  * current dm_stats_create_region() version.
+  */
+ 
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ int dm_stats_create_region_v1_02_106(struct dm_stats *dms, uint64_t *region_id,
+ 				     uint64_t start, uint64_t len, int64_t step,
+ 				     int precise, const char *program_id,
+-- 
+2.18.0
+
diff --git a/package/lvm2/lvm2.mk b/package/lvm2/lvm2.mk
index 20e0dd0d5c..ccdc2c38e6 100644
--- a/package/lvm2/lvm2.mk
+++ b/package/lvm2/lvm2.mk
@@ -19,7 +19,8 @@ LVM2_CONF_OPTS += \
 	--enable-pkgconfig \
 	--enable-cmdlib \
 	--enable-dmeventd \
-	--disable-nls
+	--disable-nls \
+	--disable-symvers
 
 LVM2_DEPENDENCIES += host-pkgconf
 
-- 
2.18.0

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

* [Buildroot] [PATCH v3 2/2] package/lvm2: bump version to 2.02.180
  2018-07-26 17:15 [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Marcin Niestroj
@ 2018-07-26 17:15 ` Marcin Niestroj
  2018-08-14 21:39   ` Thomas Petazzoni
  2018-08-14 20:47 ` [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Thomas Petazzoni
  2018-08-24  8:34 ` Peter Korsgaard
  2 siblings, 1 reply; 7+ messages in thread
From: Marcin Niestroj @ 2018-07-26 17:15 UTC (permalink / raw)
  To: buildroot

lvm2 starting from version 2.02.178 depends on libaio library.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
---
Changes v2 -> v3:
 * Add missing libaio dependency in luksmeta (suggested by Baruch)

Changes v1 -> v2:
 * Add libaio dependencies for all packages that select lvm2
   (suggested by Baruch)
 * Adjust lvm2 patch in 'PATCH 1/2' to new lvm2 version

 package/cryptsetup/Config.in                  |  2 +
 package/dmraid/Config.in                      |  2 +
 package/docker-engine/Config.in               |  1 +
 package/luksmeta/Config.in                    |  2 +
 ...gure-Introduce-enable-symvers-option.patch | 55 ++++++++++---------
 package/lvm2/Config.in                        |  3 +
 package/lvm2/lvm2.hash                        |  4 +-
 package/lvm2/lvm2.mk                          |  6 +-
 package/udisks/Config.in                      |  3 +
 9 files changed, 46 insertions(+), 32 deletions(-)

diff --git a/package/cryptsetup/Config.in b/package/cryptsetup/Config.in
index 7322a4baf6..e4500b1cf2 100644
--- a/package/cryptsetup/Config.in
+++ b/package/cryptsetup/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_CRYPTSETUP
 	bool "cryptsetup"
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS # lvm2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # lvm2
 	depends on BR2_USE_MMU # lvm2
 	depends on !BR2_STATIC_LIBS # lvm2
@@ -17,5 +18,6 @@ config BR2_PACKAGE_CRYPTSETUP
 
 comment "cryptsetup needs a toolchain w/ threads, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/dmraid/Config.in b/package/dmraid/Config.in
index aa98c853a1..ffa75a7084 100644
--- a/package/dmraid/Config.in
+++ b/package/dmraid/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_DMRAID
 	bool "dmraid"
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS # lvm2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # lvm2
 	depends on BR2_USE_MMU # lvm2
 	depends on !BR2_STATIC_LIBS # lvm2
@@ -14,4 +15,5 @@ config BR2_PACKAGE_DMRAID
 
 comment "dmraid needs a toolchain w/ threads, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/docker-engine/Config.in b/package/docker-engine/Config.in
index 8feb11b48c..1f417d1c53 100644
--- a/package/docker-engine/Config.in
+++ b/package/docker-engine/Config.in
@@ -44,6 +44,7 @@ config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS
 
 config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER
 	bool "devicemapper filesystem driver"
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS # lvm2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # lvm2
 	depends on BR2_USE_MMU # lvm2
 	depends on !BR2_STATIC_LIBS # lvm2
diff --git a/package/luksmeta/Config.in b/package/luksmeta/Config.in
index ddc9b6f3bf..373d5f7517 100644
--- a/package/luksmeta/Config.in
+++ b/package/luksmeta/Config.in
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_LUKSMETA
 	bool "luksmeta"
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS # cryptsetup -> lvm2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # cryptsetup -> lvm2
 	depends on BR2_USE_MMU # cryptsetup -> lvm2
 	depends on !BR2_STATIC_LIBS # cryptsetup -> lvm2
@@ -13,5 +14,6 @@ config BR2_PACKAGE_LUKSMETA
 
 comment "luksmeta needs a toolchain w/ threads, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch b/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch
index 8ca39c2cab..7ef153313c 100644
--- a/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch
+++ b/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch
@@ -1,4 +1,4 @@
-From f563334a76e31442f7b8693d2d350e6981c51c46 Mon Sep 17 00:00:00 2001
+From 94d71c49eb1682a73465eb162b0a059561168bb2 Mon Sep 17 00:00:00 2001
 From: Marcin Niestroj <m.niestroj@grinn-global.com>
 Date: Fri, 20 Jul 2018 14:26:44 +0200
 Subject: [PATCH] configure: Introduce --enable-symvers option
@@ -27,7 +27,7 @@ library.
 Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
 ---
  configure                 | 32 ++++++++++++++++++++++++++++++--
- configure.in              | 28 +++++++++++++++++++++++++---
+ configure.ac              | 28 +++++++++++++++++++++++++---
  include/configure.h.in    |  3 +++
  lib/misc/lib.h            | 10 +++++-----
  libdm/datastruct/bitset.c |  5 +----
@@ -37,10 +37,10 @@ Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
  8 files changed, 67 insertions(+), 17 deletions(-)
 
 diff --git a/configure b/configure
-index e1ae0e884..c5d11c1b6 100755
+index 7d945dfa8..94cd6b1ea 100755
 --- a/configure
 +++ b/configure
-@@ -985,6 +985,7 @@ enable_fsadm
+@@ -975,6 +975,7 @@ enable_fsadm
  enable_blkdeactivate
  enable_dmeventd
  enable_selinux
@@ -48,7 +48,7 @@ index e1ae0e884..c5d11c1b6 100755
  enable_nls
  with_localedir
  with_confdir
-@@ -1729,6 +1730,9 @@ Optional Features:
+@@ -1725,6 +1726,9 @@ Optional Features:
    --disable-blkdeactivate disable blkdeactivate
    --enable-dmeventd       enable the device-mapper event daemon
    --disable-selinux       disable selinux support
@@ -58,15 +58,15 @@ index e1ae0e884..c5d11c1b6 100755
    --enable-nls            enable Native Language Support
  
  Optional Packages:
-@@ -3169,7 +3173,6 @@ if test -z "$CFLAGS"; then :
+@@ -3156,7 +3160,6 @@ if test -z "$CFLAGS"; then :
  fi
  case "$host_os" in
  	linux*)
 -		CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ 		# equivalent to -rdynamic
  		ELDFLAGS="-Wl,--export-dynamic"
  		# FIXME Generate list and use --dynamic-list=.dlopen.sym
- 		CLDWHOLEARCHIVE="-Wl,-whole-archive"
-@@ -3190,7 +3193,6 @@ case "$host_os" in
+@@ -3178,7 +3181,6 @@ case "$host_os" in
  		;;
  	darwin*)
  		CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
@@ -74,7 +74,7 @@ index e1ae0e884..c5d11c1b6 100755
  		ELDFLAGS=
  		CLDWHOLEARCHIVE="-all_load"
  		CLDNOWHOLEARCHIVE=
-@@ -14609,6 +14611,32 @@ done
+@@ -14401,6 +14403,32 @@ done
  	LIBS=$lvm_saved_libs
  fi
  
@@ -107,15 +107,16 @@ index e1ae0e884..c5d11c1b6 100755
  ################################################################################
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable internationalisation" >&5
  $as_echo_n "checking whether to enable internationalisation... " >&6; }
-diff --git a/configure.in b/configure.in
-index 2e5e015c8..09c390850 100644
---- a/configure.in
-+++ b/configure.in
-@@ -30,12 +30,10 @@ AC_CANONICAL_TARGET([])
+diff --git a/configure.ac b/configure.ac
+index e427708cd..2e8712f92 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -30,13 +30,11 @@ AC_CANONICAL_TARGET([])
  AS_IF([test -z "$CFLAGS"], [COPTIMISE_FLAG="-O2"])
  case "$host_os" in
  	linux*)
 -		CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ 		# equivalent to -rdynamic
  		ELDFLAGS="-Wl,--export-dynamic"
  		# FIXME Generate list and use --dynamic-list=.dlopen.sym
  		CLDWHOLEARCHIVE="-Wl,-whole-archive"
@@ -124,7 +125,7 @@ index 2e5e015c8..09c390850 100644
  		LIB_SUFFIX=so
  		DEVMAPPER=yes
  		BUILD_LVMETAD=no
-@@ -51,7 +49,6 @@ case "$host_os" in
+@@ -52,7 +50,6 @@ case "$host_os" in
  		;;
  	darwin*)
  		CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
@@ -132,7 +133,7 @@ index 2e5e015c8..09c390850 100644
  		ELDFLAGS=
  		CLDWHOLEARCHIVE="-all_load"
  		CLDNOWHOLEARCHIVE=
-@@ -1742,6 +1739,31 @@ package as well (which may be called readline-devel or something similar).])
+@@ -1656,6 +1653,31 @@ package as well (which may be called readline-devel or something similar).])
  	LIBS=$lvm_saved_libs
  fi
  
@@ -165,10 +166,10 @@ index 2e5e015c8..09c390850 100644
  dnl -- Internationalisation stuff
  AC_MSG_CHECKING(whether to enable internationalisation)
 diff --git a/include/configure.h.in b/include/configure.h.in
-index 51726506c..3fc181b1e 100644
+index 15fd150ed..7a07a10ef 100644
 --- a/include/configure.h.in
 +++ b/include/configure.h.in
-@@ -151,6 +151,9 @@
+@@ -147,6 +147,9 @@
  /* Path to fsadm binary. */
  #undef FSADM_PATH
  
@@ -179,10 +180,10 @@ index 51726506c..3fc181b1e 100644
  #undef HAVE_ALARM
  
 diff --git a/lib/misc/lib.h b/lib/misc/lib.h
-index 8ed06f81d..9b3ce8a03 100644
+index d7fa5c721..7cf98f932 100644
 --- a/lib/misc/lib.h
 +++ b/lib/misc/lib.h
-@@ -42,16 +42,16 @@
+@@ -41,16 +41,16 @@
   * macro DM_EXPORT_SYMBOL to export the function and bind it to the
   * specified version string.
   *
@@ -203,7 +204,7 @@ index 8ed06f81d..9b3ce8a03 100644
   *   // Backward compatible dm_foo() version 1.02.104
   *   int dm_foo_v1_02_104(void);
   *   int dm_foo_v1_02_104(void)
-@@ -68,7 +68,7 @@
+@@ -67,7 +67,7 @@
   * versions of library symbols prior to the introduction of symbol
   * versioning: it must never be used for new symbols.
   */
@@ -234,10 +235,10 @@ index b0826e1eb..2ec3f8f84 100644
 -
  #endif
 diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
-index c47e08467..b98afb15d 100644
+index 769b69c1b..28e2eadee 100644
 --- a/libdm/ioctl/libdm-iface.c
 +++ b/libdm/ioctl/libdm-iface.c
-@@ -2137,7 +2137,7 @@ void dm_lib_exit(void)
+@@ -2145,7 +2145,7 @@ void dm_lib_exit(void)
  	_version_checked = 0;
  }
  
@@ -247,10 +248,10 @@ index c47e08467..b98afb15d 100644
   * Maintain binary backward compatibility.
   * Version script mechanism works with 'gcc' compatible compilers only.
 diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
-index cf4fd62e7..474871da5 100644
+index ab0545659..00651c0b2 100644
 --- a/libdm/libdm-deptree.c
 +++ b/libdm/libdm-deptree.c
-@@ -4110,7 +4110,7 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode,
+@@ -3797,7 +3797,7 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode,
  	dnode->callback_data = data;
  }
  
@@ -260,10 +261,10 @@ index cf4fd62e7..474871da5 100644
   * Backward compatible implementations.
   *
 diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
-index bc498675f..d424928c7 100644
+index 94ad380e0..76efbbe35 100644
 --- a/libdm/libdm-stats.c
 +++ b/libdm/libdm-stats.c
-@@ -5064,7 +5064,7 @@ int dm_stats_start_filemapd(int fd, uint64_t group_id, const char *path,
+@@ -5065,7 +5065,7 @@ int dm_stats_start_filemapd(int fd, uint64_t group_id, const char *path,
   * current dm_stats_create_region() version.
   */
  
diff --git a/package/lvm2/Config.in b/package/lvm2/Config.in
index 0dd6d53b4a..5f706982cd 100644
--- a/package/lvm2/Config.in
+++ b/package/lvm2/Config.in
@@ -1,8 +1,10 @@
 config BR2_PACKAGE_LVM2
 	bool "lvm2 & device mapper"
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU # needs fork()
 	depends on !BR2_STATIC_LIBS # It fails to build statically
+	select BR2_PACKAGE_LIBAIO
 	help
 	  This is LVM2, the rewrite of The Linux Logical Volume Manager.
 	  LVM supports enterprise level volume management of disk and
@@ -50,4 +52,5 @@ endif
 
 comment "lvm2 needs a toolchain w/ threads, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/lvm2/lvm2.hash b/package/lvm2/lvm2.hash
index b0dfcfcef3..697a413995 100644
--- a/package/lvm2/lvm2.hash
+++ b/package/lvm2/lvm2.hash
@@ -1,5 +1,5 @@
-# From ftp://sources.redhat.com/pub/lvm2/releases/sha512.sum
-sha512 c2ea8beafe006abf9282f51ec98600fd0ebff816d53c10ecbb19bbf336ada4825135cf9c92ccd364afb18f8b1d7e163eff5bdec8dfdd70dfb9ba45db2f6bdd5e  LVM2.2.02.173.tgz
+# From ftp://sources.redhat.com/pub/lvm2/sha512.sum
+sha512 6e0a10ab48be4f0c751447c6ab88b8f9fa1dcd1d703de77966e8507b173df70b1987fa0be252c31dfce9e0ee70e5f439db58c8f534e24144a70f254c091554ee  LVM2.2.02.180.tgz
 # Locally computed sha256 checksums
 sha256 e76fbcd2fb97cf202da330301327754d2db5c58b5b4bebd3a8a749393e7603d1  COPYING
 sha256 5df07007198989c622f5d41de8d703e7bef3d0e79d62e24332ee739a452af62a  COPYING.LIB
diff --git a/package/lvm2/lvm2.mk b/package/lvm2/lvm2.mk
index ccdc2c38e6..2352f17af0 100644
--- a/package/lvm2/lvm2.mk
+++ b/package/lvm2/lvm2.mk
@@ -4,9 +4,9 @@
 #
 ################################################################################
 
-LVM2_VERSION = 2.02.173
+LVM2_VERSION = 2.02.180
 LVM2_SOURCE = LVM2.$(LVM2_VERSION).tgz
-LVM2_SITE = ftp://sources.redhat.com/pub/lvm2/releases
+LVM2_SITE = ftp://sources.redhat.com/pub/lvm2
 LVM2_INSTALL_STAGING = YES
 LVM2_LICENSE = GPL-2.0, LGPL-2.1
 LVM2_LICENSE_FILES = COPYING COPYING.LIB
@@ -22,7 +22,7 @@ LVM2_CONF_OPTS += \
 	--disable-nls \
 	--disable-symvers
 
-LVM2_DEPENDENCIES += host-pkgconf
+LVM2_DEPENDENCIES += host-pkgconf libaio
 
 # LVM2 uses autoconf, but not automake, and the build system does not
 # take into account the toolchain passed at configure time.
diff --git a/package/udisks/Config.in b/package/udisks/Config.in
index 6573cda221..e7782028d1 100644
--- a/package/udisks/Config.in
+++ b/package/udisks/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_UDISKS
 	bool "udisks"
 	depends on BR2_PACKAGE_HAS_UDEV
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS # lvm2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus-glib -> glib2
 	depends on BR2_USE_MMU # lvm2
 	depends on !BR2_STATIC_LIBS # lvm2
@@ -38,9 +39,11 @@ endif
 
 comment "udisks needs udev /dev management"
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
 	depends on !BR2_PACKAGE_HAS_UDEV
 
 comment "udisks needs a glibc or uClibc toolchain w/ wchar, threads, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
 		BR2_STATIC_LIBS || BR2_TOOLCHAIN_USES_MUSL
-- 
2.18.0

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

* [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc
  2018-07-26 17:15 [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Marcin Niestroj
  2018-07-26 17:15 ` [Buildroot] [PATCH v3 2/2] package/lvm2: bump version to 2.02.180 Marcin Niestroj
@ 2018-08-14 20:47 ` Thomas Petazzoni
  2018-08-31 14:51   ` Marcin Niestrój
  2018-08-31 15:00   ` Marcin Niestrój
  2018-08-24  8:34 ` Peter Korsgaard
  2 siblings, 2 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2018-08-14 20:47 UTC (permalink / raw)
  To: buildroot

Hello Marcin,

Once again, thanks for this work!

On Thu, 26 Jul 2018 19:15:23 +0200, Marcin Niestroj wrote:
> When using uclibc libdevmapper.so was calling dm_task_get_info_base()
> function recursively, leading to segmentation fault. This was
> happening because uclibc linker loader just takes first existing
> 'dm_task_get_info' (which is 'dm_task_get_info_base') symbol in elf
> binary, instead of default version.
> 
> Add upstreamable lvm2 patch [1], which introduces
> --enable-symvers[=STYLE] switch. Use that switch to disable symbol
> versions, as we do not plan to support binaries compiled against
> old libdevmapper library.
> 
> [1] https://www.redhat.com/archives/dm-devel/2018-July/msg00187.html
> 
> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
> ---
> Changes v2 -> v3: none

I have added a reference to the Buildroot bug report being fixed by
this, and I've applied to master.

Two questions:

 (1) Could you try to push this forward in terms of upstreaming
     acceptance ? I know you have submitted the patch, but I looked
     today and apparently you haven't received any feedback.

 (2) It would be nicer if the availability of symbol versioning could
     be auto-detected. Is there a compile-time test that can be done to
     verify if symbol versioning is available ? This would perhaps help
     make the patch even more acceptable upstream.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v3 2/2] package/lvm2: bump version to 2.02.180
  2018-07-26 17:15 ` [Buildroot] [PATCH v3 2/2] package/lvm2: bump version to 2.02.180 Marcin Niestroj
@ 2018-08-14 21:39   ` Thomas Petazzoni
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2018-08-14 21:39 UTC (permalink / raw)
  To: buildroot

Hello Marcin,

On Thu, 26 Jul 2018 19:15:24 +0200, Marcin Niestroj wrote:
> lvm2 starting from version 2.02.178 depends on libaio library.
> 
> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
> ---
> Changes v2 -> v3:
>  * Add missing libaio dependency in luksmeta (suggested by Baruch)

Applied to next, thanks. I have submitted a follow-up patch that bumps
libaio, with the consequence that it no longer has any architecture
dependency. This allows to remove all the
BR2_PACKAGE_LIBAIO_ARCH_SUPPORTS dependencies, which is nice. Feel free
to have a look/review the patch I posted.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc
  2018-07-26 17:15 [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Marcin Niestroj
  2018-07-26 17:15 ` [Buildroot] [PATCH v3 2/2] package/lvm2: bump version to 2.02.180 Marcin Niestroj
  2018-08-14 20:47 ` [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Thomas Petazzoni
@ 2018-08-24  8:34 ` Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2018-08-24  8:34 UTC (permalink / raw)
  To: buildroot

>>>>> "Marcin" == Marcin Niestroj <m.niestroj@grinn-global.com> writes:

 > When using uclibc libdevmapper.so was calling dm_task_get_info_base()
 > function recursively, leading to segmentation fault. This was
 > happening because uclibc linker loader just takes first existing
 > 'dm_task_get_info' (which is 'dm_task_get_info_base') symbol in elf
 > binary, instead of default version.

 > Add upstreamable lvm2 patch [1], which introduces
 > --enable-symvers[=STYLE] switch. Use that switch to disable symbol
 > versions, as we do not plan to support binaries compiled against
 > old libdevmapper library.

 > [1] https://www.redhat.com/archives/dm-devel/2018-July/msg00187.html

 > Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
 > ---
 > Changes v2 -> v3: none

 > Changes v1 -> v2:
 >  * Add SoB in patch itself (suggested by Thomas)
 >  * Make this patch first in series, so it can be applied for LTS
 >    branches (sugested by Thomas)
 >  * Rebase patch on current lvm2 Buildroot master version (2.02.173),
 >    so it can apply cleanly

Committed to 2018.02.x and 2018.05.x, thanks.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc
  2018-08-14 20:47 ` [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Thomas Petazzoni
@ 2018-08-31 14:51   ` Marcin Niestrój
  2018-08-31 15:00   ` Marcin Niestrój
  1 sibling, 0 replies; 7+ messages in thread
From: Marcin Niestrój @ 2018-08-31 14:51 UTC (permalink / raw)
  To: buildroot


Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

> Hello Marcin,
>
> Once again, thanks for this work!
>
> On Thu, 26 Jul 2018 19:15:23 +0200, Marcin Niestroj wrote:
>> When using uclibc libdevmapper.so was calling dm_task_get_info_base()
>> function recursively, leading to segmentation fault. This was
>> happening because uclibc linker loader just takes first existing
>> 'dm_task_get_info' (which is 'dm_task_get_info_base') symbol in elf
>> binary, instead of default version.
>> 
>> Add upstreamable lvm2 patch [1], which introduces
>> --enable-symvers[=STYLE] switch. Use that switch to disable symbol
>> versions, as we do not plan to support binaries compiled against
>> old libdevmapper library.
>> 
>> [1] https://www.redhat.com/archives/dm-devel/2018-July/msg00187.html
>> 
>> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
>> ---
>> Changes v2 -> v3: none
>
> I have added a reference to the Buildroot bug report being fixed by
> this, and I've applied to master.
>
> Two questions:
>
>  (1) Could you try to push this forward in terms of upstreaming
>      acceptance ? I know you have submitted the patch, but I looked
>      today and apparently you haven't received any feedback.
>
>  (2) It would be nicer if the availability of symbol versioning could
>      be auto-detected. Is there a compile-time test that can be done to
>      verify if symbol versioning is available ? This would perhaps help
>      make the patch even more acceptable upstream.
>
> Thanks!
>
> Thomas


-- 
Marcin Niestr?j

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

* [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc
  2018-08-14 20:47 ` [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Thomas Petazzoni
  2018-08-31 14:51   ` Marcin Niestrój
@ 2018-08-31 15:00   ` Marcin Niestrój
  1 sibling, 0 replies; 7+ messages in thread
From: Marcin Niestrój @ 2018-08-31 15:00 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:
> <snip>
>
> I have added a reference to the Buildroot bug report being fixed by
> this, and I've applied to master.
>
> Two questions:
>
>  (1) Could you try to push this forward in terms of upstreaming
>      acceptance ? I know you have submitted the patch, but I looked
>      today and apparently you haven't received any feedback.

I was not available to do it earlier. I will take care of pushing it
forward.

>
>  (2) It would be nicer if the availability of symbol versioning could
>      be auto-detected. Is there a compile-time test that can be done to
>      verify if symbol versioning is available ? This would perhaps help
>      make the patch even more acceptable upstream.

Unfortunately I don't know how to check that. Symbol versioning is
something that runtime linker is aware of (glibc) or not (uclibc). So in
case of cross-compiling we are not able to check if library loads
properly. I have also not found any flags in libc libraries that
enable/disable symbol versioning, so external compiled against them
would know if that is supported.

For glibc and uclibc we could write some logic around __GLIBC__ and
__UCLIBC__ macros, but musl on the other hand does not allow to detect
it with any macro (which is done on purpose in musl).

>
> Thanks!
>
> Thomas

-- 
Regards,
Marcin

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

end of thread, other threads:[~2018-08-31 15:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-26 17:15 [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Marcin Niestroj
2018-07-26 17:15 ` [Buildroot] [PATCH v3 2/2] package/lvm2: bump version to 2.02.180 Marcin Niestroj
2018-08-14 21:39   ` Thomas Petazzoni
2018-08-14 20:47 ` [Buildroot] [PATCH v3 1/2] package/lvm2: Fix runtime crash when using uclibc Thomas Petazzoni
2018-08-31 14:51   ` Marcin Niestrój
2018-08-31 15:00   ` Marcin Niestrój
2018-08-24  8:34 ` Peter Korsgaard

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.