Fix missing pselect syscall (OS X 10.11). bz#379748

Based upon patch from Louis Brunner.
This commit is contained in:
Rhys Kidd 2017-09-03 12:55:52 -04:00
parent 82b3f16a18
commit 55fe390c7a
6 changed files with 82 additions and 0 deletions

1
NEWS
View File

@ -35,6 +35,7 @@ To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
where XXXXXX is the bug number as listed below.
379748 Fix missing pselect syscall (OS X 10.11)
380397 s390x: __GI_strcspn() replacemenet needed
381162 possible array overrun in VEX register allocator
381272 ppc64 doesn't compile test_isa_2_06_partx.c without VSX support

View File

@ -489,7 +489,11 @@ DECL_TEMPLATE(darwin, __mac_syscall); // 381
// NYI __mac_get_lcid 391
// NYI __mac_get_lctx 392
// NYI __mac_set_lctx 393
#if DARWIN_VERS >= DARWIN_10_11
DECL_TEMPLATE(darwin, pselect); // 394
#else
// NYI setlcid 394
#endif /* DARWIN_VERS >= DARWIN_10_11 */
// NYI getlcid 395
// GEN read_nocancel 396
// GEN write_nocancel 397

View File

@ -9793,6 +9793,39 @@ PRE(guarded_writev_np)
#endif /* DARWIN_VERS >= DARWIN_10_10 */
/* ---------------------------------------------------------------------
Added for OSX 10.11 (El Capitan)
------------------------------------------------------------------ */
#if DARWIN_VERS >= DARWIN_10_11
PRE(pselect)
{
*flags |= SfMayBlock;
PRINT("pselect ( %ld, %#lx, %#lx, %#lx, %#lx, %#lx )", SARG1, ARG2, ARG3,
ARG4, ARG5, ARG6);
PRE_REG_READ5(long, "pselect",
int, n, vki_fd_set *, readfds, vki_fd_set *, writefds,
vki_fd_set *, exceptfds, struct vki_timeval *, timeout);
// XXX: this possibly understates how much memory is read.
if (ARG2 != 0)
PRE_MEM_READ( "pselect(readfds)",
ARG2, ARG1/8 /* __FD_SETSIZE/8 */ );
if (ARG3 != 0)
PRE_MEM_READ( "pselect(writefds)",
ARG3, ARG1/8 /* __FD_SETSIZE/8 */ );
if (ARG4 != 0)
PRE_MEM_READ( "pselect(exceptfds)",
ARG4, ARG1/8 /* __FD_SETSIZE/8 */ );
if (ARG5 != 0)
PRE_timeval_READ( "pselect(timeout)", ARG5 );
if (ARG6 != 0)
PRE_MEM_READ( "pselect(sigmask)", ARG6, sizeof(vki_sigset_t) );
}
#endif /* DARWIN_VERS >= DARWIN_10_11 */
/* ---------------------------------------------------------------------
Added for macOS 10.12 (Sierra)
------------------------------------------------------------------ */
@ -10454,6 +10487,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
#if DARWIN_VERS >= DARWIN_10_11
// _____(__NR_kdebug_trace_string), // 178
// _____(__NR_kevent_qos), // 374
MACX_(__NR_pselect, pselect), // 394
// _____(__NR_netagent_trigger), // 490
// _____(__NR_stack_snapshot_with_config), // 491
// _____(__NR_microstackshot), // 492

View File

@ -673,7 +673,13 @@
#define __NR___mac_get_lcid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(391)
#define __NR___mac_get_lctx VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(392)
#define __NR___mac_set_lctx VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(393)
#if DARWIN_VERS >= DARWIN_10_11
#define __NR_pselect VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(394)
#else
#define __NR_setlcid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(394)
#endif /* DARWIN_VERS >= DARWIN_10_11 */
#define __NR_getlcid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(395)
#define __NR_read_nocancel VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(396)
#define __NR_write_nocancel VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(397)

View File

@ -676,7 +676,17 @@ int main(void)
// __NR___mac_get_lcid 391
// __NR___mac_get_lctx 392
// __NR___mac_set_lctx 393
#if DARWIN_VERS >= DARWIN_10_11
{
long args[6] = { x0+8, x0+0xffffffee, x0+1, x0+1, x0+1, x0+1 };
GO(__NR_pselect, 394, "1s 6m");
SY(__NR_pselect, args+x0); FAIL;
}
#else
// __NR_setlcid 394
#endif /* DARWIN_VERS >= DARWIN_10_11 */
// __NR_getlcid 395
// The nocancel syscalls (396--423) are tested in scalar_nocancel.c.

View File

@ -1176,6 +1176,33 @@ Syscall param getfsstat64(buf) points to unaddressable byte(s)
-----------------------------------------------------
(369-379): unused
-----------------------------------------------------
-----------------------------------------------------
x200018a(394): __NR_pselect 1s 6m
-----------------------------------------------------
Syscall param pselect(readfds) contains uninitialised byte(s)
...
by 0x........: main (scalar.c:684)
Syscall param pselect(writefds) contains uninitialised byte(s)
...
by 0x........: main (scalar.c:684)
Syscall param pselect(readfds) points to uninitialised byte(s)
...
by 0x........: main (scalar.c:684)
Address 0x........ is on thread 1's stack
in frame #1, created by main (scalar.c:12)
Syscall param pselect(writefds) points to unaddressable byte(s)
...
by 0x........: main (scalar.c:684)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param pselect(exceptfds) points to unaddressable byte(s)
...
by 0x........: main (scalar.c:684)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
x270f(9999): 9999 1e
-----------------------------------------------------