harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Cornwall" <andrew.pack...@gmail.com>
Subject doPrivileged needed on many loadLibrary calls?
Date Wed, 06 Aug 2008 20:59:56 GMT
I've been looking through the Harmony code and have run into a number of
cases where loadLibrary() is called without recourse to an
AccessController.doPrivileged() operation. It seems as if a number of places
just get lucky with the security manager. Is there any reason not to
replace:

    static {
        System.loadLibrary("hyfoo"); //$NON-NLS-1$
    }

with:

    static {
            AccessController.doPrivileged(new PrivilegedAction<Object>() {
                public Object run() {
                    System.loadLibrary("hyfoo"); //$NON-NLS-1$
                    return null;
                }
            });
    }

Some of the files are in java.* packages, so they have to be on the bootpath
- which means wrapping them might not make sense. But others (like
PSPrinterJob and RandomBitsSupplier) are in org.apache.harmony.*, and might
not necessarily be on the bootpath for all consumers of Harmony classes.

Any thoughts?

    Andrew Jr.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message