luksFormat fails with json-c 0.14
Issue description
After rebuild with json-c 0.14
running luksFormat
fails with error message:
Cannot wipe header on device /dev/...
This happens with LUKS1 and LUKS2 (--type LUKS2
).
Steps for reproducing the issue
Install Arch package cryptsetup 2.3.1-2
from official Arch repository, then try to format volume.
Additional info
This Arch Linux package cryptsetup 2.3.1-2
is a rebuild against json-c 0.14
. The package cryptsetup 2.3.1-1
(linked against json-c 0.13
) works fine.
Downstream bug report: https://bugs.archlinux.org/task/66477
Debug log
# cryptsetup --debug luksFormat /dev/loop3 :(
# cryptsetup 2.3.1 processing "cryptsetup --debug luksFormat /dev/loop3"
# Running command luksFormat.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating context for crypt device /dev/loop3.
# Trying to open and read device /dev/loop3 with direct-io.
# Initialising device-mapper backend library.
WARNING!
========
This will overwrite data on /dev/loop3 irrevocably.
Are you sure? (Type 'yes' in capital letters): YES
# Interactive passphrase entry requested.
Enter passphrase for /tmp/test:
Verify passphrase:
# Crypto backend (OpenSSL 1.1.1g 21 Apr 2020) initialized in cryptsetup library version 2.3.1.
# Detected kernel Linux 5.6.5-arch3-1 x86_64.
# Only 2 active CPUs detected, PBKDF threads decreased from 4 to 2.
# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 2.
# Formatting device /dev/loop3 as type LUKS2.
# Topology: IO (512/0), offset = 0; Required alignment is 1048576 bytes.
# Checking if cipher aes-xts-plain64 is usable.
# Using userspace crypto wrapper to access keyslot area.
# Formatting LUKS2 with JSON metadata area 12288 bytes and keyslots area 16744448 bytes.
# Creating new digest 0 (pbkdf2).
# Setting PBKDF2 type key digest 0.
# Running pbkdf2(sha256) benchmark.
# PBKDF benchmark: memory cost = 0, iterations = 697191, threads = 0 (took 47 ms)
# PBKDF benchmark: memory cost = 0, iterations = 798003, threads = 0 (took 657 ms)
# Benchmark returns pbkdf2(sha256) 798003 iterations, 0 memory, 0 threads (for 512-bits key).
# Segment 0 assigned to digest 0.
# Segment "0" is missing "offset" (string) specification.
Cannot wipe header on device /dev/loop3.
# Releasing crypt device /dev/loop3 context.
# Releasing device-mapper backend.
# Closing read only fd for /dev/loop3.
# Unlocking memory.
Command failed with code -1 (wrong or missing parameters).