[Devel] [PATCH hci-8.1 v8 6/6] ve/overlayfs: Override VE together with creds
Vladimir Riabchun
vladimir.riabchun at virtuozzo.com
Mon Nov 16 23:03:55 MSK 2026
On 11/16/26 20:36, no-reply at sashiko.virtuozzo.com wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] ovl: failed-override state is signalled only by an ERR_PTR
> sentinel
Already replied, ignoring.
> --
>
> commit a0d9d382fd928f27fac00bc80946b595505573d9
> Author: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
>
> ve/overlayfs: Override VE together with creds
>
> This commit changes ovl_override_creds() to switch the VE together with the credentials. It now returns an int and fills a struct ovl_creds_desc, and a new ovl_revert_creds() undoes both. All overlayfs callers are converted.
>
>> diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
>> index 817563215001..6c244ab2cbf1 100644
>> --- a/fs/overlayfs/util.c
>> +++ b/fs/overlayfs/util.c
>
> [ ... ]
>
>> +/* Accepts desc from a failed ovl_override_creds and does nothing. */
>> +void ovl_revert_creds(struct ovl_creds_desc *old_creds)
>> +{
>> + if (IS_ERR(old_creds->ve))
>> + return;
>> +
>> + revert_creds(old_creds->cred);
>> + if (old_creds->ve_overridden)
>> + revert_ve(old_creds->ve);
>> +}
>
> [Severity: Low]
> Is the ERR_PTR check on old_creds->ve a safe way to tell a failed override from a valid one?
>
> Callers such as ovl_llseek(), ovl_fsync(), ovl_getattr() and ovl_copyfile() call ovl_revert_creds() unconditionally after a failed ovl_override_creds(). That is only a no-op because override_ve() leaves an ERR_PTR in desc->ve and ovl_override_creds() returns before override_creds() runs. struct ovl_creds_desc does not document this contract. A descriptor that never went through ovl_override_creds() would reach revert_creds() with a NULL cred. A comment on the struct, or an explicit valid flag, would make this robust.
>
> Also, the commit message says ovl_override_creds "returns both old cred and old VE". It now returns an int and fills in a descriptor, so the message is out of date.
>
--
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo
More information about the Devel
mailing list