test/dm: use O_DIRECT to read from dm-verity/-crypt devices
test/dm: use O_DIRECT to read from dm-verity/-crypt devices

Sporadically, the test cases for detecting modified data fail because we were
still able to read the original (un-modified) data from the bundle after the
backing file was manipulated. While it seems to happen mostly in GitHub
Actions, it is still reproducible in QEMU by looping over the specific test
cases.

Although we use fsync() and drop_caches, we still sometime read the unmodified data.
We tried to use sync() and modified timing in the test case, but this was not a
reliable fix.

Instead, we now open the dm devices with O_DIRECT to avoid interacting
with any caches. As reading from O_DIRECT FDs requires page-aligned buffers, we
need to use aligned_alloc() instead of placing the buffer on the stack.

This should avoid the cache issues causing sporadic CI failures.

Signed-off-by: Jan Luebbe <3a82f1ac4ad59607a20f180f1c67ac8ba31ad0d5@pengutronix.de>

rauc/rauc,ejoerns/rauc,ejoerns/rauc,ejoerns/rauc,rauc/rauc,rauc/rauc