[PATCH v11 1/9] ima: rename variable the set_file "file" to "ima_kexec_file"

Mimi Zohar zohar at linux.ibm.com
Mon Apr 7 21:37:29 PDT 2025


Please fix the Subject line: change set_file -> seq_file

On Wed, 2025-04-02 at 05:47 -0700, steven chen wrote:
> The current kernel behavior is IMA measurements snapshot is taken at
> kexec 'load' and not at kexec 'execute'. IMA log is then carried
> over to the new kernel after kexec 'execute'. However, the time gap
> between kexec load and kexec reboot can be very long. During this
> time window, new events extended into TPM PCRs miss the chance
> to be carried over to the second kernel.
>  
> To address the above, the following approach is proposed:
>   - Allocate the necessary buffer during the kexec load phase.
>   - Populate this buffer with the IMA measurements during
>     the kexec execute phase.
> 
> In the current implementation, a local variable "file" of type seq_file
> is used in the API ima_dump_measurement_list() to store the IMA measurements
> to be carried over across kexec system call. To make this buffer accessible
> at kexec 'execute' time, rename it to "ima_kexec_file" before making it
> a file variable to better reflect its purpose.

Only the reason for the variable name change is needed.  Please remove
everything else.

> 
> Renaming the local variable "file" of type seq_file defined in the 
> ima_dump_measurement_list function to "ima_kexec_file" will improve code
> readability and maintainability by making the variable's role more explicit.

As previously mentioned, there is a difference when naming local and file static
global variables. Variable naming is described
https://www.kernel.org/doc/html/v4.10/process/coding-style.html#naming

-> Before making the local ima_dump_measurement_list() seq_file "file" variable
file static global, rename it to ima_kexec_file.

thanks,

Mimi




More information about the kexec mailing list