[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100210153443.GA26654@redhat.com>
Date: Wed, 10 Feb 2010 16:34:43 +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:
>
> static inline int user_regset_copyout(unsigned int *pos, unsigned int *count,
> void **kbuf,
> void __user **ubuf, const void *data,
> const int start_pos, const int end_pos)
> {
> if (*count == 0)
> return 0;
> BUG_ON(*pos < start_pos);
> if (end_pos < 0 || *pos < end_pos) {
> unsigned int copy = (end_pos < 0 ? *count
> : min(*count, end_pos - *pos));
> data += *pos - start_pos;
> ^^^
> Is it correct? Shouldn't it be
>
> data += *pos + start_pos;
>
> ?
Ah, I seem to understand. start_pos is not the offset inside *data as
I thought. It is needed to compensate the "*pos += copy" addition which
was done by the previous user_regset_copyout().
This means that xstateregs_get() is right, it copies xstate_fx_sw_bytes
but uses sizeof(i387_fxsave_struct) as start_pos.
So tricky... I must admit, I don't understand the point.
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