libtpms: FreeBSD does not support mremap()
joholl opened this issue · 1 comments
FreeBSD does not support mremap()
, which is called in tcti_libtpms_map_state_file()
.
Currently, we open the state file, map it into memory, and then close it again. We can then continue working with the memory. If the memory is too small, we can use mremap()
to enlarge it (without having to open the file again).
Two possible solutions:
A) We remove the state file feature for FreeBSD
If tcti-libtpms uses memory-only (without state file), then we never call mremap()
. We could remove the state file feature for FreeBSD via #ifdef
. For this to work we must be able to run out tests completely stateless :)
B) Replacing mremap()
with munmap()
and mmap()
.
This is unfortunately a bit unpleasant. As an alternative to mremap()
, we could use munmap()
and tcti_libtpms_map_state_file(min_size)
instead. Unfortunately, this openes, maps, and then closes the file again.
This might get a bit ugly in the unit tests.
For Reference
tpm2-tss/src/tss2-tcti/tcti-libtpms.c
Lines 47 to 55 in 166a553
@JuergenReppSIT What do you think?
@JuergenReppSIT What do you think?
I think there are two FAPI integration tests which would cause problems with version A) But they could be skipped for netBSD ;-)