Bug 10781 - cryptsetup luksOpen container_file container causes libdevmapper segfault
Summary: cryptsetup luksOpen container_file container causes libdevmapper segfault
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2018.02
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-19 22:41 UTC by Nobodyman
Modified: 2018-08-20 08:48 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
0001-libdm-iface.patch (2.24 KB, patch)
2018-03-01 20:16 UTC, Nobodyman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nobodyman 2018-02-19 22:41:29 UTC
# creating container file works
dd if=/dev/urandom of=container_file bs=1M count=10
cryptsetup -y luksFormat container_file

cryptsetup --debug open container_file container
# cryptsetup 2.0.1 processing "cryptsetup --debug open container_file container"
# Running command open.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating context for crypt device container_file.
# Trying to open and read device container_file with direct-io.
# Initialising device-mapper backend library.
# Trying to load any crypt type from device container_file.
# Crypto backend (OpenSSL 1.0.2n  7 Dec 2017) initialized in cryptsetup library version 2.0.1.
# Detected kernel Linux 4.15.0 i686.
# PBKDF pbkdf2, hash sha256, time_ms 2000 (iterations 0), max_memory_kb 0, parallel_threads 0.
# Reading LUKS header of size 1024 from device container_file
# Key length 32, device size 20480 sectors, header size 2050 sectors.
# Activating volume container using token -1.
# Interactive passphrase entry requested.
Enter passphrase for container_file:
# Activating volume container [keyslot -1] using passphrase.
# dm version   [ opencount flush ]   [16384] (*1)
# dm versions   [ opencount flush ]   [16384] (*1)
# Detected dm-ioctl version 4.37.0.
# Device-mapper backend running with UDEV support disabled.
# dm status container  [ opencount flush ]   [16384] (*1)
Segmentation fault

dmesg
cryptsetup[150]: segfault at bf779fc4 ip b7eb6cf7 sp bf779fc8 error 6 in libdevmapper.so.1.02[b7e84000+44000]

I changed original supplied version 2.0.0 to 2.0.1 but it´s still not working.
Comment 1 Nobodyman 2018-02-19 22:50:18 UTC
(In reply to Nobodyman from comment #0)
Sorry, used command line was:
cryptsetup --debug luksOpen container_file container
Comment 2 Nobodyman 2018-03-01 20:16:15 UTC
Created attachment 7496 [details]
0001-libdm-iface.patch
Comment 3 Nobodyman 2018-03-02 22:31:09 UTC
This patch found on this site https://gitlab.labs.nic.cz/turris/turris-os-packages/commit/8f08ed5f59b51b222aef72fb2902472b0fa068ad was commited from Michal Hrusecky <michal.hrusecky@nic.cz>.
Original path: utils/lvm2/patches/004-dm_task_get_info.patch

lvm2: Fix crash and update to 2.02.145

Fixed really tricky issue with I suspect uClibc and devicemapper. For details
see the patch. While at it updating it to the latest version as it didn't worked
anyway.
Comment 4 Thomas Petazzoni 2018-06-06 13:41:10 UTC
This is in fact isn't really a Buildroot issue, more an upstream issue. I'm not a big fan of taking some random OpenWRT patch that isn't "obviously correct".

Has this issue been reported to the upstream lvm2 developers ? Or perhaps to the uClibc-ng maintainer ? I'm sure Waldemar will be interested about a case where a program against glibc works, but not with uClibc-ng.
Comment 5 wbx 2018-06-10 04:33:09 UTC
I opened up an issue:
https://github.com/lvmteam/lvm2/issues/6
Comment 6 Peter Korsgaard 2018-08-20 08:48:53 UTC
This has now been fixed by:
https://git.buildroot.org/buildroot/commit/?id=5313c50aa3c1533c32ecf8d04c0628fbbb14f58d