[Devel] [PATCH vz8 v2] binfmt_misc: fix mount after umount in CT

Vasily Averin vvs at virtuozzo.com
Wed Oct 20 07:44:04 MSK 2021


On 19.10.2021 22:26, Nikita Yushchenko wrote:
>>> +#ifdef CONFIG_VE
>>> +        ve->binfmt_misc = bm_data;
>>> +        /* this will be cleared by ve_destroy() */
>>> +#endif
>>> +    }
>>>
>>>       err = simple_fill_super(sb, BINFMTFS_MAGIC, bm_files);
>>> -    if (err) {
>>> -        kfree(bm_data);
>>> +    if (err)
>>>           return err;
>>> -    }
>>
>> I do not have vz8 three, so I'm sorry for dump question:
>> if we failed here, who will free bm_data and clean up ve->binfmt_misc?
> 
> Just read a comment several lines above ;)
> 
> ve->bm_data is global, not per-mount. It is created at first mount (successful or not) and cleared at VE destroy time.

:) I missed this.

However anyway, this may be tricky. In past, we had no guarantee that ve will be freed and destroyed after end of CT stop, because some long-lived objects could keep the reference to ve. This may happen during refcont leaks too.

So CT may be re-started again with old ve.
I afraid in this case old ve->binfmt_misc can be not released and can be reused.
Could you please check -- is this acceptable for binfmt_misc? 

Also please do not trust me, I may be wrong and in vz8 ve_destroy() can be 100% called on CT stop.

Thank you,
	Vasily Averin



More information about the Devel mailing list