https://github.com/mozilla/gecko-dev
Revision 61edf584731a511131333b9df0e592b96ed4a96e authored by Laszlo Ersek on 24 September 2016, 04:36:16 UTC, committed by Laszlo Ersek on 24 September 2016, 04:36:16 UTC
The invoke_copy_to_stack() function passes incorrect "stack_args" and
"end" arguments to the alloc_word() utility function, for parameter types
T_I8..T_I64, T_U8..T_U64, T_BOOL, T_CHAR and T_WCHAR.

Namely, the "end" input parameter of invoke_copy_to_stack(), which is
currently incorrectly passed as "end" to alloc_word(), points to the very
end of the entire exchange area between _NS_InvokeByIndex() and
invoke_copy_to_stack(). However, alloc_word()'s "end" parameter should
point to the end of the "ireg" (integer registers) sub-area of the
exchange area. That is, "ireg_end" should be passed to alloc_word() as
"end".

Because invoke_copy_to_stack()'s "end" input parameter is strictly greater
than "ireg_end", alloc_word() will happily trample over the "freg"
(floating point registers) area, on the above-mentioned type branches,
given a large enough "paramCount".

Similarly, as second argument, "stack_args" should be passed to
alloc_word(), pointing to the next available stack slot, for spilled-over
arguments. Passing "stk", which initially points to the base of the entire
exchange area (and hence the base of the "ireg" area) makes no sense.

The two other alloc_word() calls in the function are correct. So
centralize all calls to alloc_word() to a single location -- thereby
ending up with a sole call site per alloc_XXX() function --, and compute
only the last argument, "word", conditionally.

This fixes an obscure SIGSEGV in AARCH64 Firefox. Triggering the bug
requires a target function with seven integer-like parameters (not
counting the implicit "this" -- aka "that" -- parameter), followed by at
least one parameter of the above buggy types. nsIOService::NewChannel2()
is such a target function, for example.

--HG--
extra : source : 9f3a85f50cff5d0f3a7c32c7ad9c703b8ed7d031
extra : intermediate-source : 67759b4345ae936496496183705be8a4cb925dee
1 parent 21f36d8
History
Tip revision: 61edf584731a511131333b9df0e592b96ed4a96e authored by Laszlo Ersek on 24 September 2016, 04:36:16 UTC
Bug 1304962 - Fix argument processing in AARCH64 xptcall. r=froydnj, a=lizzard
Tip revision: 61edf58
File Mode Size
accessible
addon-sdk
b2g
browser
build
caps
chrome
config
db
devtools
docshell
dom
editor
embedding
extensions
gfx
gradle
hal
image
intl
ipc
js
layout
media
memory
mfbt
mobile
modules
mozglue
netwerk
nsprpub
other-licenses
parser
probes
python
rdf
release
security
services
startupcache
storage
taskcluster
testing
toolkit
tools
uriloader
view
widget
xpcom
xpfe
.clang-format -rw-r--r-- 104 bytes
.clang-format-ignore -rw-r--r-- 26 bytes
.eslintignore -rw-r--r-- 6.9 KB
.eslintrc -rw-r--r-- 202 bytes
.flake8 -rw-r--r-- 54 bytes
.gdbinit -rw-r--r-- 4.9 KB
.gdbinit_python -rw-r--r-- 68 bytes
.gitignore -rw-r--r-- 2.5 KB
.hgignore -rw-r--r-- 2.7 KB
.hgtags -rw-r--r-- 22.1 KB
.lldbinit -rw-r--r-- 1.6 KB
.taskcluster.yml -rw-r--r-- 3.8 KB
.ycm_extra_conf.py -rw-r--r-- 1.4 KB
AUTHORS -rw-r--r-- 33.5 KB
Android.mk -rw-r--r-- 284 bytes
CLOBBER -rw-r--r-- 1.1 KB
GNUmakefile -rw-r--r-- 261 bytes
LEGAL -rw-r--r-- 2.5 KB
LICENSE -rw-r--r-- 389 bytes
Makefile.in -rw-r--r-- 13.3 KB
README.txt -rw-r--r-- 1.2 KB
aclocal.m4 -rw-r--r-- 1.7 KB
build.gradle -rw-r--r-- 4.1 KB
client.mk -rw-r--r-- 16.2 KB
client.py -rwxr-xr-x 5.7 KB
configure.in -rw-r--r-- 1.1 KB
configure.py -rw-r--r-- 3.4 KB
gradle.properties -rw-r--r-- 48 bytes
gradlew -rwxr-xr-x 4.8 KB
mach -rwxr-xr-x 6.0 KB
moz.build -rw-r--r-- 1.9 KB
moz.configure -rw-r--r-- 7.5 KB
mozilla-config.h.in -rw-r--r-- 2.1 KB
old-configure.in -rw-r--r-- 225.5 KB
settings.gradle -rw-r--r-- 2.3 KB
test.mozbuild -rw-r--r-- 429 bytes

README.txt

back to top