Pull request

Fix FreeBSD 12 and 13 builds.
 -----BEGIN PGP SIGNATURE-----
 Comment: GPGTools - https://gpgtools.org
 
 iQIzBAABCgAdFiEEIDX4lLAKo898zeG3bBzRKH2wEQAFAmH5rQ0ACgkQbBzRKH2w
 EQBfpxAAzbkTtyxXyhA3jI2f1A/N9qHDeYdPGGxcnorv4Pt57Fjb5E28Gmav5/X0
 vEzqq+XxdmaaHDBaaw9s8KOIgeutjSkDORr2hkIhePWZKfZK5/ZQtK0ySO0DzdA2
 yDtkje+IDfzDDszwlvBoOllbf8W4ik06Mu/O3rZVuPTZcQOIAMNG+TP+9V/nb+xK
 KlV9mEag4eV4cjy1XXxTav4LbFeYRpyCLtTnQJe3GrYLGi33aEEanZEgxD73Al40
 pDQXR0e3jkoAZ7ao+9VrFNQc8Nde21MpewlXwcKihrLHUHC2Xyg0HDJu1tNvY3r4
 qmPLXWpBv0M1IiU7ctur52tcz1/giU284XX/dMhwUH244mjidY2SZyoAWrTu/Ja6
 w4gn2fELEya6Pru8XbKbJt2y6JAk/qpSqHdfE/By4iG3gHStSC+owe2Qxil2U5lM
 bB9SRJlcVS69J/J9dLVScUeR8vv8snhn44q8MSyjl3uAsNdI4UYQUPv4HOWkf0Uk
 nKWiTGtpWzY/avKjWTFtytvNri1jN+oe6xYzSUShudkN1gRUx9egeEN1yDOmHEyn
 CgRdAdF3xotM3KBBiFXZav8qhXphaZ4RBDC32WjuN45/iu+5h1YjxiYRgjl+NjUY
 oGrQxu5jEkqT0jbbxLqG0T26PsxfAOGNbJ4citlrT3w6MjHZ2nE=
 =K3qO
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bsdimp/tags/bsd-user-fix-pull-request' into staging

Pull request

Fix FreeBSD 12 and 13 builds.

# gpg: Signature made Tue 01 Feb 2022 21:58:37 GMT
# gpg:                using RSA key 2035F894B00AA3CF7CCDE1B76C1CD1287DB01100
# gpg: Good signature from "Warner Losh <wlosh@netflix.com>" [unknown]
# gpg:                 aka "Warner Losh <imp@bsdimp.com>" [unknown]
# gpg:                 aka "Warner Losh <imp@freebsd.org>" [unknown]
# gpg:                 aka "Warner Losh <imp@village.org>" [unknown]
# gpg:                 aka "Warner Losh <wlosh@bsdimp.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 2035 F894 B00A A3CF 7CCD  E1B7 6C1C D128 7DB0 1100

* remotes/bsdimp/tags/bsd-user-fix-pull-request:
  bsd-user/signal.c: Only copy the _capsicum for FreeBSD_version > 1400026

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
staging
Peter Maydell 2022-02-02 09:05:56 +00:00
commit f7c0e223ac
2 changed files with 10 additions and 0 deletions

View File

@ -59,12 +59,17 @@ void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
* For FreeBSD, we have si_pid, si_uid, si_status, and si_addr always. Linux and
* {Open,Net}BSD have a different approach (where their reason field is larger,
* but whose siginfo has fewer fields always).
*
* QEMU_SI_CAPSICUM is currently only FreeBSD 14 current only, so only define
* it where _capsicum is available.
*/
#define QEMU_SI_NOINFO 0 /* nothing other than si_signo valid */
#define QEMU_SI_FAULT 1 /* _fault is valid in _reason */
#define QEMU_SI_TIMER 2 /* _timer is valid in _reason */
#define QEMU_SI_MESGQ 3 /* _mesgq is valid in _reason */
#define QEMU_SI_POLL 4 /* _poll is valid in _reason */
#if defined(__FreeBSD_version) && __FreeBSD_version >= 1400026
#define QEMU_SI_CAPSICUM 5 /* _capsicum is valid in _reason */
#endif
#endif

View File

@ -222,6 +222,7 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
* We have to go based on the signal number now to figure out
* what's valid.
*/
si_type = QEMU_SI_NOINFO;
if (has_trapno(sig)) {
tinfo->_reason._fault._trapno = info->_reason._fault._trapno;
si_type = QEMU_SI_FAULT;
@ -241,11 +242,13 @@ static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
* capsicum is somewhere between weak and non-existant, but if we get
* one, then we know what to save.
*/
#ifdef QEMU_SI_CAPSICUM
if (sig == TARGET_SIGTRAP) {
tinfo->_reason._capsicum._syscall =
info->_reason._capsicum._syscall;
si_type = QEMU_SI_CAPSICUM;
}
#endif
break;
}
tinfo->si_code = deposit32(si_code, 24, 8, si_type);
@ -295,10 +298,12 @@ static void tswap_siginfo(target_siginfo_t *tinfo, const target_siginfo_t *info)
/* Note: Not generated on FreeBSD */
__put_user(info->_reason._poll._band, &tinfo->_reason._poll._band);
break;
#ifdef QEMU_SI_CAPSICUM
case QEMU_SI_CAPSICUM:
__put_user(info->_reason._capsicum._syscall,
&tinfo->_reason._capsicum._syscall);
break;
#endif
default:
g_assert_not_reached();
}