On Thu, May 15, 2025 at 12:25:07AM +0200, Borislav Petkov wrote:
On Wed, May 14, 2025 at 03:08:35PM -0700, Suraj Jitindar Singh wrote:
- if (x86_return_thunk != __x86_return_thunk)
- /*
* There can only be one return thunk enabled at a time, so issue a
* warning when overwriting it. retbleed_return_thunk is a special case
* which is safe to be overwritten with srso_return_thunk since it
* provides a superset of the functionality and is handled correctly in
* entry_untrain_ret().
*/
- if ((x86_return_thunk != __x86_return_thunk) &&
(thunk != srso_return_thunk ||
x86_return_thunk != retbleed_return_thunk))
Instead of making this an unreadable conditional, why don't we ...
pr_warn("x86/bugs: return thunk changed\n");
... turn this into a
pr_info("set return thunk to: %ps\n", ...)
and simply say which thunk was set?
This was discussed during the mitigation, and pr_warn() was chosen because it was not obvious that srso mitigation also mitigates retbleed. (On a retrospect, there should have been a comment about it).
The conclusion was to make the srso and retbleed relationship clear and then take care of the pr_warn().