From 4f82ae66628a517585d6bef9465662a45481d024 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 28 Aug 2022 13:10:35 +0200 Subject: copyinmsg: Set msgh_size inside copyinmsg rather than the caller In the 32/64 conversion case it is copyinmsg that will know the eventual size. --- i386/i386/i386asm.sym | 2 ++ i386/i386/locore.S | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'i386') diff --git a/i386/i386/i386asm.sym b/i386/i386/i386asm.sym index 417c040d..9f4ebe55 100644 --- a/i386/i386/i386asm.sym +++ b/i386/i386/i386asm.sym @@ -171,3 +171,5 @@ offset shared_info si evtchn_mask EVTMASK offset shared_info si vcpu_info[0].arch.cr2 CR2 #endif /* MACH_PV_PAGETABLES */ #endif /* MACH_XEN */ + +offset mach_msg_header msgh msgh_size diff --git a/i386/i386/locore.S b/i386/i386/locore.S index 8a1054a6..162bb13a 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -1314,6 +1314,7 @@ ENTRY(copyinmsg) movl 8+S_ARG0,%esi /* get user start address */ movl 8+S_ARG1,%edi /* get kernel destination address */ movl 8+S_ARG2,%ecx /* get count */ + movl %ecx,%edx /* save count */ movl $USER_DS,%eax /* use user data segment for accesses */ mov %ax,%ds @@ -1325,6 +1326,9 @@ ENTRY(copyinmsg) movsl /* move longwords */ xorl %eax,%eax /* return 0 for success */ + movl 8+S_ARG1,%edi + movl %edx,%es:MSGH_MSGH_SIZE(%edi) /* set msgh_size */ + copyinmsg_ret: mov %ss,%di /* restore DS to kernel segment */ mov %di,%ds -- cgit v1.2.3