RFR: 8000975: (process) Merge UNIXProcess.java.bsd & UNIXProcess.java.linux (& .solaris & .aix)

Martin Buchholz martinrb at google.com
Thu Apr 17 16:50:47 UTC 2014


This test tries to make sure we have all of the doPrivileged blocks in
place.  Which is hard to do.  I don't recall the details.  It would seem
better to simply test that processes can be executed if the very specific
permission to do just that was provided.  Which IIRC
ProcessBuilder/Basic.java already has tests for.  Ohhh.... but to test
clinit behavior, they have to be in a new JVM instance, so the existing
tests in Basic are insufficient for that purpose.  But it would be
cumbersome to transplant current security tests from Basic into an
environment where it's the only invocation of the process api.


On Thu, Apr 17, 2014 at 8:33 AM, Peter Levart <peter.levart at gmail.com>wrote:

> Hi Martin,
>
> Since you are the author of the test/java/lang/ProcessBuilder/SecurityManagerClinit.java
> test, I thought I'll ask you about the purpose of the following line in the
> test just before setting up the Policy and SecurityManager:
>
>         // A funky contrived security setup, just for bug repro purposes.
>         java.security.Security.setProperty("package.access", "java.util");
>
> The merge of UNIXProcess.java.* sources fails this test since it now uses
> lambdas in various places and it seems that MHs are involved that need
> access to java.util package from a class loaded by AppClassLoader. Would it
> defeat the purpose of the test if "java.util" package was replaced by say
> "sun.misc" which is normally restricted?
>
> Regards, Peter
>
>
> On 04/04/2014 09:24 PM, roger riggs wrote:
>
>> Hi Peter,
>>
>> I ran into one test problem when running this through its paces.
>>
>> The test: test/java/lang/ProcessBuilder/SecurityManagerClinit.java
>> throws a package access exception while creating a lambda
>> due to the wacky security manager and forbidding of access to java.util.
>> I hacked the test to remove the limitation on java.util.
>>
>> This looks good to me but a more experienced Reviewer should look at it.
>>
>> Thanks, Roger
>>
>>
>>  Right,
>>>
>>> Here it is:
>>>
>>> http://cr.openjdk.java.net/~plevart/jdk9-dev/UNIXProcess/webrev.06/
>>>
>>
>>
>> Stack dump from test:
>> java.lang.ExceptionInInitializerError
>>         at java.lang.invoke.DirectMethodHandle.makePreparedLambdaForm(
>> DirectMethodHandle.java:256)
>>         at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(
>> DirectMethodHandle.java:221)
>>         at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(
>> DirectMethodHandle.java:210)
>>         at java.lang.invoke.DirectMethodHandle.make(
>> DirectMethodHandle.java:82)
>>         at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(
>> MethodHandles.java:1638)
>>         at java.lang.invoke.MethodHandles$Lookup.
>> getDirectMethodNoSecurityManager(MethodHandles.java:1602)
>>         at java.lang.invoke.MethodHandles$Lookup.
>> getDirectMethodForConstant(MethodHandles.java:1778)
>>         at java.lang.invoke.MethodHandles$Lookup.
>> linkMethodHandleConstant(MethodHandles.java:1727)
>>         at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(
>> MethodHandleNatives.java:442)
>>         at java.lang.UNIXProcess$Platform.get(UNIXProcess.java:147)
>>         at java.lang.UNIXProcess.<clinit>(UNIXProcess.java:160)
>>         at java.lang.ProcessImpl.start(ProcessImpl.java:130)
>>         at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)
>>         at java.lang.Runtime.exec(Runtime.java:620)
>>         at java.lang.Runtime.exec(Runtime.java:485)
>>         at SecurityManagerClinit.main(SecurityManagerClinit.java:70)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:62)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:484)
>>         at com.sun.javatest.regtest.MainWrapper$MainThread.run(
>> MainWrapper.java:94)
>>         at java.lang.Thread.run(Thread.java:744)
>> Caused by: java.security.AccessControlException: access denied
>> ("java.lang.RuntimePermission" "accessClassInPackage.java.util")
>>         at java.security.AccessControlContext.checkPermission(
>> AccessControlContext.java:457)
>>         at java.security.AccessController.checkPermission(
>> AccessController.java:884)
>>         at java.lang.SecurityManager.checkPermission(
>> SecurityManager.java:541)
>>         at java.lang.SecurityManager.checkPackageAccess(
>> SecurityManager.java:1481)
>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:305)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:359)
>>         at sun.invoke.util.BytecodeDescriptor.parseSig(
>> BytecodeDescriptor.java:83)
>>         at sun.invoke.util.BytecodeDescriptor.parseMethod(
>> BytecodeDescriptor.java:54)
>>         at sun.invoke.util.BytecodeDescriptor.parseMethod(
>> BytecodeDescriptor.java:41)
>>         at java.lang.invoke.MethodType.fromMethodDescriptorString(
>> MethodType.java:911)
>>         at java.lang.invoke.MemberName.getMethodType(MemberName.java:144)
>>         at java.lang.invoke.LambdaForm.computeInitialPreparedForms(
>> LambdaForm.java:477)
>>         at java.lang.invoke.LambdaForm.<clinit>(LambdaForm.java:1641)
>>
>>
>



More information about the core-libs-dev mailing list