llvm/compiler-rt/lib/dfsan/dfsan_origin.h

//===-- dfsan_origin.h ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of DataFlowSanitizer.
//
// Origin id utils.
//===----------------------------------------------------------------------===//

#ifndef DFSAN_ORIGIN_H
#define DFSAN_ORIGIN_H

#include "dfsan_chained_origin_depot.h"
#include "dfsan_flags.h"
#include "sanitizer_common/sanitizer_stackdepot.h"

namespace __dfsan {

// Origin handling.
//
// Origin is a 32-bit identifier that is attached to any taint value in the
// program and describes how this memory came to be tainted.
//
// Chained origin id is like:
// zzzz xxxx xxxx xxxx
//
// Chained origin id describes an event of storing a taint value to
// memory. The xxx part is a value of ChainedOriginDepot, which is a mapping of
// (stack_id, prev_id) -> id, where
//  * stack_id describes the event.
//    StackDepot keeps a mapping between those and corresponding stack traces.
//  * prev_id is another origin id that describes the earlier part of the
//    taint value history. 0 prev_id indicates the start of a chain.
// Following a chain of prev_id provides the full recorded history of a taint
// value.
//
// This, effectively, defines a forest where nodes are points in value history
// marked with origin ids, and edges are events that are marked with stack_id.
//
// The "zzzz" bits of chained origin id are used to store the length of the
// origin chain.

class Origin {};

}  // namespace __dfsan

#endif  // DFSAN_ORIGIN_H