Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 May 2016 16:07:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        java@FreeBSD.org
Subject:   [Bug 209599] SIGSEGV in regression test suite on java/openjdk8
Message-ID:  <bug-209599-8522-SqtukhGY5Z@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-209599-8522@https.bugs.freebsd.org/bugzilla/>
References:  <bug-209599-8522@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D209599

--- Comment #9 from Andrew Smith <iamasmith.home@gmail.com> ---
Went at this form the other end as I had visibility of the native code.

Examining the stack from earlier we have the use of the load method to look=
 at.

Stack: [0x00007fffdf1f1000,0x00007fffdf2f1000],  sp=3D0x00007fffdf2f0860,  =
free
space=3D1022k
Native frames: (J=3Dcompiled Java code, j=3Dinterpreted, Vv=3DVM code, C=3D=
native code)
V  [libjvm.so+0x8d8d0a]  JVM_handle_bsd_signal+0x125c4a
j  sun.misc.Unsafe.getByte(J)B+0
j  java.nio.MappedByteBuffer.load()Ljava/nio/MappedByteBuffer;+85
j  Truncate$2.call()Ljava/lang/Void;+4
j  Truncate$2.call()Ljava/lang/Object;+1
j  Truncate$3.run()V+4
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub
V  [libjvm.so+0x59d83b]  AsyncGetCallTrace+0xcab7b
V  [libjvm.so+0x59c283]  AsyncGetCallTrace+0xc95c3
V  [libjvm.so+0x59c4bc]  AsyncGetCallTrace+0xc97fc
V  [libjvm.so+0x608c3e]  JVM_StartThread+0x36e
V  [libjvm.so+0x8b1600]  JVM_handle_bsd_signal+0xfe540
V  [libjvm.so+0x7ad3af]  JVM_FindSignal+0x19a4ff
C  [libthr.so.3+0x8855]  operator->+0x805
C  0x0000000000000000

    public final MappedByteBuffer load() {
        checkMapped();
        if ((address =3D=3D 0) || (capacity() =3D=3D 0))
            return this;
        long offset =3D mappingOffset();
        long length =3D mappingLength(offset);
        load0(mappingAddress(offset), length);

        // Read a byte from each page to bring it into memory. A checksum
        // is computed as we go along to prevent the compiler from otherwise
        // considering the loop as dead code.
        Unsafe unsafe =3D Unsafe.getUnsafe();
        int ps =3D Bits.pageSize();
        int count =3D Bits.pageCount(length);
        long a =3D mappingAddress(offset);
        byte x =3D 0;
        for (int i=3D0; i<count; i++) {
            x ^=3D unsafe.getByte(a);
            a +=3D ps;
        }
        if (unused !=3D 0)
            unused =3D x;

        return this;
    }

Unsafe, it seems is used to demand page the file in.

Looking at other unit tests we can see .load works OK, however, in this test
the file is truncated an then we attempt to demand page it in (this works b=
ased
on the length known by the MappedByteBuffer and here's where it fails.


        try {
            fc.truncate(TRUNCATED_FILE_SIZE);
            truncated =3D true;
        } catch (IOException ioe) {
            // probably on Windows where a file cannot be truncated when
            // there is a file mapping.
            truncated =3D false;
        }
        if (truncated) {
            // Test 1: access region that is no longer accessible
            execute(new Callable<Void>() {
                public Void call() {
                    mbb.get((int)TRUNCATED_FILE_SIZE + 1);
                    mbb.put((int)TRUNCATED_FILE_SIZE + 2, (byte)123);
                    return null;
                }
            });
            // Test 2: load buffer into memory
            execute(new Callable<Void>() {
                public Void call() throws IOException {
                    mbb.load();
                    return null;
                }
            });
        }
        fc.close();
    }

    // Runs the given task in its own thread. If operating correcting the
    // the thread will terminate with an InternalError as the mapped buffer
    // is inaccessible.
    static void execute(final Callable<?> c) {
        Runnable r =3D new Runnable() {
            public void run() {
                try {
                    Object ignore =3D c.call();
                } catch (Exception ignore) {
                }
            }
        };

Noting what it mentions in the execute wrapper.. there is an expectation th=
at
InternalError is raised but we are receiving a SIGSEGV.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-209599-8522-SqtukhGY5Z>