summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/content/utils.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-02 09:46:06 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-02 09:46:06 +0200
commit9ee07e9b8894de3aec81689dba5dbc0fc025bb83 (patch)
tree62595e56b49c727f517581fc318cd08da96c20ae /devtools/client/debugger/content/utils.js
parenta659def00b38cded555d4005d2ceb7b55d27040b (diff)
downloadUXP-9ee07e9b8894de3aec81689dba5dbc0fc025bb83.tar
UXP-9ee07e9b8894de3aec81689dba5dbc0fc025bb83.tar.gz
UXP-9ee07e9b8894de3aec81689dba5dbc0fc025bb83.tar.lz
UXP-9ee07e9b8894de3aec81689dba5dbc0fc025bb83.tar.xz
UXP-9ee07e9b8894de3aec81689dba5dbc0fc025bb83.zip
Issue #578: Applications cannot start without /proc (chroot).
UXP uses the current stack frame address and the stack size as a sort of heuristic for various things in the JavaScript engine. The js::GetNativeStackBaseImpl() function is used to get the base stack address (i.e. the address from which the stack grows, so this can be either the first or last memory address of the stack memory space depending on the CPU architecture). On Linux, this function is implemented using the pthreads APIs. For non-main threads, the queried thread info is stored in memory. The main thread does not have this information on hand, so it gets the stack memory range via the /proc/self/maps file (see glibc's pthread_get_attr_np.c). Fortunately (per discussions with the firefox devs in #jsapi) the base address only needs to be approximate. In reality, environment variables, args, and other things are stored in stack space between the end/beginning of the mapped stack memory and the 'top' of the stack space used by stack frames. When using glibc, we can get the top of this usable stack from __libc_stack_end, which is a void* set by glibc during program initialization, avoiding the need to access /proc. Non-main threads still get their stack-base through the usual pthreads APIs. Other libc implementations like musl will fall back to the standard UNIX-like implementation which calls pthread's pthread_attr_getstack() also from the main thread, which may imply /proc access and not work in restricted environments.
Diffstat (limited to 'devtools/client/debugger/content/utils.js')
0 files changed, 0 insertions, 0 deletions