Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2014 20:23:22 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-testing@freebsd.org
Subject:   [Bug 194828] [test] lib.libc.sys.getcontext_test.setcontext_link fails on amd64, not i386
Message-ID:  <bug-194828-32464-udI60EE1iT@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-194828-32464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-194828-32464@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=194828

--- Comment #13 from John Baldwin <jhb@FreeBSD.org> ---
Eh, I had to build the test by hand so I could get debug symbols and then just
ran getcontext_test under gdb.

The error is that the test requires unsupported behavior for amd64.  amd64
passes the first 6 args in registers and the remainder on the stack. 
makecontext() on amd64 only handles args in registers.  If you ask it to pass
more than 6 arguments (this test asks for 10) to the function, it sabotages the
ucontext so that the subsequent setcontext() will fail by setting mc_len to 0. 
I noticed this by stepping in gdb and noting that mc_len went to zero after
makecontext() was called.  i386 doesn't have this check, so I suspect it will
not break with the fix I suggested applied to the kernel.  Relevant code in
amd64's makecontext:

    else if ((argc < 0) || (argc > 6) || (ucp->uc_stack.ss_sp == NULL) ||
        (ucp->uc_stack.ss_size < MINSIGSTKSZ)) {
        /*
         * This should really return -1 with errno set to ENOMEM
         * or something, but the spec says that makecontext is
         * a void function.   At least make sure that the context
         * isn't valid so it can't be used without an error.
         */
        ucp->uc_mcontext.mc_len = 0;
        return;
    }

With the test patched to only pass 6 arguments on amd64 it now passes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-194828-32464-udI60EE1iT>