summaryrefslogtreecommitdiff
path: root/include/linux/timer.h
diff options
context:
space:
mode:
authorRoberto Sassu <roberto.sassu@huawei.com>2026-06-05 20:22:33 +0300
committerMimi Zohar <zohar@linux.ibm.com>2026-06-08 18:43:21 +0300
commite9b491e27bf6b9401e2e521955787a7a6e2bf808 (patch)
tree78564c1bba06b74db2145425d8e36a946fd7a697 /include/linux/timer.h
parent292bc492f3d31ffd858600a331d599f1956bf612 (diff)
downloadlinux-e9b491e27bf6b9401e2e521955787a7a6e2bf808.tar.xz
ima: Add support for staging measurements with prompt
Introduce the ability of staging the IMA measurement list and deleting them with a prompt. Staging means moving the current measurement list records to a separate location, and allowing users to read and delete it. This causes the current measurement list to be emptied (since records were moved) and new measurements to be added on the empty list. Staging can be done only once at a time. In the event of kexec(), staging is aborted and staged records will be carried over to the new kernel. Introduce ascii_runtime_measurements_<algo>_staged and binary_runtime_measurements_<algo>_staged interfaces to access and delete the measurements. Use 'echo A > <IMA _staged interface>' and 'echo D > <IMA _staged interface>' to respectively stage and delete the entire measurements list. Locking of these interfaces is also mediated with a call to _ima_measurements_open() and with ima_measurements_release(). Implement the staging functionality by introducing the new global measurements list ima_measurements_staged, and ima_queue_stage() and ima_queue_staged_delete_all() to respectively move measurements from the current measurements list to the staged one, and to move staged measurements to the ima_measurements_trim list for deletion. Introduce ima_queue_delete() to delete the measurements. Staging is forbidden after measurement is suspended, and between staging and deleting, so that walking the staged and current measurements list can be done locklessly in ima_dump_measurement_list(). Strict ordering of suspending and dumping is enforced by two reboot notifiers with different priority. Refusing to delete staged measurements also signals to user space that those measurements are already carried over to the secondary kernel, so that it does not save them twice. Finally, introduce the BINARY_STAGED and BINARY_FULL binary measurements list types, to maintain the counters and the binary size of staged measurements and the full measurements list (including records that were staged). BINARY still represents the current binary measurements list. Use the binary size for the BINARY + BINARY_STAGED types in ima_add_kexec_buffer(), since both measurements list types are copied to the secondary kernel during kexec. Use BINARY_FULL in ima_measure_kexec_event(), to generate a critical data record. It should be noted that the BINARY_FULL counter is not passed through kexec. Thus, the number of records included in the kexec critical data records refers to the records since the critical data records generated from the previous kexec event. Note: This code derives from the Alt-IMA Huawei project, whose license is GPL-2.0 OR MIT. Link: https://github.com/linux-integrity/linux/issues/1 Suggested-by: Gregory Lumen <gregorylumen@linux.microsoft.com> (staging revert) Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Tested-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'include/linux/timer.h')
0 files changed, 0 insertions, 0 deletions