Bug 1611565 - Cherry-pick upstream patch to use public siginfo_t fields r=gcp

Upstream patch:
6bd491daaf%5E%21/#F0

_sifields is a glibc-internal field, and is not available on musl
libc. Instead, use the public-facing fields si_call_addr, si_syscall,
and si_arch, if they are available.

Differential Revision: https://phabricator.services.mozilla.com/D61051

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Forney 2020-02-06 17:17:18 +00:00
Родитель 6b86d4786b
Коммит 4809dfc033
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -164,11 +164,18 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
}
// Obtain the siginfo information that is specific to SIGSYS. Unfortunately,
// most versions of glibc don't include this information in siginfo_t. So,
// we need to explicitly copy it into a arch_sigsys structure.
// Obtain the siginfo information that is specific to SIGSYS.
struct arch_sigsys sigsys;
#if defined(si_call_addr) && !defined(__native_client_nonsfi__)
sigsys.ip = info->si_call_addr;
sigsys.nr = info->si_syscall;
sigsys.arch = info->si_arch;
#else
// If the version of glibc doesn't include this information in
// siginfo_t (older than 2.17), we need to explicitly copy it
// into an arch_sigsys structure.
memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
#endif
#if defined(__mips__)
// When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the