Re: memory safety and weak references

2015-09-08 Thread Mark Miller
At https://esdiscuss.org/topic/memory-safety-and-weak-references#content-1 Dave Herman wrote > Interestingly, I wonder if the idea of only collecting weak references > between turns is immune to such attacks, since it's not possible to > have a bogus reference on the stack betwee

Re: memory safety and weak references

2013-04-01 Thread Brendan Eich
use an optimization. I just wanted to make it clear that one could. -Rick *From:*Oliver Hunt [mailto:oli...@apple.com] *Sent:* Monday, April 01, 2013 6:18 PM *To:* Hudson, Rick *Cc:* Brendan Eich; Marius Gundersen; es-discuss discussion *Subject:* Re: memory safety and weak references On Apr 1

RE: memory safety and weak references

2013-04-01 Thread Hudson, Rick
t: Re: memory safety and weak references On Apr 1, 2013, at 3:12 PM, "Hudson, Rick" mailto:rick.hud...@intel.com>> wrote: If the compiler can prove x does not escape the block and it is not used again then it is dead and the compiler is free to reuse the stack slot holding the

Re: memory safety and weak references

2013-04-01 Thread Oliver Hunt
On Apr 1, 2013, at 3:12 PM, "Hudson, Rick" wrote: > If the compiler can prove x does not escape the block and it is not used > again then it is dead and the compiler is free to reuse the stack slot > holding the last reference. > > So I am arguing that x = null; is not required to kill x. >

Re: memory safety and weak references

2013-04-01 Thread Mark S. Miller
, April 01, 2013 5:56 PM > To: Hudson, Rick > Cc: Oliver Hunt; Marius Gundersen; es-discuss discussion > Subject: Re: memory safety and weak references > > Hudson, Rick wrote: > > > > This brings up another interesting point. Do WeakRefs change a > > compiler&#

RE: memory safety and weak references

2013-04-01 Thread Hudson, Rick
(); is allowed to return null. - Rick -Original Message- From: Brendan Eich [mailto:bren...@mozilla.com] Sent: Monday, April 01, 2013 5:56 PM To: Hudson, Rick Cc: Oliver Hunt; Marius Gundersen; es-discuss discussion Subject: Re: memory safety and weak references Hudson, Rick wrote

Re: memory safety and weak references

2013-04-01 Thread Mark S. Miller
On Mon, Apr 1, 2013 at 2:56 PM, Brendan Eich wrote: > Hudson, Rick wrote: > >> >> This brings up another interesting point. Do WeakRefs change a compiler’s >> liveness analysis? >> >> > Yes, of course. > > > This could complicate some apparently useful optimizations. >> >> { >> >> var x = new So

Re: memory safety and weak references

2013-04-01 Thread Brendan Eich
Hudson, Rick wrote: This brings up another interesting point. Do WeakRefs change a compiler’s liveness analysis? Yes, of course. This could complicate some apparently useful optimizations. { var x = new Something(); someWeakRef.set(x); // Is x dead? (yes) Is x required to contribute t

Re: memory safety and weak references

2013-04-01 Thread Kevin Gadd
> numpages = {11}, > > url = {http://doi.acm.org/10.1145/277650.277738}, > > doi = {10.1145/277650.277738}, > > acmid = {277738}, > > publisher = {ACM}, > > address = {New York, NY, USA}, > > }** > > *From:* es-discuss

RE: memory safety and weak references

2013-04-01 Thread Hudson, Rick
on Subject: Re: memory safety and weak references There are numerous problems with weak references and primitives, mostly revolving around the ability to regenerate a primitive, e.g. someWeakRef.set("foo") gc() var something = "foo" someWeakRe

Re: memory safety and weak references

2013-04-01 Thread Brendan Eich
Marius Gundersen wrote: This is why I suggested, in the other thread, a system for weak event listeners. This would not be a problem if the only allowed argument to a weak reference is a function. An iterable weak set of functions would not have this problem, would solve the suggested usecases

Re: memory safety and weak references

2013-04-01 Thread Marius Gundersen
> There are numerous problems with weak references and primitives, mostly revolving around the ability to regenerate a primitive, e.g. > The issue about non-object WeakMap keys was about semantics only, not implementation safety bugs. If I can put "42" in a WeakMap, it can never be removed, since I

Re: memory safety and weak references

2013-04-01 Thread Brendan Eich
Marius Gundersen wrote: This seems to be more a problem with the garbage collector than with weak references. If I understood it correctly, any double value can look like a pointer, No, that's not the issue in this (sub-)thread. Oliver was just recollecting thoughts about a position he took i

Re: memory safety and weak references

2013-04-01 Thread Oliver Hunt
There are numerous problems with weak references and primitives, mostly revolving around the ability to regenerate a primitive, e.g. someWeakRef.set("foo") gc() var something = "foo" someWeakRef.get() // null or "foo"? vs. someWeakRef.set("foo") var something = "foo"

Re: memory safety and weak references

2013-04-01 Thread Marius Gundersen
This seems to be more a problem with the garbage collector than with weak references. If I understood it correctly, any double value can look like a pointer, and the garbage collector will check what it is pointing at. To me this seems like a source for memory leaks. This problem exists even withou

Re: memory safety and weak references

2013-03-28 Thread Oliver Hunt
On Mar 29, 2013, at 7:36 AM, David Herman wrote: > On Mar 27, 2013, at 4:52 AM, Sam Tobin-Hochstadt wrote: > >> On Tue, Mar 26, 2013 at 11:44 PM, Oliver Hunt wrote: >>> That said I believe that this does kill any dreams i may have had w.r.t >>> primitive-keyed WeakMaps, kudos to MarkM. >> >

Re: memory safety and weak references

2013-03-28 Thread David Herman
On Mar 27, 2013, at 4:52 AM, Sam Tobin-Hochstadt wrote: > On Tue, Mar 26, 2013 at 11:44 PM, Oliver Hunt wrote: >> That said I believe that this does kill any dreams i may have had w.r.t >> primitive-keyed WeakMaps, kudos to MarkM. > > Wouldn't a primitive-keyed WeakMap just be a strong Map for

Re: memory safety and weak references

2013-03-28 Thread David Bruant
[answering to different messages at once] [cc'ing Oliver Hunt as Apple representative and Luke Hoban as Microsoft representative for questions at the bottom] Le 27/03/2013 23:47, Brendan Eich a écrit : You have it backwards. You are advocating a GC design monoculture (exact rooting only) My po

Re: memory safety and weak references

2013-03-27 Thread Jason Orendorff
On Wed, Mar 27, 2013 at 4:53 PM, David Bruant wrote: > Over the last month after Opera announced moving to WebKit, people on > Twitter have been rounds and rounds about Webkits monoculture and how making > spec decisions based on specific implementations is a bad thing ("if specs > followed WebKit

Re: memory safety and weak references

2013-03-27 Thread Brendan Eich
You have it backwards. You are advocating a GC design monoculture (exact rooting only) as an assumption informing a security analysis that must take into account both language features (enumerable weakmaps; weak references) *and* implementation vulnerabilities across a large space of different

Re: memory safety and weak references

2013-03-27 Thread David Bruant
Le 27/03/2013 01:55, David Herman a écrit : But we need to take this into account as we consider what to do about weak references in ES7. From what I understand, doing exact rooting (instead of conservative stack scanning) solves the problem or more precisely prevents the attack by design (bec

Re: memory safety and weak references

2013-03-27 Thread Sam Tobin-Hochstadt
On Tue, Mar 26, 2013 at 11:44 PM, Oliver Hunt wrote: > That said I believe that this does kill any dreams i may have had w.r.t > primitive-keyed WeakMaps, kudos to MarkM. Wouldn't a primitive-keyed WeakMap just be a strong Map for those keys? And therefore immune to any GC attacks? Sam ___

Re: memory safety and weak references

2013-03-26 Thread Oliver Hunt
On Mar 27, 2013, at 1:56 PM, David Herman wrote: > Interestingly, I wonder if the idea of only collecting weak references > between turns is immune to such attacks, since it's not possible to have a > bogus reference on the stack between turns, where there is no stack. If you could induce an

Re: memory safety and weak references

2013-03-26 Thread Brendan Eich
Brendan Eich wrote: Dion did the JITSpray paper at BlackHat 2010: This paper is very hard to find now! I downloaded a copy, but I'm not sure about protocol. Breadcrumbs that time out for me are at http://www.woodmann.com/forum/archive/index.php/t-13412.html /be _

Re: memory safety and weak references

2013-03-26 Thread Brendan Eich
David Herman wrote: Patrick Walton send me this link to a fascinating approach to exploiting weak references in engines using conservative stack scanning to discover the address of objects: https://github.com/justdionysus/gcwoah I don't fully grok all the details, but IIUC the attacker s

Re: memory safety and weak references

2013-03-26 Thread David Herman
Interestingly, I wonder if the idea of only collecting weak references between turns is immune to such attacks, since it's not possible to have a bogus reference on the stack between turns, where there is no stack. Dave On Mar 26, 2013, at 5:55 PM, David Herman wrote: > Patrick Walton send me

memory safety and weak references

2013-03-26 Thread David Herman
Patrick Walton send me this link to a fascinating approach to exploiting weak references in engines using conservative stack scanning to discover the address of objects: https://github.com/justdionysus/gcwoah I don't fully grok all the details, but IIUC the attacker sprays the heap with ob