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. --- x86_64/locore.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'x86_64') diff --git a/x86_64/locore.S b/x86_64/locore.S index 612fc493..bbb63252 100644 --- a/x86_64/locore.S +++ b/x86_64/locore.S @@ -1318,6 +1318,7 @@ copyin_fail: */ ENTRY(copyinmsg) xchgq %rsi,%rdi /* Get user source and kernel destination */ + movl %edx,MSGH_MSGH_SIZE(%rdi) /* set msgh_size already */ /* 32 on 64 conversion */ subq $32,%rdx @@ -1330,8 +1331,9 @@ ENTRY(copyinmsg) /* Copy msgh_size */ RECOVER(copyin_fail) lodsl - addl $8,%eax - stosl + /* But don't actually store it: we have already set it above to what we + really copy */ + addl $4,%rdi xorq %rax,%rax /* Copy msgh_remote_port */ -- cgit v1.2.3