[x264-devel] Fix clang stack alignment issues

Henrik Gramner git at videolan.org
Tue Aug 7 00:05:20 CEST 2018


x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Sat Jun  2 20:35:10 2018 +0200| [7737e6ad4acf1058aeb0f9802e2a3ca1e0a30d29] | committer: Henrik Gramner

Fix clang stack alignment issues

Clang emits aligned AVX stores for things like zeroing stack-allocated
variables when using -mavx even with -fno-tree-vectorize set which can
result in crashes if this occurs before we've realigned the stack.

Previously we only ensured that the stack was realigned before calling
assembly functions that accesses stack-allocated buffers but this is
not sufficient. Fix the issue by changing the stack realignment to
instead occur immediately in all CLI, API and thread entry points.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=7737e6ad4acf1058aeb0f9802e2a3ca1e0a30d29
---

 common/base.c         | 60 +++++++++++++++++++++++++++++++-------
 common/threadpool.c   |  9 ++++--
 common/x86/cpu-a.asm  | 80 ++++++++++++++++++++++++++++-----------------------
 encoder/api.c         | 29 +++++++++++--------
 encoder/encoder.c     |  8 +++---
 encoder/lookahead.c   | 15 ++++++----
 encoder/ratecontrol.c |  2 +-
 tools/checkasm.c      |  6 +++-
 x264.c                |  7 ++++-
 9 files changed, 144 insertions(+), 72 deletions(-)

Diff:   http://git.videolan.org/gitweb.cgi/x264.git/?a=commitdiff;h=7737e6ad4acf1058aeb0f9802e2a3ca1e0a30d29


More information about the x264-devel mailing list