diff --git a/lib/ffi.js b/lib/ffi.js index 5cd7c4b354ab..2a9db50fa51c 100644 --- a/lib/ffi.js +++ b/lib/ffi.js @@ -252,12 +252,10 @@ function dlopen(path, definitions) { } function dlclose(handle) { - checkFFIPermission(); handle.close(); } function dlsym(handle, symbol) { - checkFFIPermission(); return handle.getSymbol(symbol); } diff --git a/test/ffi/test-ffi-permissions.js b/test/ffi/test-ffi-permissions.js index e441d88efac2..ff4a4ef3a67b 100644 --- a/test/ffi/test-ffi-permissions.js +++ b/test/ffi/test-ffi-permissions.js @@ -74,7 +74,7 @@ test('permission model blocks ffi memory and helper APIs', () => { ffi.getCurrentEventLoop(); }, denied); - assert.throws(() => { - ffi.dlclose({ close() {} }); - }, denied); + // Like handle.close() and handle.getSymbol(), these do not check permissions. + ffi.dlclose({ close() {} }); + assert.strictEqual(ffi.dlsym({ getSymbol: () => 1n }, 'x'), 1n); });