SecurityManager environments
Jason Tedor
jason at tedor.me
Thu Apr 6 03:10:40 UTC 2017
> As regards the security manager then it's hard to see how it fits into
the discussion. To be honest, we don't see a lot of security manager
usage on the server side these days. I look at a lot of bug reports and
error logs that include the command line and I don't see
-Djava.security.manager very often.
This is not to negate your point. We use the security manager in
Elasticsearch (a server application). It is not enabled via the
java.security.manager system property, instead we enable it at runtime [1].
SecureSM is our own security manager, too.
[1]:
https://github.com/elastic/elasticsearch/blob/471af48170218fbbb32399aabb3056f2f8a99c17/core/src/main/java/org/elasticsearch/bootstrap/Security.java#L119
On Wed, Apr 5, 2017 at 4:14 PM Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 05/04/2017 16:26, Gregg Wonderly wrote:
> > :
> > At the forefront of the failure of the SecurityManager to be an avidly
> used element of Java applications, is the simple fact that the whole
> infrastructure is horribly inefficient and full of locks and mutable data
> which should not be locked and should instead be immutable. But, because
> “assume no security manager in the picture” is the state of “the world”,
> the details have not been fixed, officially. In the Jini community, Peter
> Firmstone (most of the recent work), and I, have spent quite a bit of time
> on understand and fixing these issues. He has tried to push the knowledge
> of what needs to be done into various places, which I don’t recall at the
> moment.
> You are right that the performance overhead when running with a security
> manager can be a problem. Walking the stack to get the intersection of
> the permissions has historically been a big part of this. If there are
> proposals and patches to improve the performance then security-dev is
> the place to bring those for discussion, maybe hotspot-dev if it gets
> into the stack walking in the VM.
>
> > In the end because JDK-9 breaks everything (well not quite, but nearly,
> since spring and other similar libraries are broken), requiring command
> line arguments, why not just finally fix Java by instituting a default
> SecurityManager, instead of the command line flags, which enforces all of
> these things. Why not just require the added command line argument to be
> the permissions file to use?
> I assume the breakage you see is just a consequence of strong
> encapsulation. There is a lot of existing code that relies on being able
> to break into non-public members or access protected members from the
> wrong context. These are issues that should be reported to the owners of
> these libraries. We know it will be difficult in the interim before the
> maintainers release new versions that work with JDK 9.
>
> You mention Spring. There are some very smart people working on it and
> tracking JDK 9 closely from what I can tell. Existing versions
> SpringBoot fail today for a couple of reasons - one is that it is
> helping itself to a non-public constructor for MethodHandles.Lookup.
> Another is that it wants to invoke the protected ClassLoader.defineClass
> from the wrong context. I'm confident that they will fix this code in
> time as there new APIs to address these use cases. In the mean-time
> then there are command line options to keep existing versions working.
> Yes, command line options are pain but for executable JAR cases like
> this then there are JAR file attributes that come some relief from CLI
> options.
>
> As regards the security manager then it's hard to see how it fits into
> the discussion. To be honest, we don't see a lot of security manager
> usage on the server side these days. I look at a lot of bug reports and
> error logs that include the command line and I don't see
> -Djava.security.manager very often. If the overhead was zero and it was
> easier to identify the permissions needed by each component then maybe
> it would have got more popular. Another reason is that the access checks
> that you see in the discussions here are the access checks that the JLS
> and JVMS specifies. They are access checks that have to be done when you
> are not running with a security manager. They are also at a completely
> different level, meaning can bytecode in C1.m can access a member of C2.
> This is very different to the stack based permission checks that a
> security manager does.
>
> -Alan
>
More information about the jigsaw-dev
mailing list