Re: [PATCH v2 06/13] ima: handle errors from resolving the real inode
From: Mimi Zohar
Date: Tue Nov 24 2026 - 13:58:14 EST
On Mon, 2026-11-16 at 10:44 +0100, Christian Brauner wrote:
> d_real() is about to be able to fail for D_REAL_DATA. So switch IMA
> from d_real_inode() to d_real_data_inode() and deal with the error.
>
> Currently, if overlayfs fails to resolve the data of a file it hands
> back the overlayfs inode. process_measurement() then sees
> real_inode == inode, skips the detection of changes in the backing file
> and returns the cached verdict. That's the wrong default. With
> metacopy and verity this isn't limited to files nobody opened yet
> either. A metadata-only copy-up of an open file makes overlayfs validate
> the verity digest of the data again on the next D_REAL_DATA lookup and
> that can fail.
>
> So if the inode hosting the data can't be resolved in
> process_measurement() we can't tell whether the data changed. Treat it
> like a change and clear IMA_DONE_MASK and measured_pcrs so the file is
> evaluated again. The metadata check for EVM stays independent of that.
>
> This is a no-op until d_real() can actually fail.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
The patch, itself, looks fine, but I'm not able to reproduce the error.
The existing IMA overlay tests are working with and without this patch set. The
tests check:
* test 1: checks file signature is copied
* test 2: checks backing file signature is copied up to overlay
* test 3: detects modified backing file
Reviewed-by: Mimi Zohar <zohar@xxxxxxxxxxxxx>
Mimi