Skip to content

Commit 3d1fb29

Browse files
committed
Add more information about the CFI of timer API
Currently, in 13.2 Flashing keyboard LEDs, the description of the control-flow integrity, "Furthermore, the function prototype with unsigned long argument may be an obstacle to the control-flow integrity .", will confuse the reader. It may lead the reader to think about hardware-assisted CFI like Intel CET uses the shadow stack attack for ROP (backward-edge protection). But the description of CFI here talks about the function pointer checking with the prototype (forward-edge protection). So add more information to make it more clear. Close #151
1 parent 08eee1a commit 3d1fb29

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lkmpg.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,10 +1700,11 @@ \subsection{Flashing keyboard LEDs}
17001700
From v4.14 to v4.15, the timer API made a series of changes to improve memory safety.
17011701
A buffer overflow in the area of a \cpp|timer_list| structure may be able to overwrite the \cpp|function| and \cpp|data| fields, providing the attacker with a way to use return-object programming (ROP) to call arbitrary functions within the kernel.
17021702
Also, the function prototype of the callback, containing a \cpp|unsigned long| argument, will prevent work from any type checking.
1703-
Furthermore, the function prototype with \cpp|unsigned long| argument may be an obstacle to the \textit{control-flow integrity}.
1703+
Furthermore, the function prototype with \cpp|unsigned long| argument may be an obstacle to the forward-edge protection of \textit{control-flow integrity}.
17041704
Thus, it is better to use a unique prototype to separate from the cluster that takes an \cpp|unsigned long| argument.
17051705
The timer callback should be passed a pointer to the \cpp|timer_list| structure rather than an \cpp|unsigned long| argument.
17061706
Then, it wraps all the information the callback needs, including the \cpp|timer_list| structure, into a larger structure, and it can use the \cpp|container_of| macro instead of the \cpp|unsigned long| value.
1707+
For more information see: \href{https://lwn.net/Articles/735887/}{Improving the kernel timers API}.
17071708

17081709
Before Linux v4.14, \cpp|setup_timer| was used to initialize the timer and the \cpp|timer_list| structure looked like:
17091710
\begin{code}

0 commit comments

Comments
 (0)