[MONGOCRYPT-481] libmongocrypt needs mcr_dll_path which isn't implemented for all platforms Created: 30/Aug/22 Updated: 04/Dec/23 Resolved: 30/Oct/23 |
|
| Status: | Closed |
| Project: | Libmongocrypt |
| Component/s: | C library |
| Affects Version/s: | 1.6.0-alpha0 |
| Fix Version/s: | 1.9.0 |
| Type: | Improvement | Priority: | Unknown |
| Reporter: | Calvin Buckley | Assignee: | Kevin Albertson |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Quarter: | FY24Q3 | ||||||||
| Description |
|
libmongocrypt wants to know the path for a loaded library, seemingly to compare if a library is already loaded (_validate_csfle_singleton). It has an implementation for Windows, macOS, and Linux (though this uses dlinfo which is also available on Solaris and *BSD, AFAIK). However, if there is no implementation, then it'll fail the build with an error. I'm building for AIX, so this is where I hit it. I looked into implementing this on AIX myself, but it did seem pretty tricky. dlopen returns an opaque ID that starts from zero and increments. Now, dladdr can be implemented in terms of calling a function that gets all loaded libraries (loadquery with L_GETINFO) and checking if the pointer is in their text/data ranges. However, dlinfo uses the value of dlopen, and the structure returned by loadquery that doesn't contain the IDs that libdl uses internally. I really want to avoid reaching into dynamic linker internals if I don't have to. An alternative might be to make it so that not having this function doesn't count as a hard error, and if not available, skip the validation logic. It'd be a lot easier than trying to implement it on all platforms, and I don't think it's that critical anyways. |
| Comments |
| Comment by Githook User [ 04/Dec/23 ] |
|
Author: {'name': 'Calvin Buckley', 'email': 'calvin@cmpct.info', 'username': 'NattyNarwhal'}Message:
This returns an error to the caller instead of a hard compile error. This lets mongocrypt work on a platform without dll_path support, like --------- Co-authored-by: vector-of-bool <vectorofbool@gmail.com> |
| Comment by Calvin Buckley [ 01/Nov/23 ] |
|
I think a simple patch might be: {{ #else ; ; ...but I don't know the repercussions for the CSFLE subsystem. I don't think it's strictly needed anyways? |
| Comment by Calvin Buckley [ 31/Oct/23 ] |
|
That patch isn't sufficient; `dladdr` is also called in [`mongo-util.c`](https://github.com/mongodb/libmongocrypt/blob/master/src/mongocrypt-util.c#L85), called by [`_try_replace_dollar_origin`](https://github.com/mongodb/libmongocrypt/blob/master/src/mongocrypt.c#L433C13-L433C39). |
| Comment by Githook User [ 30/Oct/23 ] |
|
Author: {'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}Message:
|
| Comment by Cloud GitHub Webhooks [ 30/Oct/23 ] |
|
kevinAlbs merged a pull request (MONGOCRYPT-481 Warn if `mcr_dll_path` not implemented) into the following branch: |
| Comment by Jack Woehr [ 13/Jan/23 ] |
|
This is blocking newer versions of libmongoc. The Reporter (Calvin Buckley) is the chief maintainer of PHP Community Edition (currently at 8.2) for the IBM i platform. WIBNI this could bump up a notch in priority |