Path: blob/main/contrib/llvm-project/compiler-rt/lib/scudo/standalone/report_linux.cpp
35292 views
//===-- report_linux.cpp ----------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "platform.h"910#if SCUDO_LINUX || SCUDO_TRUSTY1112#include "common.h"13#include "internal_defs.h"14#include "report.h"15#include "report_linux.h"16#include "string_utils.h"1718#include <errno.h>19#include <stdlib.h>20#include <string.h>2122namespace scudo {2324// Fatal internal map() error (potentially OOM related).25void NORETURN reportMapError(uptr SizeIfOOM) {26ScopedString Error;27Error.append("Scudo ERROR: internal map failure (error desc=%s)",28strerror(errno));29if (SizeIfOOM)30Error.append(" requesting %zuKB", SizeIfOOM >> 10);31Error.append("\n");32reportRawError(Error.data());33}3435void NORETURN reportUnmapError(uptr Addr, uptr Size) {36ScopedString Error;37Error.append("Scudo ERROR: internal unmap failure (error desc=%s) Addr 0x%zx "38"Size %zu\n",39strerror(errno), Addr, Size);40reportRawError(Error.data());41}4243void NORETURN reportProtectError(uptr Addr, uptr Size, int Prot) {44ScopedString Error;45Error.append(46"Scudo ERROR: internal protect failure (error desc=%s) Addr 0x%zx "47"Size %zu Prot %x\n",48strerror(errno), Addr, Size, Prot);49reportRawError(Error.data());50}5152} // namespace scudo5354#endif // SCUDO_LINUX || SCUDO_TRUSTY555657