From 12feaa7d3b1544098f684d851e3caff1ec88cbc8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 30 Jan 2015 21:09:17 +0100 Subject: Refine Native Library Code: Bulk Permissions, Cleanup DynamicLinker impl. - and fix Android AArch64 BionicDynamicLinker (Bug 1122) - Bulk Permissions ProcAddressTable.reset(..) performs address lookup in one block. Now claiming all permissions upfront once, and releasing them afterwards. - Cleanup DynamicLinker impl. Proper top-down impl. of DynamicLinkerImpl, handling all security code and validations. - Fix Android AArch64 BionicDynamicLinker (Bug 1122) Dalvik uses diff RTLD_* defines for AArch64! --- .../com/jogamp/gluegen/runtime/ProcAddressTable.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/java/com/jogamp/gluegen/runtime') diff --git a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java index a0988cd..d910f7b 100644 --- a/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java +++ b/src/java/com/jogamp/gluegen/runtime/ProcAddressTable.java @@ -119,8 +119,6 @@ public abstract class ProcAddressTable { * @throws SecurityException if user is not granted access for all libraries. */ public void reset(final DynamicLookupHelper lookup) throws SecurityException, RuntimeException { - SecurityUtil.checkAllLinkPermission(); - if(null==lookup) { throw new RuntimeException("Passed null DynamicLookupHelper"); } @@ -137,13 +135,17 @@ public abstract class ProcAddressTable { // All at once - performance. AccessibleObject.setAccessible(fields, true); - - for (int i = 0; i < fields.length; ++i) { - final String fieldName = fields[i].getName(); - if ( isAddressField(fieldName) ) { - final String funcName = fieldToFunctionName(fieldName); - setEntry(fields[i], funcName, lookup); + lookup.claimAllLinkPermission(); + try { + for (int i = 0; i < fields.length; ++i) { + final String fieldName = fields[i].getName(); + if ( isAddressField(fieldName) ) { + final String funcName = fieldToFunctionName(fieldName); + setEntry(fields[i], funcName, lookup); + } } + } finally { + lookup.releaseAllLinkPermission(); } if (DEBUG) { -- cgit v1.2.3