Skip to content

Commit 68af44a

Browse files
leitaomimizohar
authored andcommitted
ima: kexec: silence RCU list traversal warning
The ima_measurements list is append-only and doesn't require rcu_read_lock() protection. However, lockdep issues a warning when traversing RCU lists without the read lock: security/integrity/ima/ima_kexec.c:40 RCU-list traversed in non-reader section!! Fix this by using the variant of list_for_each_entry_rcu() with the last argument set to true. This tells the RCU subsystem that traversing this append-only list without the read lock is intentional and safe. This change silences the lockdep warning while maintaining the correct semantics for the append-only list traversal. Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent 254ef95 commit 68af44a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

security/integrity/ima/ima_kexec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ static int ima_dump_measurement_list(unsigned long *buffer_size, void **buffer,
3737

3838
memset(&khdr, 0, sizeof(khdr));
3939
khdr.version = 1;
40-
list_for_each_entry_rcu(qe, &ima_measurements, later) {
40+
/* This is an append-only list, no need to hold the RCU read lock */
41+
list_for_each_entry_rcu(qe, &ima_measurements, later, true) {
4142
if (file.count < file.size) {
4243
khdr.count++;
4344
ima_measurements_show(&file, qe);

0 commit comments

Comments
 (0)