[Devel] [PATCH vz10 07/24] blk-cbt: don't WARN on a user-supplied ABI version mismatch

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Jul 23 16:47:48 MSK 2026



On 7/6/26 14:11, Andrey Zhadchenko wrote:
> I don't like that. Customers do not run with panic_on_warn. If this fails in our test environment, that's actually great (it means something went very wrong). pr_warn_ratelimited is worse than WARN_ONCE regarding intentional spamming.

I think the idea here is that EOPNOTSUPP is already enough information for
the ioctl caller to detect the problem and report it to us ("-EOPNOTSUPP
return is the actual contract").

> 
> On 7/6/26 12:59, Konstantin Khorenko wrote:
>> blk_cbt_ioctl() reads abi_version straight from the ioctl argument and
>> WARN_ONCE()s if it does not match CBT_ABI_VERSION. The value is fully
>> userspace-controlled, so any process issuing a BLKCBT* ioctl with a
>> stale/newer struct taints the kernel, dumps a backtrace, and can panic a
>> host that runs with panic_on_warn. Downgrade to pr_warn_ratelimited();
>> the -EOPNOTSUPP return is the actual contract.
>>
>> Fixes: 6e42f62a2c88 ("block/blk-cbt: introduce ABI versioning")
>> Feature: cbt: changed block tracking (for backup)
>> https://virtuozzo.atlassian.net/browse/VSTOR-137234
>> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
>> ---
>>   block/blk-cbt.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/blk-cbt.c b/block/blk-cbt.c
>> index 90219f58f1ae..91a888770411 100644
>> --- a/block/blk-cbt.c
>> +++ b/block/blk-cbt.c
>> @@ -1093,8 +1093,8 @@ int blk_cbt_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
>>           return -EFAULT;
>>         if (abi_version != CBT_ABI_VERSION) {
>> -        WARN_ONCE(1, "blk-cbt ABI mimatch: kernel has %d, userspace uses %d",
>> -              CBT_ABI_VERSION, abi_version);
>> +        pr_warn_ratelimited("blk-cbt: ABI mismatch: kernel has %d, userspace uses %d\n",
>> +                    CBT_ABI_VERSION, abi_version);
>>           return -EOPNOTSUPP;
>>       }
>>   
> 

-- 
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.



More information about the Devel mailing list