OpenAFS Master Repository branch, master, updated. BP-openafs-stable-1_8_x-435-g0a39efe
Gerrit Code Review
gerrit@openafs.org
Sun, 25 Aug 2019 20:01:53 -0400
The following commit has been merged in the master branch:
commit 0a39efee224e8d4431ae79281ca353a7ba6fdce4
Author: Andrew Deason <adeason@dson.org>
Date: Sun Jul 14 17:31:30 2019 -0500
FBSD: Use ucontext for FreeBSD 10+ on amd64
Currently, running any LWP program on recent FreeBSD on amd64 causes
(or can cause) a SIGBUS very quickly. This is possibly because our
stack management code in LWP only ensures our stacks are 4 or 8-byte
aligned in most cases (except DARWIN, which gets 16-byte-aligned
stacks), according to the value of STACK_ALIGN. The amd64 ABI mandates
that stacks be 16-byte-aligned, and some function calls assume that
this is followed, causing a SIGBUS when it is not. FreeBSD on amd64
currently uses process.amd64.s for its savecontext() implementation,
which does not do any checking or fixup of the stack alignment.
This behavior has been observed on amd64 with FreeBSD 11 specifically,
but it probably happens on any FreeBSD release when using clang.
FreeBSD switched to clang as the default compiler with FreeBSD 10, so
this probably occurs with FreeBSD 10 and newer.
We could perhaps try to fix this by changing our stack management
code, but we can also avoid most of this nonsense by just using
ucontext instead of our custom assembly code. So, do that, by setting
USE_UCONTEXT for FreeBSD 10+. Also enable the same 'stackvar'-based
workaround in savecontext() as Linux uses, since otherwise 'topstack'
appears to always be NULL, and triggers our stack overflow checks.
Note that while LWP use is deprecated, as of this commit many small
utilities (like 'fs') are still linked to LWP, and so are unusable
without a fix like this.
Change-Id: Ie8e928bd71e7f6e9c0fb1379259c55527b6ccdf3
Reviewed-on: https://gerrit.openafs.org/13691
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
src/config/param.amd64_fbsd_100.h | 2 ++
src/config/param.amd64_fbsd_101.h | 2 ++
src/config/param.amd64_fbsd_102.h | 2 ++
src/config/param.amd64_fbsd_103.h | 2 ++
src/config/param.amd64_fbsd_104.h | 2 ++
src/config/param.amd64_fbsd_110.h | 2 ++
src/config/param.amd64_fbsd_111.h | 2 ++
src/config/param.amd64_fbsd_112.h | 2 ++
src/config/param.amd64_fbsd_120.h | 2 ++
src/lwp/Makefile.in | 2 ++
src/lwp/process.c | 14 +++++++++-----
11 files changed, 29 insertions(+), 5 deletions(-)
--
OpenAFS Master Repository