| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
commit 12feaa7d3b1544098f684d851e3caff1ec88cbc8
Regression of commit 12feaa7d3b1544098f684d851e3caff1ec88cbc8
'isToolLibComplete()' returned false if dynLinkGlobal is null,
even if no tool-lib has been used. In which case dynLinkGlobal
has not been initialized and hence is always null.
'isToolLibComplete()' now takes no tool-lib into consideration!
Currently only 'OVRDynamicLibraryBundleInfo' of JOGL's 'oculusvr' binding
used this configuration within JogAmp.
|
|
|
|
| |
SecurityException' decl., remove dead code, remove redundant check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
matching StaticConfig at runtime; Fix PPC (Bug 1056) and MIPSLE (Bug 1014) issues.
Currently the StaticConfig is being queried
via the key[OSType, CPUType ..]
as pre-determined by Java properties or the ELF parser.
This adds complication to maintain different platforms
and the key query might not even be sufficient.
The MachineDescriptor's StaticConfig only purpose shall be
to speed-up native data size and offset/alignment retrieval.
This is done by using the StaticConfig index within
all StaticConfig[]s as a lookup-index for the precomputed
struct's size and offset tables.
+++
Solution:
Rename: MachineDescriptor -> MachineDataInfo
Rename: MachineDescriptorRuntime -> MachineDataInfoRuntime
After having defined os.and.arch (OSType, CPUType and ABIType)
w/ the optional help of the now self containing ELF Reader (Bug 1125),
the native gluegen-rt library gets loaded enabling JNI methods.
It is satisfactory to retrieve MachineDataInfo
at runtime w/ JNI and find the matching/compatible StaticConfig.
Only in case none is found, the program needs to abort.
Otherwise the found MachineDataInfo.StaticConfig and MachineDataInfo
are stored for further use (see above).
This removes above complication and key to StaticConfig mapping.
New platforms simply need to add a new unique entry into the
StaticConfig[] table.
++
Also fixes Bug 1056 (PPC), thanks to tmancill [@] debian [.] org,
and Bug 1014 (MIPSLE), thanks to Dejan Latinovic.
Parts of the patch for Bug 1014 from Dejan Latinovic are included.
also solved by this change set.
|
|
|
|
| |
detection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ELF Reader 'jogamp.common.os.elf' currently uses
Platform's pre-determined OS_TYPE and CPUType.
It also uses the host platforms MachineDescription,
hence can not read ELF files from other machines.
This also forbids Platform to determine CPUType etc
w/o having a valid 'os.arch' property.
+++
ElfHeader should be split in
- ElfHeaderPart1 (CPUType independent)
- ElfHeaderPart2 (CPUType dependent)
Fix shall make the ELF Reader self containing
by only using ELF CPUType data, etc.
This requires customization of struct parsing,
where MachineDescription.Static index shall be
- defined in ElfHeaderPart1 using e_Ident's CPUType.
- used in ElfHeaderPart2 and all its struct types.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Android:
- Detect ABIType.EABI_GNU_ARMHF via 'armeabi-v7a-hard'
Platform.CPUType:
- contains is32Bit now
MachineDescription:
- Rename *x86_64_unix* -> *lp64_unix*, reflecting universal __LP64__ mode
- Remove is32Bit, which is determined by CPUType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Add AArch64 detection via
- Elf Parser
- Android properties
- Java properties
- Android: Validate CPUType.Family _and_ ABIType
- MachineDescription
- Remove redundant Type ID and its field
- Reuse X86_64_UNIX for AArch64 (static config)
New ARCH 'aarch64' for
ant: <os arch>
armv8a
aarch64
New CPUType.ARM64 (ARM):
java: os.arch
aarch64
arm64
New CPUType.ARMv8_A (ARM):
java: os.arch
armv8-a
arm64-v8a
New ABIType:
EABI_AARCH64
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Uri:
- Add error correction (fix) of path at ctor
in case a a contained Uri is requested from an opaque one.
The latter might come from URI/URL and is not properly encoded!
See Uri.PARSE_HINT_FIX_PATH
- Simplify conversion methods:
- valueOf(URI/URL): Re-encode only if not opaque
- getNativeFilePath() -> toFile()
- Move IOUtil Uri related constants to class Uri
- Add DEBUG and DEBUG_SHOWFIX
- Complete adoption of URI -> Uri changes
- IOUtil, JarUtil and TempJarCache still holds some
left over deprecated methods, which will be removed
after officially starting 2.3.0 (JOGL dependencies)
- Otherwise not URI utilization left
- Tests
- Cleaned ip TestUri01 and TestUri03Resolving
- TestUri03Resolving also tests URL -> Uri,
and hence mentioned Uri.PARSE_HINT_FIX_PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In situations, where the native-jar file is not located within
the same parent URI as it's java-jar file, our location mechanism fails.
This patch adds a classloader based native-jar file location mechanism as a fallback,
requiring the native jar file to be included in the users CLASSPATH.
Classloader based location algorithm in JNILibLoaderBase.addNativeJarLibsImpl(..):
- Extract the 'module-name' from the given classFromJavaJar's package name,
i.e. the last package-part: 'jogamp.common.Debug' -> 'common'
Hence it is important to pass a 'classFromJavaJar',
which last package segment reflects the module-name!
- <os.and.arch> -> <os_and_arch_dot>, e.g. linux-amd64 -> linux.amd64 (linux/amd64)
- Locate class 'jogamp.nativetag.<module-name>.<os_and_arch_dot>.TAG',
e.g. 'jogamp.nativetag.common.linux.amd64.TAG'
- Use located class's JarFile URI .. continue as usual
Injection of above mentioned TAG class via gluegen-cpptasks-base.xml macro 'native.tag.jar':
- Creates dummy TAG.java code
- Compiles TAG.java
- Creates the native-jar file
Example:
<native.tag.jar objdir="${build}/obj"
nativejarfile="${build}/gluegen-rt-natives-${os.and.arch}.jar"
manifestfile="${build}/Manifest-rt-natives.temp"
module="common"
includelibs="*gluegen-rt.${native.library.suffix}" />
Note that the manifest file uses a matching Extension-Name:
Extension-Name: jogamp.nativetag.common
|
|
|
|
|
|
|
| |
accessed from inner class
Otherwise the compiler has to fill in a wrapping access function for the inner
class to call, which is less efficient.
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
src/java/com/jogamp/common/os/Platform.java
src/junit/com/jogamp/common/util/TestTempJarCache.java
(re-injected that api-doc of addNativeJarLibsImpl)
|
| |
| |
| |
| |
| | |
Bug: 1023
Bug: 1024
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'best' ABI
- Use 'os.arch' as a prelim CPUType for MachineDescription
- Always attempt to load a binary and parse it's elf header
- Linux: self-exe
- Android: gluegen-rt library
- Other: java lib
- Always use details (ABI) if ARM
- Android: Check CPU_TYPE and CPU_TYPE2
// FIXME / HACK:
// We use sCPUType for MachineDescriptionRuntime.getStatic()
// until we have determined the final CPU_TYPE, etc.
// MachineDescriptionRuntime gets notified via MachineDescriptionRuntime.notifyPropsInitialized() below.
//
// We could use Elf Ehdr's machine value to determine the bit-size
// used for it's offset table!
// However, 'os.arch' should be a good guess for this task.
Tested manually on
- Linux x86, x86_64, armhf (raspi)
- Android intel and arm
- Windows x86_64
- OSX x86_64
|
| |
|
|
|
|
| |
Signed-off-by: Harvey Harrison <[email protected]>
|
|
|
|
| |
Signed-off-by: Harvey Harrison <[email protected]>
|
|
|
|
|
|
|
|
|
| |
TempJarCache.bootstrapNativeLib(), allowing versatile use of 1st native jar file (big-java-jar w/ big-native-jar)
The remaining Platform dependency existed in IOUtil.copyStream2Stream(..), used by JarUtil.extract(..),
i.e. the MachineDescription's PAGE_SIZE.
Solved by using a const buffer size of 4096 bytes.
|
| |
|
|
|
|
| |
methods, based on 'gettimeofday(..)'
|
|
|
|
|
|
|
| |
required - and it deadlocks AWT/NEWT jogl/joal lib loading.
Introduced w/ commits 1c03dfd6d1939a46018583419956e350e531f4fe
and e9e61421ef6009e6788998c471d1d3d30aaefea6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
access (2)
- Completes 23341a2df2d2ea36784a16fa1db8bc7385351a12
- Replace 'DynamicLinker' interface w/ well documented one
- All DynamicLinker methods are now considered secure, i.e.:
- open/lookup and close utilize reference counting on handle via a hash map.
- lookupSymbol(..) and close(..) impl. validate the passed library handle
whether it's retrieved via open*.
This is the fast path, not that expensive.
- lookupSymbolGlobal(..) performs
Check acccess of 'new RuntimePermission("loadLibrary.*")' if SecurityManager is installed.
This is the slow path.
- DynamicLibraryBundleInfo now reflects the security requirements,
i.e. whether priviledged access is needed.
|
|
|
|
| |
TODO comments, re protected lookup functions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
compatible w/ file scheme.
Regression of (Bug 683, Commit b98825eb7cfb61aead4a7dff57471cd2d2c26823).
The URI encoded path cannot be read by File I/O (if file scheme), since the latter
requests an UTF8/16 name, not an URI encoded name (i.e. %20 for space).
The encoded URL is produced if calling 'uri.toURL()' and hence
the new 'IOUtil.toURL(URI)' provides a custom conversion recovering the UTF name via 'new File(uri).getPath()'.
Tested w/
- synthetic URI/URL coposition (unit test)
- manual w/ moving 'build' to 'build öä lala' for gluegen, joal and jogl.
+++
Misc.:
- 'URI JarUtil.getURIDirname(URI)' -> 'URI IOUtil.getDirname(URI)'
++
|
|
|
|
| |
post catch block, i.e. exception (if occured) and dlerror value.
|
|
|
|
| |
DEBUG mode ; DynamicLinker: Add 'String getLastError()'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
values; Using same pattern for Mac OS X.
Add Bionic specialization using Bionic's non POSIX values
- derive from UnixDynamicLinkerImpl
- specify own flag and mode values
- use UnixDynamicLinkerImpl native code
Using same pattern for Mac OS X
- derive from UnixDynamicLinkerImpl
- specify own flag and mode values
- use UnixDynamicLinkerImpl native code
- drop MacOSXDynamicLinkerImpl native code
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and privileged access)
This review focuses on how we perform permission checks,
or better - do we circumvent some assuming full privileges ?
Some native methods do need extra permission validation, i.e. loading native libraries.
Further more AccessController.doPrivileged(..) shall not cover generic code
exposing a critical feature to the user.
Further more .. we should rely on the SecuritManager, i.e. AccessControlContext's
'checkPermission(Permission)' code to comply w/ fine grained permission access.
It is also possible to have full permission w/o having any certificates (-> policy file).
+++
We remove implicit AccessController.doPrivileged(..) from within our trusted code
for generic methods, like Property access, temp. files.
+++
SecurityUtil:
- Remove 'getCommonAccessControlContext(Class<?> clz)',
which returned a local AccessControlContext for later restriction
if the passed class contains all certificates as the 'trusted' GlueGen class has.
- Simply expose convenient permission check methods relying on
SecurityManager / AccessControlContext.
PropertyAccess:
- 'protected static void addTrustedPrefix(..)' requires AllPermissions if SecurityManager is installed.
- Remove implicit doPrivileged(..) triggered by passed AccessControlContext instance,
only leave it for trusted prefixes.
IOUtil:
- Remove all doPrivileged(..) - Elevation shall be performed by caller.
DynamicLinker:
- 'public long openLibraryLocal(..)' and 'public long openLibraryGlobal(..)'
may throw SecurityException, if a SecurityManager is installed and the dyn. link permission
is not granted in the calling code.
Implemented in their respective Unix, OSX and Windows manifestation.
Caller has to elevate privileges via 'doPrivileged(..) {}' !
+++
Tests:
- Property access
- File access
- Native library loading
Manual Applet test (unsigned, but w/ SecurityManager and policy file):
> gluegen/test/applet
Applet has been tested w/ signed JAR w/ Firefox and Java7 on GNU/Linux as well.
Manual Application test (unsigned, but w/ SecurityManager and policy file):
com.jogamp.junit.sec.TestSecIOUtil01
- Run w/ SecurityManager and policy file:
- gluegen/scripts/runtest-secmgr.sh
- Run w/o SecurityManager:
- gluegen/scripts/runtest.sh
|
| |
|
|
|
|
| |
to remove DNS Lookups etc ..
|
|
|
|
| |
Signed-off-by: Harvey Harrison <[email protected]>
|
|
|
|
| |
Exclude java.part.awt in android gluegen-rt.
|
|
|
|
|
|
|
|
| |
/proc/self/exe (Linux) or a found java/jvm native lib.
- PlatformPropsImpl.queryABITypeImpl: Check Elf Header for ARM + !ANDROID (i.e. add other OS than Linux, use native java/jmv lib)
- NativeLibrary.enumerateLibraryPaths: Add 'sun.boot.library.path' to enumeration!
- TestElfReader01: Add test for finding java/jvm native lib and parse it
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- NativeLibrary Fix
- enumerateLibraryPaths(..):
- Properly iterate through all prefix _and_ suffix.
- Make public for JNILibLoaderBase.loadLibraryInternal(..)
- isValidNativeLibraryName(..):
- Stop iterating through prefix, if previously found
but suffix doesn't match.
- JNILibLoaderBase.loadLibraryInternal(..) Enhancement
- Mark customLibLoader FIXME: remove (we will get rid of jnlp.launcher.class)
- If System.load(TempJarCache) and System.loadLibrary(plainLibName) fails,
use NativeLibrary.enumerateLibraryPaths() w/ System.load(..) as last resort.
Tested on Linux x86_64 Java6 and OSX Java7 manually, no regressions expected.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
May break GCJ/ECJ .. needs to be revised.
- Adding JAVA_6 in PlatformPropsImpl
- Buffers.isDirect() chooses fast-path iff JAVA_6, otherwise using reflection (GCJ/ECJ)
- Adding JAVA_6 info in VersionUtil
- API doc: Refine JAVA_SE and JAVA_6 spec.
TODO: In case GCJ etc is unable to compile the JAVA_6 code
even though it uses a static condition (probably not),
We have to wrap isStatic in an own class, one for JAVA_6 and one for <= 1.5.
This will be a good exercise for further issues we may have w/ Java <= 1.5.
|
|
|
|
|
|
|
| |
JNILibLoaderBase.loadLibraryInternal() to NativeLibrary.findLibrary(..)
This allows using TempJarCache (if used/initialized) for native 'tool' libraries as well.
This is the case of JOAL's attempt to load the provided 'libopenal.so'
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Derivation
+++
JNILibLoaderBase.addNativeJarLibs(..): Add API doc
JNILibLoaderBase:
"addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)" ->
"addNativeJarLibs(Class<?>[] classesFromJavaJars, String singleJarMarker, String[] stripBasenameSuffixes)"
Derive the 'all' (1st choice) native JAR URL solely on the given class's JAR URL.
Examples:
JOCL:
// only: jocl.jar -> jocl-natives-'os.and.arch'.jar
addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null );
JOGL:
final ClassLoader cl = GLProfile.class.getClassLoader();
// either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar
// or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar,
// jogl-core.jar -> jogl-natives-<os.and.arch>.jar,
// (newt-core.jar -> newt-natives-<os.and.arch>.jar)? (if available)
final String newtFactoryClassName = "com.jogamp.newt.NewtFactory";
final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null };
if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) {
classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl);
}
JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } );
Efficiency / Performance:
- Reduced JAR URL lookup calls JarUtil.getJarURL(..) - JNILibLoaderBase, Platform, JarUtil
- Attempt loading Jar files (native, class, ..) only once - TempJarCache
Code Cleanup (IOUtil, JarUtil, :
- IOException if not found
- IllegalArgumentException if null argument
+++
jogamp.android-launcher.jar -> jogamp-android-launcher.jar
+++
|
|
|
|
|
|
|
|
|
|
|
|
| |
library loading
Some Platform field declarations and it's static initialization has been delegated
to it's new abstract super class PlatformPropsImpl to solve
static initialization interdependencies w/ the GlueGen native library loading
and it's derived information {@link #getMachineDescription()}, {@link #is32Bit()}, ..<br>
This mechanism is preferred in this case to avoid synchronization and locking
and allow better performance accessing the mentioned fields/methods.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
specific classes for non Android platforms.
Android specifics are delegated via class AndroidUtils,
which uses reflection to call AndroidUtilsImpl if platform is Android.
Android code is confined to the packages:
jogamp.common.os.android.*
jogamp.android.launcher.*
and only included when compiled for the Android platform.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
tool native libraries.
NativeLibrary: Expose 'String findLibrary(String libName, ClassLoader loader)',
allowing utilization of System.load(loader.findLibrary(libName)).
JNILibLoaderBase.loadLibrary(): Add optional ClassLoader argument, used to locate the library
DynamicLibraryBundle: Use DynamicLibraryInfo's ClassLoader to find native libraries (tool + jni)
|
| |
|