[Buildroot] [PATCH 2/2] package/lvm2: Fix runtime crash when using uclibc

Marcin Niestroj m.niestroj at grinn-global.com
Wed Jul 25 16:18:46 UTC 2018


Hi Thomas,

On 25.07.2018 18:09, Thomas Petazzoni wrote:
> Hello Marcin,
> 
> On Wed, 25 Jul 2018 14:37:03 +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 at grinn-global.com>
> 
> Is this needed only with the lvm2 bump to 2.02.180 ? Or is it needed
> even with the current version of lvm2 we have packaged in Buildroot ?

This is also needed for older version (currently packaged in Buildroot).

> 
>> ---
>>   ...gure-Introduce-enable-symvers-option.patch | 288 ++++++++++++++++++
>>   package/lvm2/lvm2.mk                          |   3 +-
>>   2 files changed, 290 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..757305a86d
>> --- /dev/null
>> +++ b/package/lvm2/0001-configure-Introduce-enable-symvers-option.patch
>> @@ -0,0 +1,288 @@
>> +From f4fb05978de506c6941c80493c4f3b77f0509913 Mon Sep 17 00:00:00 2001
>> +From: Marcin Niestroj <m.niestroj at 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.
> 
> Could you add your SoB to the patch itself ?
> 
> Thanks!
> 
> Thomas
> 

Ok, I will add SoB to the patch as well.

-- 
Marcin Niestroj



More information about the buildroot mailing list