On Fri, Aug 30, 2019 at 11:12:07AM -0500, Eric Blake wrote:
We documented our intent of only allowing a filter to run with the same version of nbdkit it was compiled against, but up to now, were not actually enforcing that - we had only been insisting on the looser notion of a matching ._api_version, which doesn't help when we've forgotten to bump that macro when making incompatible API/ABI changes (see commit 6934d4c1). However, we can't use .version (it was documented as optional, so even though all our in-tree filters set it, a theoretical out-of-tree filter could use NULL; and it has changed offsets in the ABI during previous API changes, such as commit ee61d232). Thus, we have to bump the API version one final time; but now, our API guaarantees enough stable ABI to check the version string as part of our API sanity checking, so we are set to avoid future maintenance snafus.
All in-tree filters are affected now that .version is no longer available as an optional member (although it so happens that we are setting the new mandatory ._version to the same value that they all used). And thanks to the previous patch adding nbdkit-version.h, even a theoretical out-of-tree filter will get the correct version string without having to maintain it by hand.
Note that the offset of ._version differs between 32- and 64-bit platform ABIs; but on that front, we are safe: Rich and I tested (at least on Linux where ELF executables encode ABI) that attempts to load a 32-bit .so from 64-bit nbdkit, or vice versa, gracefully fail dlopen() for being an incompatible ABI even before we get far enough to worry about inspecting ._api_version or ._version.
Signed-off-by: Eric Blake <eblake@redhat.com>
This all looks fine, ACK. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top