Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Issue 1658913005: Add SkMSAN.h (Closed)

Created:
4 years, 10 months ago by mtklein_C
Modified:
4 years, 10 months ago
CC:
reviews_skia.org, kcc2
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Add SkMSAN.h This lets us tag up pieces of code as requiring initialized inputs. Almost all code requires initialized inputs, of course. This is for code that works correctly with uninitialized data but triggers false positive warnings in MSAN. E.g., imagine MSAN's found use of uninitialized data in this max function: static uint8_t max(uint8_t x, uint8_t y) { return x > y ? x : y; } There's no bug in here... if there's uninitialized data being branched upon here for the first time, it's sure not max's fault, it's its caller's fault. So we might do this: static uint8_t max(uint8_t x, uint8_t y) { // This function uses branching, so if MSAN finds a problem here, // we can assert x and y are initialized. This will remind us the // problem somewhere in the caller or above, not here. sk_msan_assert_initialized(&x, &x+1); sk_masn_assert_initialized(&y, &y+1); return x > y ? x : y; } By allowing code to assert its inputs must be initialized, we can make the blame for use of uninitialized data more clear. (Sometimes we have another option, to rewrite the code to avoid branching: static uint8_t max(uint8_t x, uint8_t y) { // This function is branchfree, so MSAN won't complain here. // No real need to assert anything as requiring initialization. int diff = x - y; int negative = diff >> (sizeof(int)*8 - 1); return (y & negative) | (x & ~negative); } These approaches to fixing MSAN false positives are orthogonal.) BUG=chromium:574114 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1658913005 CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Committed: https://skia.googlesource.com/skia/+/1059b1fc9f8711592a81836512850d123d75146d

Patch Set 1 #

Patch Set 2 : year #

Patch Set 3 : spelling #

Unified diffs Side-by-side diffs Delta from patch set Stats (+34 lines, -0 lines) Patch
A src/core/SkMSAN.h View 1 1 chunk +28 lines, -0 lines 0 comments Download
M src/opts/SkBlitRow_opts_SSE2.cpp View 1 2 2 chunks +3 lines, -0 lines 0 comments Download
M src/opts/SkBlitRow_opts_SSE4.cpp View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (16 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1658913005/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1658913005/1
4 years, 10 months ago (2016-02-02 19:12:37 UTC) #8
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1658913005/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1658913005/40001
4 years, 10 months ago (2016-02-02 19:22:50 UTC) #12
mtklein_C
4 years, 10 months ago (2016-02-02 19:29:41 UTC) #15
eugenis
LGTM
4 years, 10 months ago (2016-02-02 19:44:46 UTC) #17
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 10 months ago (2016-02-02 20:47:52 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1658913005/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1658913005/40001
4 years, 10 months ago (2016-02-03 15:24:19 UTC) #21
commit-bot: I haz the power
4 years, 10 months ago (2016-02-03 15:25:05 UTC) #23
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://skia.googlesource.com/skia/+/1059b1fc9f8711592a81836512850d123d75146d

Powered by Google App Engine
This is Rietveld 408576698