[PATCH v2] ima: fix races when deleting measurement list entries
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Mon Nov 9 12:47:58 UTC 2026
> ima_queue_delete_partial() looks up the queue entry at which the
> measurement list has to be cut without holding ima_extend_list_mutex,
> and only takes the mutex afterwards for __list_cut_position(). The
> comment above the cut justifies this with "ima_fs.c enforces
> single-writer exclusion".
>
> That exclusion only covers cross-process opens. ima_measure_lock()
> registers measure_writer at open() time and even lets the same task
> open the file again by incrementing measure_writer_extra_writes, while
> _ima_measurements_write() never checks the caller's identity. A
> privileged task can therefore open several descriptors for the
> measurement list and use them concurrently from its own threads. Each
> open() creates a separate struct file, so the f_pos_lock taken by
> fdget_pos() serializes neither these writers nor their readers.
>
> [ ... ]
>
> Suggested-by: Roberto Sassu <roberto.sassu at huawei.com>
> Fixes: fcb0318a2969 ("ima: Support staging and deleting N measurements records")
> Cc: stable at vger.kernel.org # v7.2+
> Signed-off-by: Weibin Liu <liuwb at xiaopeng.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109123335.432186-1-liuwb@xiaopeng.com?part=1
More information about the Linux-security-module-archive
mailing list