Skip to content

Commit 128fd6e

Browse files
committed
Fix syscall param msg->desc.port.name on macOS 10.12. bz#379373
Based upon patch from Louis Brunner.
1 parent 3117cd9 commit 128fd6e

File tree

5 files changed

+17
-57
lines changed

5 files changed

+17
-57
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ To see details of a given bug, visit
3535
https://bugs.kde.org/show_bug.cgi?id=XXXXXX
3636
where XXXXXX is the bug number as listed below.
3737

38+
379373 Fix syscall param msg->desc.port.name points to uninitialised byte(s)
39+
on macOS 10.12
3840
379748 Fix missing pselect syscall (OS X 10.11)
3941
380397 s390x: __GI_strcspn() replacemenet needed
4042
381162 possible array overrun in VEX register allocator

coregrind/m_syswrap/syswrap-darwin.c

+15-3
Original file line numberDiff line numberDiff line change
@@ -9580,8 +9580,20 @@ PRE(kernelrpc_mach_port_construct_trap)
95809580
{
95819581
UWord a1; UWord a2; ULong a3; UWord a4;
95829582
munge_wwlw(&a1, &a2, &a3, &a4, ARG1, ARG2, ARG3, ARG4, ARG5);
9583-
PRINT("kernelrpc_mach_port_construct_trap(FIXME)"
9584-
"(%lx,%lx,%llx,%lx)", a1, a2, a3, a4);
9583+
PRINT("kernelrpc_mach_port_construct_trap"
9584+
"(target: %s, options: %#lx, content: %llx, name: %p)",
9585+
name_for_port(a1), a2, a3, *(mach_port_name_t**)a4);
9586+
PRE_MEM_WRITE("kernelrpc_mach_port_construct_trap(name)", a4,
9587+
sizeof(mach_port_name_t*));
9588+
}
9589+
POST(kernelrpc_mach_port_construct_trap)
9590+
{
9591+
UWord a1; UWord a2; ULong a3; UWord a4;
9592+
munge_wwlw(&a1, &a2, &a3, &a4, ARG1, ARG2, ARG3, ARG4, ARG5);
9593+
PRINT("-> name:%p", *(mach_port_name_t**)a4);
9594+
if (ML_(safe_to_deref)((mach_port_name_t*)a4, sizeof(mach_port_name_t*))) {
9595+
POST_MEM_WRITE(a4, sizeof(mach_port_name_t*));
9596+
}
95859597
}
95869598

95879599
PRE(kernelrpc_mach_port_destruct_trap)
@@ -10597,7 +10609,7 @@ const SyscallTableEntry ML_(mach_trap_table)[] = {
1059710609
# endif
1059810610

1059910611
# if DARWIN_VERS >= DARWIN_10_9
10600-
MACX_(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(24), kernelrpc_mach_port_construct_trap),
10612+
MACXY(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(24), kernelrpc_mach_port_construct_trap),
1060110613
MACX_(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(25), kernelrpc_mach_port_destruct_trap),
1060210614
# else
1060310615
_____(VG_DARWIN_SYSCALL_CONSTRUCT_MACH(24)),

darwin14.supp

-18
Original file line numberDiff line numberDiff line change
@@ -665,24 +665,6 @@
665665
obj:*GPUSupport.framework*GPUSupportMercury*
666666
}
667667

668-
{
669-
OSX1010:mach_msg_trap-1
670-
Memcheck:Param
671-
msg->desc.port.name
672-
fun:mach_msg_trap
673-
obj:*libsystem_kernel.dylib*
674-
obj:*SystemConfiguration.framework*SystemConfiguration*
675-
}
676-
677-
{
678-
OSX1010:mach_msg_trap-2
679-
Memcheck:Param
680-
msg->desc.port.name
681-
fun:mach_msg_trap
682-
obj:*SystemConfiguration.framework*SystemConfiguration*
683-
obj:*SystemConfiguration.framework*SystemConfiguration*
684-
}
685-
686668
# See https://bugs.kde.org/show_bug.cgi?id=188572 about this; it's
687669
# unavoidable due to BSD setenv() semantics.
688670
{

darwin15.supp

-18
Original file line numberDiff line numberDiff line change
@@ -724,24 +724,6 @@
724724
obj:*GPUSupport.framework*GPUSupportMercury*
725725
}
726726

727-
{
728-
OSX1011:mach_msg_trap-1
729-
Memcheck:Param
730-
msg->desc.port.name
731-
fun:mach_msg_trap
732-
obj:*libsystem_kernel.dylib*
733-
obj:*SystemConfiguration.framework*SystemConfiguration*
734-
}
735-
736-
{
737-
OSX1011:mach_msg_trap-2
738-
Memcheck:Param
739-
msg->desc.port.name
740-
fun:mach_msg_trap
741-
obj:*SystemConfiguration.framework*SystemConfiguration*
742-
obj:*SystemConfiguration.framework*SystemConfiguration*
743-
}
744-
745727
# See https://bugs.kde.org/show_bug.cgi?id=188572 about this; it's
746728
# unavoidable due to BSD setenv() semantics.
747729
{

darwin16.supp

-18
Original file line numberDiff line numberDiff line change
@@ -749,24 +749,6 @@
749749
obj:*GPUSupport.framework*GPUSupportMercury*
750750
}
751751

752-
{
753-
OSX1012:mach_msg_trap-1
754-
Memcheck:Param
755-
msg->desc.port.name
756-
fun:mach_msg_trap
757-
obj:*libsystem_kernel.dylib*
758-
obj:*SystemConfiguration.framework*SystemConfiguration*
759-
}
760-
761-
{
762-
OSX1012:mach_msg_trap-2
763-
Memcheck:Param
764-
msg->desc.port.name
765-
fun:mach_msg_trap
766-
obj:*SystemConfiguration.framework*SystemConfiguration*
767-
obj:*SystemConfiguration.framework*SystemConfiguration*
768-
}
769-
770752
# See https://bugs.kde.org/show_bug.cgi?id=188572 about this; it's
771753
# unavoidable due to BSD setenv() semantics.
772754
{

0 commit comments

Comments
 (0)