Thread2Fiber
Converting main thread to fiber for code execution
Last updated
Was this helpful?
Converting main thread to fiber for code execution
Last updated
Was this helpful?
Fibers are a type of execution unit that an application must schedule manually. They are essentially a snapshot of the register and stack states, allowing them to be swapped in and out as needed. A thread can only run one fiber at a time, but fibers can be switched during execution, with the switching fully controlled by the application.
Fibers can also manage their own data. A pointer to this fiber-specific data is stored in TEB->NtTib.FiberData
, which is a structure associated with each thread. This pointer is set when ConvertThreadToFiber
is called.
Since fibers are executed in user mode and the application itself is responsible for handling their execution, EDRs have less kernel mode visibility on whats going on in the process.
ConvertThreadToFiber
:We see a call to this API for conversion:
Following the call to ConvertThread2Fiber
, we see that the rest of program execution flow happens in user mode address space: