Lines Matching +full:sync +full:- +full:on +full:- +full:green
1 //===-- nsan.cc -----------------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 // - The public nsan interface (include/sanitizer/nsan_interface.h).
13 // - The private nsan interface (./nsan.h).
14 // - The internal instrumentation interface. These are function emitted by the
25 // on the runtime configuration. The middle part indicates the type of
27 // shadow, and depends on the instrumentation configuration.
31 //===----------------------------------------------------------------------===//
57 // FIXME: We could provide fixed-size versions that would nicely
67 // FIXME: We could provide fixed-size versions that would nicely
111 const char *Name() { return Green(); } in Name()
124 snprintf(result.Buffer, sizeof(result.Buffer) - 1, "%.20f", value); in dec()
129 snprintf(result.Buffer, sizeof(result.Buffer) - 1, "%.20a", value); in hex()
139 snprintf(result.Buffer, sizeof(result.Buffer) - 1, "%.20Lf", value); in dec()
144 snprintf(result.Buffer, sizeof(result.Buffer) - 1, "%.20La", value); in hex()
161 template <typename FT> inline FT ftAbs(FT v) { return v >= FT{0} ? v : -v; } in ftAbs()
189 nsan_stats->Print(); in __nsan_print_accumulated_stats()
200 // storing ourselves because it avoids having to rely on the calling convention
254 // Warn only if the value is non-zero. Zero is special because in getShadowPtrForLoad()
259 nsan_stats->AddUnknownLoadTrackingEvent(pc, bp); in getShadowPtrForLoad()
263 nsan_stats->AddInvalidLoadTrackingEvent(pc, bp); in getShadowPtrForLoad()
313 const u8 T = *(shadow_type - pos + i); in checkValueConsistency()
336 int LastPos = -1; in __nsan_dump_shadow_mem()
338 for (size_t R = 0; R < (size_bytes + bytes_per_line - 1) / bytes_per_line; in __nsan_dump_shadow_mem()
348 LastPos = pos == 0 ? 0 : -1; in __nsan_dump_shadow_mem()
357 if (LastPos == sizeof(float) - 1) { in __nsan_dump_shadow_mem()
359 ReadShadow(shadow + kShadowScale * (Offset + 1 - sizeof(float)), in __nsan_dump_shadow_mem()
366 if (LastPos == sizeof(double) - 1) { in __nsan_dump_shadow_mem()
368 shadow + kShadowScale * (Offset + 1 - sizeof(double)), in __nsan_dump_shadow_mem()
375 if (LastPos == sizeof(long double) - 1) { in __nsan_dump_shadow_mem()
377 shadow + kShadowScale * (Offset + 1 - sizeof(long double)), in __nsan_dump_shadow_mem()
411 enum ContinuationType { // Keep in sync with instrumentation pass.
430 // https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ in checkFT()
433 const InternalFT abs_err = ftAbs(check_value - check_shadow); in checkFT()
437 // We are re-computing `largest` here because this is a cold branch, and we in checkFT()
441 nsan_stats->AddCheck(CheckType, pc, bp, abs_err / largest); in checkFT()
445 // (value and shadow are inf or -inf), we pass the test. in checkFT()
468 snprintf(RelErrBuf, sizeof(RelErrBuf) - 1, "%.20Lf%% (2^%.0Lf epsilons)", in checkFT()
478 shadow_ulp_diff / (u64{1} << (FTInfo<InternalFT>::kMantissaBits - in checkFT()
480 snprintf(ulp_err_buf, sizeof(ulp_err_buf) - 1, in checkFT()
510 Printf(" in user-initiated check"); in checkFT()
518 "%-12s precision (native): dec: %s hex: %s\n" in checkFT()
519 "%-12s precision (shadow): dec: %s hex: %s\n" in checkFT()
520 "shadow truncated to %-12s: dec: %s hex: %s\n" in checkFT()
535 nsan_stats->AddWarning(CheckType, pc, bp, abs_err / largest); in checkFT()
539 if (common_flags()->abort_on_error) in checkFT()
631 nsan_stats->AddWarning(CheckTypeT::kFcmp, pc, bp, 0.0); in fCmpFailFT()
644 Printf("WARNING: NumericalStabilitySanitizer: floating-point comparison " in fCmpFailFT()
645 "results depend on precision\n"); in fCmpFailFT()
647 Printf("%-12s precision dec (native): %s %s %s (%s)\n" in fCmpFailFT()
648 "%-12s precision dec (shadow): %s %s %s (%s)\n" in fCmpFailFT()
649 "%-12s precision hex (native): %s %s %s (%s)\n" in fCmpFailFT()
650 "%-12s precision hex (shadow): %s %s %s (%s)\n" in fCmpFailFT()
708 // the instrumentation will have placed the shadow value on the shadow stack. in checkFTFromShadowStack()
719 "__nsan_check_float called from non-instrumented function"); in __nsan_check_float()
726 "__nsan_check_double called from non-instrumented function"); in __nsan_check_double()
733 "__nsan_check_longdouble called from non-instrumented function"); in __nsan_check_longdouble()
740 // the instrumentation will have placed the shadow value on the shadow stack. in dumpFTFromShadowStack()
754 "__nsan_dump_float called from non-instrumented function"); in __nsan_dump_float()
760 "__nsan_dump_double called from non-instrumented function"); in __nsan_dump_double()
767 "__nsan_dump_longdouble called from non-instrumented function"); in __nsan_dump_longdouble()
798 if (!MmapFixedNoReserve(TypesAddr(), UnusedAddr() - TypesAddr())) in __nsan_init()