[Devel] [PATCH rh7] ve: Add a handle to C/R aio ctx
Kirill Tkhai
ktkhai at virtuozzo.com
Mon Feb 15 08:33:07 PST 2016
On 15.02.2016 18:55, Cyrill Gorcunov wrote:
> On Mon, Feb 15, 2016 at 06:05:40PM +0300, Kirill Tkhai wrote:
>> This adds ioctl, which allows to set ring buffer tail
>> and to wait till aio requests are finished.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ...
>> +int ve_aio_ioctl(struct task_struct *task, unsigned int cmd, unsigned long arg)
>> +{
>> + struct ve_ioc_arg karg;
>> + struct kioctx *ioctx;
>> + int ret;
>> +
>> + if (task != current)
>> + return -EINVAL;
>> +
>> + if (copy_from_user(&karg, (void *)arg, sizeof(karg)))
>> + return -EFAULT;
>> +
>> + ioctx = lookup_ioctx(karg.ctx_id);
>> + if (!ioctx)
>> + return -EINVAL;;
>> +
>
> Kirill, here is a moment I dont understand -- anyone can set aio tail?
> Should not we test for ve-is-super (pseudosuper) here?
Tail is only a position, where a result of a next completed result is put.
If userspace makes something wrong, it just (possible) rewrites results
of previous requests. Do you think it's a problem?
I'm going to execute this from parasite code. Is it possible to upgrade
dumped process permittions to do that and then return it back?
Thanks
>> + switch (cmd) {
>> + case VE_AIO_IOC_SET_TAIL:
>> + ret = ve_aio_set_tail(ioctx, karg.val);
>> + break;
>> + case VE_AIO_IOC_WAIT_ACTIVE:
>> + ret = ve_aio_wait_inflight_reqs(ioctx);
>> + break;
>> + default:
>> + ret = -EINVAL;
>> + }
>
> The rest looks good for me.
>
More information about the Devel
mailing list