Re: [PATCH 1/1] x86/pti: Fix kernel warnings for pti= and nopti cmdline options.
From: Jo Van Bulck
Date: Fri Aug 11 2023 - 19:27:30 EST
On 11.08.23 14:36, Jo Van Bulck wrote:> static enum pti_mode {
PTI_AUTO = 0,
+ PTI_FORCE_AUTO,
PTI_FORCE_OFF,
PTI_FORCE_ON
} pti_mode;
I introduced a new PTI_FORCE_AUTO value here to make pti=auto override
any mitigations=off parameter. However, I realize now that this may
inadvertently affect other functions that test for pti_mode == PTI_AUTO
(eg in pti_kernel_image_global_ok()).
Having 2 constants PTI_AUTO and PTI_FORCE_AUTO is arguably not very
neat, so we should better get rid of this. I see several options:
- not have pti=auto override mitigations=off
- have a global var to indicate pti= argument was passed
- set pti_mode = PTI_AUTO in the pti_mode == PTI_FORCE_AUTO if branch
Not sure which option would best match kernel coding guidelines?
Best,
Jo