Re: Non-Deterministic / Unpredictable Behavior (Again) [SOLVED]

Ken Gentle <[email protected]> Sun, 13 Apr 2008 16:16:59 -0400
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
Thanks for the explanation, ya'll.

I think remember there being some discussion in the early days of Java (like
1.0-1.1) about the use of addresses in  equals/hashcode implementations
being a concern in the Applet Sandbox - if a malicious Applet were to be
able to deduce addresses then the potential risk for abuse/misuse is
increased.  Maybe it was just a discussion about addresses in general, but
it might explain the obfuscation.

Ken

On Sat, Apr 12, 2008 at 5:10 PM, Jeff Kesselman <[email protected]>
wrote:

> Randall R Schulz wrote:
>
> > On Saturday 12 April 2008 07:54, Attila Szegedi wrote:
> >
> >  On 2008.04.12., at 16:12, Randall R Schulz wrote:
> > >
> > >  ...
> > > >
> > > >  In order to make it harder (ideally, impossible) to figure out an
> > > object's address in the address space of the process, the identity
> > > hash code function actually uses an automorphic transformation on the
> > > address space, using the object's first allocated address (the
> > > transformation in question ain't exactly a XOR if I remember
> > > correctly from last time I dug in Sun JVM source code, but is
> > > similar). The key for the transformation (i.e. the XOR value) is
> > > randomly chosen on each JVM startup, which would explain the
> > > differing behavior.
> > >
> > >
> > Fascinating.
> >
> > Why try to obfuscate the virtual address of instances?
> >
> >  I don't know if there is another reason, but one is to prevent you from
> writing code that depends on things like the order of allocation of the
> objects.
>
> Java is a "fail early" language.  The design is intended so that
> mistakes that could make the code fail eventually fail as early as
> possible.  I could see this being an intent to make code that broke the
> rules and tried to depend on order of allocation fail early.
>
>
> ===================================
> This list is hosted by DevelopMentor(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>



--

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com