[Bug 194828] [test] lib.libc.sys.getcontext_test.setcontext_link fails on amd64, not i386

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Nov 21 20:23:23 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194828

--- Comment #13 from John Baldwin <jhb at 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.


More information about the freebsd-testing mailing list