"Device size is not aligned to requested sector size." error should be a warning in CRYPTSETUP

Issue description

When using --sector-size=4096 with LuksFormat on a patition which is alligned to 1 MiB boundaries CRYPTSETUP will report the error "Device size is not aligned to requested sector size.". The error message is wrong in specific situations and cannot be ignored, if the user is sure about correct alignment.

Steps for reproducing the issue

I marked important lines with -->

ubuntu@ubuntu:~$ sudo sgdisk -p -i 3 /dev/sda

Disk /dev/sda: 7814037168 sectors, 3.6 TiB
Model: SSD 860 EVO 4TB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 09F5A8CD-F0CD-49FF-87D4-0D95167DCAEA
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 7814037134
---> Partitions will be aligned on 2048-sector boundaries
Total free space is 5632474733 sectors (2.6 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          526335   256.0 MiB   0700  Microsoft basic data
   2          526336        34080767   16.0 GiB    8300  Linux filesystem
--->**3        34080768      2181564415   1024.0 GiB  8300  data**
Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: A60299B3-AA11-44AE-8BE1-FDA9C99D7399
---> First sector: 34080768 (at 16.3 GiB)
Last sector: 2181564415 (at 1.0 TiB)
---> Partition size: 2147483648 sectors (1024.0 GiB)
Attribute flags: 0000000000000000
Partition name: 'data'

ubuntu@ubuntu:~$ sudo cryptsetup luksFormat --sector-size=4096 /dev/sda3 --debug
# cryptsetup 2.2.2 processing "cryptsetup luksFormat --sector-size=4096 /dev/sda3 --debug"
# Running command luksFormat.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating context for crypt device /dev/sda3.
# Trying to open and read device /dev/sda3 with direct-io.
# Initialising device-mapper backend library.

WARNING!
========
This will overwrite data on /dev/sda3 irrevocably.

Are you sure? (Type uppercase yes): YES
# Interactive passphrase entry requested.
Enter passphrase for /dev/sda3:
Verify passphrase:
# Crypto backend (OpenSSL 1.1.1f  31 Mar 2020) initialized in cryptsetup library version 2.2.2.
# Detected kernel Linux 5.4.0-1015-raspi aarch64.
# PBKDF argon2i, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.
# Formatting device /dev/sda3 as type LUKS2.
# dm version   [ opencount flush ]   [16384] (*1)
# dm versions   [ opencount flush ]   [16384] (*1)
# Detected dm-ioctl version 4.41.0.
# Device-mapper backend running with UDEV support enabled.
---># Topology: IO (512/33553920), offset = 0; Required alignment is 33553920 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 = 306242, threads = 0 (took 107 ms)
# PBKDF benchmark: memory cost = 0, iterations = 316981, threads = 0 (took 827 ms)
# Benchmark returns pbkdf2(sha256) 316981 iterations, 0 memory, 0 threads (for 512-bits key).
# Segment 0 assigned to digest 0.
Device size is not aligned to requested sector size.
# Releasing crypt device /dev/sda3 context.
# Releasing device-mapper backend.
# Closing read only fd for /dev/sda3.
# Unlocking memory.
---> Command failed with code -1 (wrong or missing parameters).

Additional info

The problem is caused by an underlying problem how HDDs/SDDs and external HDD cases report their aligment parameters. See Link for more detailed information.

Because of possible wrong data basis CRYPTSETUP should not report a detected missalignment as an error, but only as a warning.