Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Nov 2014 08:22:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-testing@freebsd.org
Subject:   [Bug 194828] [test] lib.libc.sys.getcontext_test.setcontext_link fails in jenkins; not on FreeBSD/i386 with CURRENT
Message-ID:  <bug-194828-32464-jnhwn90g1m@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 #4 from Garrett Cooper <ngie@FreeBSD.org> ---
(In reply to Garrett Cooper from comment #3)
> Confirmed that this issue happens on a recent copy of amd64:
> 
> $ sudo kyua test getcontext_test 
> getcontext_test:getcontext_err  ->  passed  [0.006s]
> getcontext_test:setcontext_err  ->  passed  [0.006s]
> getcontext_test:setcontext_link  ->  failed:
> /usr/src/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c:118:
> setcontext(&uc[DEPTH-1]) != 0  [0.005s]
> 
> Results file id is usr_tests_lib_libc_sys.20141105-070522-007241
> Results saved to
> /root/.kyua/store/results.usr_tests_lib_libc_sys.20141105-070522-007241.db
> 
> 2/3 passed (1 failed)
> $ uname -a
> FreeBSD fuji-current-amd64.local 11.0-CURRENT FreeBSD 11.0-CURRENT #1
> r274088+75af1e3(isilon-atf)-dirty: Tue Nov  4 22:27:19 PST 2014    
> root@fuji-current-amd64.local:/usr/obj/usr/src/sys/FUJI  amd64
> 
> Rebuilding the kernel again on i386 to see whether or not this occurs there.
> If it does, this is a potentially new bug.

- The symptom for the failure with the testcase is setcontext(2) is failing
with rc == -1, errno == EINVAL on amd64. This isn't documented in
setcontext(2), so it's potentially a side effect with the system call. There's
an undocumented requirement check in sys_setcontext for uap->ucp == NULL, which
will return EINVAL, however.
- setcontext still isn't failing on i386.

Digging into sys/kern/kern_context.c, there're a few issues that have been
revealed with this bug:
1. The testcase might not be setting up required state for setcontext to
succeed on FreeBSD. I need to dig into whether or not a fix/workaround was
provided for setcontext internally at Isilon.
2. The documentation doesn't note that setcontext can fail with:
-- EINVAL in sys_setcontext(2)
-- EINVAL in set_mcontext(2) on amd64/i386.
-- Whatever copyin would fail with when copying in certain fields from userland
when dealing with savecontext(2).

Sidenote, there's an additional check in amd64 that's not handled in i386 which
could potentially feed back an EINVAL (the "-" context is amd64, the "+"
context is i386):

-       if (mcp->mc_len != sizeof(*mcp) ||
-           (mcp->mc_flags & ~_MC_FLAG_MASK) != 0)
+       if (mcp->mc_len != sizeof(*mcp))
                return (EINVAL);

jhb made a recent change to i386, but not amd64 in this syscall.

-- 
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-jnhwn90g1m>