/** * kmsan_report() - Report a use of uninitialized value. * @origin: Stack ID of the uninitialized value. * @address: Address at which the memory access happens. * @size: Memory access size. * @off_first: Offset (from @address) of the first byte to be reported. * @off_last: Offset (from @address) of the last byte to be reported. * @user_addr: When non-NULL, denotes the userspace address to which the kernel * is leaking data. * @reason: Error type from enum kmsan_bug_reason. * * kmsan_report() prints an error message for a consequent group of bytes * sharing the same origin. If an uninitialized value is used in a comparison, * this function is called once without specifying the addresses. When checking * a memory range, KMSAN may call kmsan_report() multiple times with the same * @address, @size, @user_addr and @reason, but different @off_first and * @off_last corresponding to different @origin values.
*/ void kmsan_report(depot_stack_handle_t origin, void *address, int size, int off_first, int off_last, constvoid __user *user_addr, enum kmsan_bug_reason reason);
/* * When a compiler hook or KMSAN runtime function is invoked, it may make a * call to instrumented code and eventually call itself recursively. To avoid * that, we guard the runtime entry regions with * kmsan_enter_runtime()/kmsan_leave_runtime() and exit the hook if * kmsan_in_runtime() is true. * * Non-runtime code may occasionally get executed in nested IRQs from the * runtime code (e.g. when called via smp_call_function_single()). Because some * KMSAN routines may take locks (e.g. for memory allocation), we conservatively * bail out instead of calling them. To minimize the effect of this (potentially * missing initialization events) kmsan_in_runtime() is not checked in * non-blocking runtime functions.
*/ static __always_inline bool kmsan_in_runtime(void)
{ if ((hardirq_count() >> HARDIRQ_SHIFT) > 1) returntrue; if (in_nmi()) returntrue; return kmsan_get_context()->kmsan_in_runtime;
}
/* * Pack and unpack the origin chain depth and UAF flag to/from the extra bits * provided by the stack depot. * The UAF flag is stored in the lowest bit, followed by the depth in the upper * bits. * set_dsh_extra_bits() is responsible for clamping the value.
*/ static __always_inline unsignedint kmsan_extra_bits(unsignedint depth, bool uaf)
{ return (depth << 1) | uaf;
}
/* * kmsan_internal_is_module_addr() and kmsan_internal_is_vmalloc_addr() are * non-instrumented versions of is_module_address() and is_vmalloc_addr() that * are safe to call from KMSAN runtime without recursion.
*/ staticinlinebool kmsan_internal_is_module_addr(void *vaddr)
{ return ((u64)vaddr >= MODULES_VADDR) && ((u64)vaddr < MODULES_END);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.