On Monday 2016-05-02 20:31 +0300, Aryeh Gregor wrote:
> On Mon, May 2, 2016 at 8:07 PM, Bobby Holley <bobbyhol...@gmail.com> wrote:
> > In general, dynamic stack checks (measuring the top of the stack at XPCOM
> > startup, and comparing it with the stack at the point of interest) seem
> > preferable to hard-coding number-of-recursive-calls, since it doesn't
> > depend on the size of stack frames, which may drift over time. We can't do
> > this for JS (see the comments surrounding the MXR link above), but I bet we
> > could for layout.
> 
> I think we should aim to not make page rendering depend on things like
> the size of stack frames or the OS-provided stack size.  :)  We should
> pick a value that all UAs can commit to comfortably supporting and
> standardize it (as well as standardizing the behavior for how to
> process the non-conformant page).  Then if authors write weird pages,
> they'll break identically in all browsers.

In many cases I think you're right about this.

But I also think that the Web is adding a bunch of features (e.g.,
Shadow DOM) that make these tests harder to do.  For example, a
Shadow DOM created by a web component can make the effective DOM
observed by layout much deeper than the actual DOM.  So, at the very
least, limiting in the parser isn't effective anymore and we need
checks at later stages, which hopefully could be done in a
standardizable way.

So I think ideally we should try to do as much of this as possible
in a standardizable way -- but we'll still probably want a backstop
dynamic stack depth check.  (Can stack overflow crashes be
security-sensitive, or do modern OSes reliably guarantee that
there's a chunk of unmapped memory past the end of the stack?  Then
again, I feel like I've seen description of exploits that relied on
that chunk of unmapped memory not being very large, and just jumping
across it with a function that had a large stack buffer.)

(Whether trying to clean this up should be a current priority is
another question...)

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Attachment: signature.asc
Description: PGP signature

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to