[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHCEehK7BnWUhjOAynCLP6puRo8EguMvf=N8iG5UMQmaD8ekCQ@mail.gmail.com>
Date: Wed, 27 May 2020 14:34:05 +0800
From: Greentime Hu <greentime.hu@...ive.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Guo Ren <guoren@...ux.alibaba.com>,
Vincent Chen <vincent.chen@...ive.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmerdabbelt@...gle.com>,
linux-riscv <linux-riscv@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v4 01/13] ptrace: Use regset_size() for dynamic regset size.
Oleg Nesterov <oleg@...hat.com> 於 2020年5月26日 週二 下午10:00寫道:
>
> On 05/26, Greentime Hu wrote:
> >
> > @@ -882,13 +882,18 @@ static int ptrace_regset(struct task_struct *task, int req, unsigned int type,
> > const struct user_regset_view *view = task_user_regset_view(task);
> > const struct user_regset *regset = find_regset(view, type);
> > int regset_no;
> > + unsigned int size;
> >
> > - if (!regset || (kiov->iov_len % regset->size) != 0)
> > + if (!regset)
> > return -EINVAL;
> >
> > regset_no = regset - view->regsets;
> > - kiov->iov_len = min(kiov->iov_len,
> > - (__kernel_size_t) (regset->n * regset->size));
> > + size = regset_size(task, regset);
> > +
> > + if ((kiov->iov_len % size) != 0)
> > + return -EINVAL;
>
> Hmm. this doesn't look right.
>
> Before this patch we check "iov_len % regset->size", this is not the same
> as "iov_len % regset_size()".
>
> IOW, currently you can read/write, say, only the 1st register, you patch
> breaks this?
>
Hi Oleg,
Thank you. I misunderstood the meaning of regset->size
It seems I only needs to update this line, right?
- kiov->iov_len = min(kiov->iov_len, (__kernel_size_t) (regset->n *
regset->size));
+ kiov->iov_len = min(kiov->iov_len, (__kernel_size_t)
regset_size(task, regset));
Powered by blists - more mailing lists