[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100210154333.GB26654@redhat.com>
Date: Wed, 10 Feb 2010 16:43:33 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Suresh Siddha <suresh.b.siddha@...el.com>
Cc: Roland McGrath <roland@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>, hjl.tools@...il.com
Subject: Re: [patch v2 2/4] x86, ptrace: regset extensions to support xstate
On 02/10, Oleg Nesterov wrote:
>
> On 02/09, Suresh Siddha wrote:
> >
> > +int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
> > + unsigned int pos, unsigned int count,
> > + void *kbuf, void __user *ubuf)
> > +{
> > + int ret;
> > + int size = regset->n * regset->size;
> > + struct xsave_hdr_struct *xsave_hdr =
> > + &target->thread.xstate->xsave.xsave_hdr;
> > +
> > + if (!cpu_has_xsave)
> > + return -ENODEV;
> > +
> > + ret = init_fpu(target);
> > + if (ret)
> > + return ret;
> > +
> > + /*
> > + * First copy the fxsave bytes 0..463
> > + */
> > + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> > + &target->thread.xstate->xsave, 0,
> > + offsetof(struct i387_fxsave_struct,
> > + sw_reserved));
> > + if (!ret)
> > + /*
> > + * Copy the 48bytes defined by software
> > + */
> > + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> > + xstate_fx_sw_bytes,
> > + offsetof(struct i387_fxsave_struct,
> > + sw_reserved),
> > + offsetof(struct xsave_struct,
> > + xsave_hdr));
>
> Hmm. Suresh, could you confirm these offsetof's are correct?
>
> We are copying xstate_fx_sw_bytes array which is u64[6], but
> start_pos == sizeof(i387_fxsave_struct) - padding ?
Sorry for noise. Now I see this should be correct, see another email I sent.
In fact, unless I missed something again, the 2nd and 3rd _copyout's could
use pos as start_pos instead of offsetof(what_we_already_copied).
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists