-
-
Save addaleax/c3bdcab028a42d1f32455a9436a1c298 to your computer and use it in GitHub Desktop.
SERVER-65902/SERVER-65898 repro scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# on amazon2-arm64-small, repro for SERVER-65902 | |
cd /tmp | |
curl -O https://nodejs.org/download/release/v14.19.1/node-v14.19.1-linux-arm64.tar.gz | |
tar xvzf node-v14.19.1-linux-arm64.tar.gz | |
export PATH=$PWD/node-v14.19.1-linux-arm64/bin:$PATH | |
curl -O https://downloads.mongodb.com/linux/mongo_csfle_v1-linux-aarch64-enterprise-amazon2-6.0.0-rc1.tgz | |
tar xvzf mongo_csfle_v1-linux-aarch64-enterprise-amazon2-6.0.0-rc1.tgz | |
npm install mongodb mongodb-client-encryption | |
cat > test.js <<EOF | |
const { MongoClient } = require('mongodb'); | |
(async function () { | |
await MongoClient.connect('mongodb://localhost/', { | |
autoEncryption: { | |
kmsProviders: { local: { key: 'A'.repeat(128) } }, | |
extraOptions: { csflePath: '$PWD/lib/mongo_csfle_v1.so' } | |
} | |
}) | |
})().catch(err => process.nextTick(() => {throw err})) | |
EOF | |
node test.js # segfaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# on suse12-small, repro for SERVER-65898 | |
cd /tmp | |
curl -O https://nodejs.org/download/release/v14.19.1/node-v14.19.1-linux-x64.tar.gz | |
tar xvzf node-v14.19.1-linux-x64.tar.gz | |
export PATH=$PWD/node-v14.19.1-linux-x64/bin:$PATH | |
curl -O https://downloads.mongodb.com/linux/mongo_csfle_v1-linux-x86_64-enterprise-suse12-6.0.0-rc1.tgz | |
tar xvzf mongo_csfle_v1-linux-x86_64-enterprise-suse12-6.0.0-rc1.tgz | |
npm install mongodb mongodb-client-encryption | |
cat > test.js <<EOF | |
const { MongoClient } = require('mongodb'); | |
(async function () { | |
await MongoClient.connect('mongodb://localhost/', { | |
autoEncryption: { | |
kmsProviders: { local: { key: 'A'.repeat(128) } }, | |
extraOptions: { csflePath: '$PWD/lib/mongo_csfle_v1.so' } | |
} | |
}) | |
})().catch(err => process.nextTick(() => {throw err})) | |
EOF | |
node test.js # fails | |
cat > test.c <<EOF | |
#include "include/mongo_csfle/v1/mongo_csfle/mongo_csfle.h" | |
#include <dlfcn.h> | |
#include <stdio.h> | |
int main() { | |
void* handle = dlopen("./lib/mongo_csfle_v1.so", RTLD_LAZY | RTLD_LOCAL); | |
if (!handle) { | |
fprintf(stderr, "Could not load lib: %s\n", dlerror()); | |
return 1; | |
} | |
mongo_csfle_v1_status*(* mongo_csfle_v1_status_create)() = | |
dlsym(handle, "mongo_csfle_v1_status_create"); | |
const char*(* mongo_csfle_v1_status_get_explanation)(const mongo_csfle_v1_status*) = | |
dlsym(handle, "mongo_csfle_v1_status_get_explanation"); | |
mongo_csfle_v1_lib*(* mongo_csfle_v1_lib_create)(mongo_csfle_v1_status*) = | |
dlsym(handle, "mongo_csfle_v1_lib_create"); | |
mongo_csfle_v1_status* status = mongo_csfle_v1_status_create(); | |
mongo_csfle_v1_lib* lib = mongo_csfle_v1_lib_create(status); | |
fprintf(stderr, "lib_create() = %p, %s\n", lib, mongo_csfle_v1_status_get_explanation(status)); | |
} | |
EOF | |
gcc -o test test.c -ldl | |
./test # fails |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment