Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6)

Issue 6195062: Add the web safe shader analyzer under the SH_WEB_SAFE compile flag. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 1 month ago by mvujovic
Modified:
13 years, 1 month ago
CC:
angleproject-review_googlegroups.com, bjacob_mozilla.com, gmangoog, kbr, achicu_adobe.com, vhardy_adobe.com
Base URL:
http://git.chromium.org/external/angleproject.git@master
Visibility:
Public.

Description

Add the web safe shader analyzer under the SH_WEB_SAFE compile flag. Related files are under the new directory src/compiler/websafe. Description of the algorithm: http://code.google.com/p/mvujovic/wiki/ShaderControlFlowAnalysis Background: The web safe shader analyzer is one potential solution to timing attacks on textures containing cross-domain content or user agent data. This kind of analysis could be useful for both WebGL and CSS Shaders. The web safe shader analyzer will reject a shader if it uses texture dependent data to affect control flow. Other ways of affecting shader timing such as using NaNs in basic arithmetic operations or using built-in functions (e.g. atan) with different inputs are still under investigation. Checks for these cases are not yet implemented, but this code could be easily extended to cover those cases once we have more information. BUG=http://code.google.com/p/angleproject/issues/detail?id=329 TEST=Run the translator with "-w" on a shader to use the SH_WEB_SAFE flag. Additionally, use the "-d" flag to print out the dependency graph used to validate web safe fragment shaders.

Patch Set 1 #

Patch Set 2 : Nit: Reorder includes to be in alphabetical order. #

Patch Set 3 : Nit: Wrapped long lines. #

Total comments: 2

Patch Set 4 : SH_WEB_SAFE must now be used with SH_WEBGL_SPEC. Add documentation for SH_WEB_SAFE and SH_DEPENDENC… #

Total comments: 8

Patch Set 5 : SH_TIMING_RESTRICTIONS name change and other changes from Daniel's review. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1281 lines, -5 lines) Patch
M CONTRIBUTORS View 1 chunk +4 lines, -0 lines 0 comments Download
M include/GLSLANG/ShaderLang.h View 1 2 3 4 2 chunks +18 lines, -2 lines 0 comments Download
M samples/translator/translator.cpp View 1 2 3 4 4 chunks +18 lines, -2 lines 0 comments Download
M src/build_angle.gyp View 1 2 3 4 1 chunk +13 lines, -0 lines 0 comments Download
M src/compiler/Compiler.cpp View 1 2 3 4 3 chunks +55 lines, -0 lines 1 comment Download
M src/compiler/ShHandle.h View 1 2 3 4 2 chunks +12 lines, -0 lines 0 comments Download
A src/compiler/depgraph/DependencyGraph.h View 1 2 3 4 1 chunk +207 lines, -0 lines 0 comments Download
A src/compiler/depgraph/DependencyGraph.cpp View 1 2 3 4 1 chunk +109 lines, -0 lines 0 comments Download
A src/compiler/depgraph/DependencyGraphBuilder.h View 1 2 3 4 1 chunk +186 lines, -0 lines 0 comments Download
A src/compiler/depgraph/DependencyGraphBuilder.cpp View 1 2 3 4 1 chunk +241 lines, -0 lines 0 comments Download
A src/compiler/depgraph/DependencyGraphOutput.h View 1 2 3 4 1 chunk +30 lines, -0 lines 0 comments Download
A src/compiler/depgraph/DependencyGraphOutput.cpp View 1 2 3 4 1 chunk +65 lines, -0 lines 0 comments Download
A src/compiler/depgraph/DependencyGraphTraverse.cpp View 1 2 3 4 1 chunk +69 lines, -0 lines 0 comments Download
M src/compiler/intermediate.h View 1 chunk +1 line, -1 line 0 comments Download
A src/compiler/timing/RestrictFragmentShaderTiming.h View 1 2 3 4 1 chunk +41 lines, -0 lines 0 comments Download
A src/compiler/timing/RestrictFragmentShaderTiming.cpp View 1 2 3 4 1 chunk +81 lines, -0 lines 1 comment Download
A src/compiler/timing/RestrictVertexShaderTiming.h View 1 2 3 4 1 chunk +41 lines, -0 lines 0 comments Download
A src/compiler/timing/RestrictVertexShaderTiming.cpp View 1 2 3 4 1 chunk +30 lines, -0 lines 0 comments Download
M src/compiler/translator_common.vcproj View 1 2 3 4 2 chunks +60 lines, -0 lines 0 comments Download

Messages

Total messages: 24
kbr1
Added nicolas and alokp to CC list.
13 years, 1 month ago (2012-05-08 22:33:07 UTC) #1
Alok Priyadarshi
I have not looked at this in detail. I have a higher level question and ...
13 years, 1 month ago (2012-05-09 21:01:21 UTC) #2
mvujovic
On 2012/05/09 21:01:21, Alok Priyadarshi wrote: > I have not looked at this in detail. ...
13 years, 1 month ago (2012-05-09 21:48:16 UTC) #3
kbr1
On 2012/05/09 21:48:16, mvujovic wrote: > On 2012/05/09 21:01:21, Alok Priyadarshi wrote: > > I ...
13 years, 1 month ago (2012-05-10 00:12:20 UTC) #4
mvujovic
On 2012/05/10 00:12:20, kbr1 wrote: > On 2012/05/09 21:48:16, mvujovic wrote: > > On 2012/05/09 ...
13 years, 1 month ago (2012-05-10 16:58:57 UTC) #5
gmanchromium
http://codereview.appspot.com/6195062/diff/9001/include/GLSLANG/ShaderLang.h File include/GLSLANG/ShaderLang.h (right): http://codereview.appspot.com/6195062/diff/9001/include/GLSLANG/ShaderLang.h#newcode108 include/GLSLANG/ShaderLang.h:108: SH_WEB_SAFE = 0x0200, Just my bikeshedding but is WEB_SAFE ...
13 years, 1 month ago (2012-05-10 19:44:20 UTC) #6
mvujovic
On 2012/05/10 19:44:20, gmanchromium wrote: > http://codereview.appspot.com/6195062/diff/9001/include/GLSLANG/ShaderLang.h > File include/GLSLANG/ShaderLang.h (right): > > http://codereview.appspot.com/6195062/diff/9001/include/GLSLANG/ShaderLang.h#newcode108 > ...
13 years, 1 month ago (2012-05-10 21:07:58 UTC) #7
nicolas
This is a really interesting concept. I went through the patches and I have no ...
13 years, 1 month ago (2012-05-18 14:18:15 UTC) #8
mvujovic
On 2012/05/18 14:18:15, nicolas wrote: > This is a really interesting concept. I went through ...
13 years, 1 month ago (2012-05-20 19:41:39 UTC) #9
mvujovic
> On 2012/05/10 19:44:20, gmanchromium wrote: > Just my bikeshedding but is WEB_SAFE the right ...
13 years, 1 month ago (2012-05-22 15:15:09 UTC) #10
bjacob_mozilla.com
----- Original Message ----- > > On 2012/05/10 19:44:20, gmanchromium wrote: > > Just my ...
13 years, 1 month ago (2012-05-22 15:29:23 UTC) #11
mvujovic
On 2012/05/22 15:29:23, bjacob_mozilla.com wrote: > > ----- Original Message ----- > > > On ...
13 years, 1 month ago (2012-05-22 16:25:30 UTC) #12
bjacob_mozilla.com
----- Original Message ----- > On 2012/05/22 15:29:23, bjacob_mozilla.com wrote: > > > ----- Original ...
13 years, 1 month ago (2012-05-22 16:57:05 UTC) #13
dgkoch
I definitely like the name SH_TIMING_RESTRICTIONS better than SH_WEBGL_SAFE. Seems like you should also rename ...
13 years, 1 month ago (2012-05-22 17:57:49 UTC) #14
kbr1
http://codereview.appspot.com/6195062/diff/14001/AUTHORS File AUTHORS (right): http://codereview.appspot.com/6195062/diff/14001/AUTHORS#newcode16 AUTHORS:16: Adobe Systems Inc. On 2012/05/22 17:57:49, dgkoch wrote: > ...
13 years, 1 month ago (2012-05-22 22:47:15 UTC) #15
mvujovic
Thanks for the review, Daniel! I've updated the patch with the changes and responded inline ...
13 years, 1 month ago (2012-05-23 00:02:18 UTC) #16
mvujovic
Thank you for the reviews, everyone. Do you guys think this is ready to land? ...
13 years, 1 month ago (2012-05-29 20:46:40 UTC) #17
kbr1
From my standpoint this looks great -- yes, I'd say land it now. LGTM. Perhaps ...
13 years, 1 month ago (2012-05-29 23:04:05 UTC) #18
mvujovic
On 2012/05/29 23:04:05, kbr1 wrote: > From my standpoint this looks great -- yes, I'd ...
13 years, 1 month ago (2012-05-29 23:32:34 UTC) #19
kbr1
On 2012/05/29 23:32:34, mvujovic wrote: > Sure. I can fix this in a follow up ...
13 years, 1 month ago (2012-05-29 23:35:43 UTC) #20
dgkoch
LGTM as well. I've added you to ANGLE as a committer now. https://codereview.appspot.com/6195062/diff/16002/src/compiler/timing/RestrictFragmentShaderTiming.cpp File src/compiler/timing/RestrictFragmentShaderTiming.cpp ...
13 years, 1 month ago (2012-05-30 00:15:17 UTC) #21
mvujovic
On 2012/05/30 00:15:17, dgkoch wrote: > LGTM as well. I've added you to ANGLE as ...
13 years, 1 month ago (2012-05-30 16:55:35 UTC) #22
dgkoch
On 2012/05/30 16:55:35, mvujovic wrote: > On 2012/05/30 00:15:17, dgkoch wrote: > > LGTM as ...
13 years, 1 month ago (2012-05-30 20:22:44 UTC) #23
mvujovic
13 years, 1 month ago (2012-05-30 22:45:47 UTC) #24
Committed this patch in r1101.

I wanted to thank you guys for maintaining such a well-architected and readable
codebase. It's been really great working with it so far :)

On 2012/05/30 20:22:44, dgkoch wrote:
> On 2012/05/30 16:55:35, mvujovic wrote:
> > On 2012/05/30 00:15:17, dgkoch wrote:
> > > LGTM as well.  I've added you to ANGLE as a committer now.
> > 
> > Great! Thanks, Daniel. I'll commit it today
> > >
> >
>
https://codereview.appspot.com/6195062/diff/16002/src/compiler/timing/Restric...
> > > File src/compiler/timing/RestrictFragmentShaderTiming.cpp (right):
> > > 
> > >
> >
>
https://codereview.appspot.com/6195062/diff/16002/src/compiler/timing/Restric...
> > > src/compiler/timing/RestrictFragmentShaderTiming.cpp:52: if
> > > (parameter->getIntermFunctionCall()->getName() != "texture2D(s21;vf2;" ||
> > > Is this intentional or is this debugging code?
> > 
> > This code is intentional. It demonstrates another type of restriction
besides
> > control flow. It enforces that an author does not use a texture derived
value
> as
> > the texture coordinate of a texture2D sampling operation. 
> > 
> > We were thinking that someone could mount a timing attack using texture
cache
> > hits or misses (though it hasn't been proven yet). 
> > 
> > In the context of CSS Shaders, we only had to worry about texture2D because
> the
> > DOM element texture was a sampler2D. For WebGL, I think we have to worry
about
> > all of the sampling operations like textureCube, etc. 
> > 
> > I can add a FIXME here and create an issue for this concern in case we
decide
> to
> > enforce this kind of restriction. Does that sound okay?
> Sure that's fine.

I've added issue 335 to cover this.
http://code.google.com/p/angleproject/issues/detail?id=335
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b