Bill Allombert on Sat, 28 Jan 2017 15:48:28 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Use PROT_NONE for unused virtual stack memory


On Sat, Jan 28, 2017 at 02:41:19PM +0100, Jeroen Demeyer wrote:
> On 2017-01-28 14:14, Bill Allombert wrote:
> >Unfortunately, this breaks the emscripten-compiled version.
> >(try E=ellinit("11a1");E.j).
> >This is very annoying.
> >Commit 0ce05b20 is OK, but f7d82845 does not work.
> 
> I have never used emscripten, so I cannot say anything about that. Do you
> know what goes wrong?

You can compare between gp.html and gpexp.html in the browser console.
Try this better test:
V=vector(2^20,i,i^2);vecsum(V)

with gp.html, one get:
 *** vector: Warning: increasing stack size to 8000000.
  *** _^s: Warning: increasing stack size to 16000000.
  *** _^s: Warning: increasing stack size to 32000000.
%1 = 384307717958270976

with gpexp.html, one get:

Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 2039988224, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 
abort("Cannot enlarge memory arrays. Either (1) compile with  -s TOTAL_MEMORY=X  with X higher than the current value 2039988224, (2) compile with  -s ALLOW_MEMORY_GROWTH=1  which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with  -s ABORTING_MALLOC=0 ") at jsStackTrace@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:1:18995
stackTrace@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:1:19166
abort@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:62:9174
abortOnCannotGrowMemory@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:1:20193
l2a@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:55:26003
$1a@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:55:7775
___syscall192@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:1:102055
Y$a@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:32:146862
dOa@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:5:29250
cOa@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:5:28647
sSa@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:12:22665
ALa@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:47:45989
RLa@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:47:84036
sFa@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:16:180446
YIa@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:51:78150
D2a@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:55:30065
invoke_iii@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:1:152502
$Ia@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:51:79625
ccallFunc@http://pari.math.u-bordeaux.fr/gpjsexp/gp-sta.js:1:10075
myevalm@http://pari.math.u-bordeaux.fr/gpexp.html:149:30
evalgp@http://pari.math.u-bordeaux.fr/gpexp.html:161:11
eval@http://pari.math.u-bordeaux.fr/gpexp.html:189:3
onclick@http://pari.math.u-bordeaux.fr/gpexp.html:1:8

If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
---
In fact I build with -s ALLOW_MEMORY_GROWTH=1 

The browser debugger give this:

RangeError: invalid or out-of-range index
_emscripten_memcpy_big()
 gp-sta.js:1
k2a()
 gp-sta.js:55
b2a()
 gp-sta.js:55
IRa()
 gp-sta.js:5
JRa()
 gp-sta.js:5
HRa()


This works fine with --disable-mmap.
Doing
default(parisizemax,"1G") also result in a similar crash.

The problem also occur when using node.js instead of a web browser.

Cheers,
Bill.