skia2/samplecode
Mike Klein 5c612ade3b create a sample to demonstrate a timing attack
This sample attempts to re-create an image's alpha channel by drawing it
one pixel at a time and timing how long each pixel takes to draw.

The "abc" text should appear twice normally, and the third and fourth
versions are reconstructed from timing, one by timing 1:1 pixel draws,
the other by timing 1x1:1024x1024 upscale into an offscreen.  It's not
meant to be an exact reconstruction, but you can easily see the shapes,
particularly at -O0, -O1, and -Os.  Auto-vectorization from -O2/-O3 do
a good amount to cover up the problem.

The legacy CPU backend is the main place to look.  I haven't been able
to reconstruct any images using SkRasterPipelineBlitter or SkVMBlitter,
and while on the GPU I do see non-random patterns in the timing, it
appears to be the same single pattern across devices, OSes, GPUs, GPU
APIs and content... I assume it's something like our resource caching
policy.

This can't really be a GM, given how it draws non-deterministically.

Bug: chromium:1088224
Change-Id: I2ec79c8dd407ecb104fd9bf0c8039cb6dd1fe436
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313466
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-08-28 16:17:39 +00:00
..
DecodeFile.h
PerlinPatch.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
Sample2PtRadial.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
Sample3D.cpp SkRuntimeEffect SkSL has a new signature for main() 2020-08-25 13:36:28 +00:00
Sample.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
Sample.h add std::function option to Click to simplify callsites 2020-04-22 15:41:28 +00:00
SampleAAClip.cpp
SampleAAGeometry.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleAARectModes.cpp
SampleAARects.cpp
SampleAndroidShadows.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
SampleAnimatedImage.cpp Fix implicit fallthroughs throughout Skia. 2020-06-11 22:29:53 +00:00
SampleAnimatedText.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleAnimBlur.cpp
SampleArc.cpp
SampleAtlas.cpp
SampleAudio.cpp Componentize SkAudioPlayer 2020-08-14 13:46:06 +00:00
SampleBackdropBounds.cpp Revert "Revert "move onto new factories for SkMatrix"" 2020-05-21 16:58:39 +00:00
SampleBitmapRect.cpp
SampleCamera.cpp
SampleCCPRGeometry.cpp Write GPU buffers directly from GrStrokeGeometry 2020-07-24 04:38:51 +00:00
SampleChart.cpp Switch over to SkPathBuilder 2020-07-31 02:21:51 +00:00
SampleChineseFling.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleCircle.cpp
SampleClip.cpp SkPathView for ownerless (can live on stack) SkPaths 2020-08-07 20:39:38 +00:00
SampleClipDrawMatch.cpp
SampleClock.cpp Revert "Reland "Revert "Use flat version of path-direction enum""" 2019-11-22 19:09:54 +00:00
SampleColorFilter.cpp
SampleComplexClip.cpp Update complex clip GMs to only use supported clip ops 2020-06-25 14:15:25 +00:00
SampleCowboy.cpp Revert "Revert "move onto new factories for SkMatrix"" 2020-05-21 16:58:39 +00:00
SampleCusp.cpp
SampleDegenerateQuads.cpp Rename domain types and vars to subset. 2020-04-21 21:43:45 +00:00
SampleDegenerateTwoPtRadials.cpp
SampleEffects.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleEmboss.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleFatBits.cpp Revert "Revert "move onto new factories for SkMatrix"" 2020-05-21 16:58:39 +00:00
SampleFillType.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleFilter2.cpp
SampleFilterQuality.cpp Revert "Revert "switch to new filltype for SkPath"" 2019-11-26 17:43:14 +00:00
SampleFitCubicToCircle.cpp Add an interactive sample that fits cubics to circular arcs 2020-06-09 23:04:03 +00:00
SampleFlutterAnimate.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleFontCache.cpp
SampleGlyphTransform.cpp
SampleGradients.cpp
SampleHairCurves.cpp
SampleHairline.cpp
SampleHairModes.cpp
SampleHT.cpp
SampleIdentityScale.cpp SkBlurMaskFilter.h is only needed for (deprecated) emboss 2019-12-30 15:40:46 +00:00
SampleImageFilterDAG.cpp Remove SkMaxScalar and SkMinScalar 2020-02-06 15:43:22 +00:00
SampleLayerMask.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleLayers.cpp hide savelayer's clipmask fields 2020-05-31 14:06:42 +00:00
SampleLCD.cpp
SampleLua.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleManyRects.cpp
SampleMegaStroke.cpp
SampleMixer.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SamplePatch.cpp SkVertices: Remove volatile/nonvolatile bit 2020-03-11 17:33:17 +00:00
SamplePath.cpp show fat stroking on lines or curves 2020-06-26 19:13:00 +00:00
SamplePathClip.cpp add std::function option to Click to simplify callsites 2020-04-22 15:41:28 +00:00
SamplePathEffects.cpp
SamplePathOverstroke.cpp
SamplePathText.cpp Merge PathText samples into one, with different modes 2020-05-29 16:35:25 +00:00
SamplePolyToPoly.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleQuadStroker.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleRectanizer.cpp Reland GrRectanizerPow2 2020-05-19 18:35:13 +00:00
SampleRegion.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleRepeatTile.cpp
SampleSG.cpp [skottie] Cleanup: relocate Animator base class out of SkSG 2020-03-26 20:50:10 +00:00
SampleShaders.cpp
SampleShadowColor.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
SampleShadowReference.cpp
SampleShadowUtils.cpp Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
SampleShip.cpp
SampleSimpleStroker.cpp Show mirror drawn with SkStroke (toy stroker) 2020-07-22 18:49:20 +00:00
SampleSlides.cpp Remove unnecessary SK_SIZE_T_SPECIFIER macro. 2020-05-05 13:25:28 +00:00
SampleStringArt.cpp Remove SkMaxScalar and SkMinScalar 2020-02-06 15:43:22 +00:00
SampleStrokePath.cpp Revert "Revert "switch to new filltype for SkPath"" 2019-11-26 17:43:14 +00:00
SampleStrokeRect.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleSubpixelTranslate.cpp SkBlurMaskFilter.h is only needed for (deprecated) emboss 2019-12-30 15:40:46 +00:00
SampleSVGFile.cpp
SampleTessellatedWedge.cpp Rename GrTessellateStroke* -> GrStrokeTessellate* and friends 2020-07-31 02:24:05 +00:00
SampleTextBox.cpp Regularize SkFontMgr for CoreText build. 2020-06-04 16:45:09 +00:00
SampleTextEffects.cpp Enable ClangTidy flag modernize-use-override. 2020-08-14 10:54:45 +00:00
SampleTextureUpload.cpp Remove SkCanvas::getGrContext calls from samplecode 2020-07-09 18:37:02 +00:00
SampleThinAA.cpp Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
SampleTiming.cpp create a sample to demonstrate a timing attack 2020-08-28 16:17:39 +00:00
SampleUnpremul.cpp
SampleVertices.cpp
SampleWritePixels.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SampleXfer.cpp demo CubicResampler 2020-07-24 20:13:34 +00:00
SampleXfermodesBlur.cpp Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
vertexdump.cpp