Fix handling of mmap failure and mapping empty files

Check the return value of mmap() correctly.

Empty files cannot be mmap'd so we implement some
work around code for that.

https://bugs.freedesktop.org/show_bug.cgi?id=74773

Signed-off-by: Stef Walter <stef@thewalter.net>
proxy: Remove assertions when module is not initialized

We should return CKR_CRYPTOKI_NOT_INITIALIZED rather than
assert() when proxy PKCS#11 functions are called before the
module is initialized.

https://bugs.freedesktop.org/show_bug.cgi?id=74919
proxy: Fix cases where modules are unloaded while in use

The proxy module would unload the PKCS#11 modules it was proxying
when C_Finalize() was called. However if a caller in another thread
was inside of a PKCS#11 function at the time, this would cause
a crash.

Change things around so that underlying modules are finalized during
the proxy C_Finalize() but not released/unloaded until the proxy
module itself is unloaded.

https://bugs.freedesktop.org/show_bug.cgi?id=74919