From: "Martin Storsjö" <martin@martin.st>
To: ffmpeg-devel@ffmpeg.org
Cc: "Martin Storsjö" <martin@martin.st>
Subject: [FFmpeg-devel] [PATCH] ntdll: Zero-initialize the syscall_frame used for starting threads on ARM/ARM64
Date: Fri, 4 Mar 2022 18:15:31 +0200
Message-ID: <20220304161531.1558318-1-martin@martin.st> (raw)
This fixes an inconsistency since
fed7e7a78b4bea183d0cbb107953e275f17baa4f (ntdll: Simulate a syscall
return when starting a thread); in that commit, on i386 and
x86_64, the syscall_frame used for starting the thread was
zeroed with a memset, while it wasn't on arm and arm64.
This had a noticable effect on float maths, where the
uninitialized frame->restore_flags field could have the
CONTEXT_FLOATING_POINT bit set. (call_init_thunk only ORs in
CONTEXT_INTEGER into the restore_flags field, on all architectures).
If that bit was set, it would restore uninitialized data into the
fpscr register, possibly setting the FPU in a nondefault rounding
mode.
Signed-off-by: Martin Storsjö <martin@martin.st>
---
dlls/ntdll/unix/signal_arm.c | 1 +
dlls/ntdll/unix/signal_arm64.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c
index a1bcb0ddd32..1fea76f6563 100644
--- a/dlls/ntdll/unix/signal_arm.c
+++ b/dlls/ntdll/unix/signal_arm.c
@@ -1105,6 +1105,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
ctx = (CONTEXT *)((ULONG_PTR)context.Sp & ~15) - 1;
*ctx = context;
ctx->ContextFlags = CONTEXT_FULL;
+ memset( frame, 0, sizeof(*frame) );
NtSetContextThread( GetCurrentThread(), ctx );
frame->sp = (DWORD)ctx;
diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c
index 94f280e218a..1df97f16f13 100644
--- a/dlls/ntdll/unix/signal_arm64.c
+++ b/dlls/ntdll/unix/signal_arm64.c
@@ -1202,6 +1202,7 @@ void DECLSPEC_HIDDEN call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, B
ctx = (CONTEXT *)((ULONG_PTR)context.Sp & ~15) - 1;
*ctx = context;
ctx->ContextFlags = CONTEXT_FULL;
+ memset( frame, 0, sizeof(*frame) );
NtSetContextThread( GetCurrentThread(), ctx );
frame->sp = (ULONG64)ctx;
--
2.25.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2022-03-04 16:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 16:15 Martin Storsjö [this message]
2022-03-04 16:17 ` Martin Storsjö
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220304161531.1558318-1-martin@martin.st \
--to=martin@martin.st \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git