[PATCH] Sanitize printf functions

Evgeniy Stepanov eugenis at google.com
Fri Dec 27 04:00:58 PST 2013



================
Comment at: asan/asan_interceptors.cc:678
@@ +677,3 @@
+#if ASAN_INTERCEPT_PRINTF
+// TODO(ygribov): move to sanitizer_common_interceptors.inc
+// to reuse in e.g. other sanitizers?
----------------
Yury Gribov wrote:
> Evgeniy Stepanov wrote:
> > Kostya Serebryany wrote:
> > > Yury Gribov wrote:
> > > > Kostya Serebryany wrote:
> > > > > yes, please
> > > > I tried this initially but realized that Msan already intercepts printf stuff. What's the general policy about what goes into sanitizer_common (e.g. strcmp) and what gets re-implemented in each sanitizer (e.g. memset)?
> > > msan interceptors are rudimentary and will have to be replaced with these *eventually*.
> > > Here is a suggestion: move the code to sanitizer_common_interceptors.inc
> > > but define  SANITIZER_INTERCEPT_PRINTF to 1 only in asan.
> > > tsan and msan will follow later.
> > We can enable it in MSan from the start (killing the old msan interceptors), just make sure that the new interceptors emulate a WRITE to the target buffer (for sprintf and friends).
> Is current emulation fine or do you want to check each specifier separately?
I mean, when this is moved to common interceptors, you'll need to do COMMON_INTERCEPTOR_WRITE_RANGE() for the sprintf target buffer, like the current msan interceptors do.
That is in addition to reads and writes that you do already.


http://llvm-reviews.chandlerc.com/D2480



More information about the llvm-commits mailing list