[PATCH v4] ima: fix races when deleting measurement list records

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Nov 13 15:06:55 UTC 2026


> Without this patch, 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 and is only enforced at
> open() and release() time.  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.
> [ ... ]
> Fixes: e9b491e27bf6 ("ima: Add support for staging measurements with prompt")
> Fixes: fcb0318a2969 ("ima: Support staging and deleting N measurements records")
> Cc: stable at vger.kernel.org # v7.2+
> Reviewed-by: Lin Qiaojie <linqj at xiaopeng.com>
> 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/20261113145610.1826692-1-liuwb@xiaopeng.com?part=1




More information about the Linux-security-module-archive mailing list