hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/objtool/Documentation/stack-validation.txt
....@@ -21,7 +21,7 @@
2121 which gcc sometimes uses jump tables.
2222
2323 (Objtool also has an 'orc generate' subcommand which generates debuginfo
24
-for the ORC unwinder. See Documentation/x86/orc-unwinder.txt in the
24
+for the ORC unwinder. See Documentation/x86/orc-unwinder.rst in the
2525 kernel tree for more details.)
2626
2727
....@@ -101,7 +101,7 @@
101101 band. So it doesn't affect runtime performance and it can be
102102 reliable even when interrupts or exceptions are involved.
103103
104
- For more details, see Documentation/x86/orc-unwinder.txt.
104
+ For more details, see Documentation/x86/orc-unwinder.rst.
105105
106106 c) Higher live patching compatibility rate
107107
....@@ -111,7 +111,7 @@
111111 be detectable). Objtool makes that possible.
112112
113113 For more details, see the livepatch documentation in the Linux kernel
114
- source tree at Documentation/livepatch/livepatch.txt.
114
+ source tree at Documentation/livepatch/livepatch.rst.
115115
116116 Rules
117117 -----
....@@ -289,6 +289,49 @@
289289 might be corrupt due to a gcc bug. For more details, see:
290290 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70646
291291
292
+9. file.o: warning: objtool: funcA() call to funcB() with UACCESS enabled
293
+
294
+ This means that an unexpected call to a non-whitelisted function exists
295
+ outside of arch-specific guards.
296
+ X86: SMAP (stac/clac): __uaccess_begin()/__uaccess_end()
297
+ ARM: PAN: uaccess_enable()/uaccess_disable()
298
+
299
+ These functions should be called to denote a minimal critical section around
300
+ access to __user variables. See also: https://lwn.net/Articles/517475/
301
+
302
+ The intention of the warning is to prevent calls to funcB() from eventually
303
+ calling schedule(), potentially leaking the AC flags state, and not
304
+ restoring them correctly.
305
+
306
+ It also helps verify that there are no unexpected calls to funcB() which may
307
+ access user space pages with protections against doing so disabled.
308
+
309
+ To fix, either:
310
+ 1) remove explicit calls to funcB() from funcA().
311
+ 2) add the correct guards before and after calls to low level functions like
312
+ __get_user_size()/__put_user_size().
313
+ 3) add funcB to uaccess_safe_builtin whitelist in tools/objtool/check.c, if
314
+ funcB obviously does not call schedule(), and is marked notrace (since
315
+ function tracing inserts additional calls, which is not obvious from the
316
+ sources).
317
+
318
+10. file.o: warning: func()+0x5c: stack layout conflict in alternatives
319
+
320
+ This means that in the use of the alternative() or ALTERNATIVE()
321
+ macro, the code paths have conflicting modifications to the stack.
322
+ The problem is that there is only one ORC unwind table, which means
323
+ that the ORC unwind entries must be consistent for all possible
324
+ instruction boundaries regardless of which code has been patched.
325
+ This limitation can be overcome by massaging the alternatives with
326
+ NOPs to shift the stack changes around so they no longer conflict.
327
+
328
+11. file.o: warning: unannotated intra-function call
329
+
330
+ This warning means that a direct call is done to a destination which
331
+ is not at the beginning of a function. If this is a legit call, you
332
+ can remove this warning by putting the ANNOTATE_INTRA_FUNCTION_CALL
333
+ directive right before the call.
334
+
292335
293336 If the error doesn't seem to make sense, it could be a bug in objtool.
294337 Feel free to ask the objtool maintainer for help.
....@@ -306,7 +349,7 @@
306349
307350 - To skip validation of a file, add
308351
309
- OBJECT_FILES_NON_STANDARD_filename.o := n
352
+ OBJECT_FILES_NON_STANDARD_filename.o := y
310353
311354 to the Makefile.
312355