Re: [PATCH v3 7/7] x86/ldt,ptrace: provide regset access to the LDT

2018-06-22 Thread Andy Lutomirski
On Fri, Jun 22, 2018 at 8:06 AM  wrote:
>
> On June 22, 2018 7:49:13 AM PDT, Andy Lutomirski  wrote:
> >On Thu, Jun 21, 2018 at 2:18 PM H. Peter Anvin, Intel
> > wrote:
> >>
> >> From: "H. Peter Anvin" 
> >>
> >> Provide ptrace/regset access to the LDT, if one exists.  This
> >> interface provides both read and write access. The write code is
> >> unified with modify_ldt(); the read code doesn't have enough
> >> similarity so it has been kept made separate.
> >
> >For this and for the GDT, you've chosen to use struct user_desc as
> >your format instead of using a native hardware descriptor format.  Any
> >particular reason why?  If nothing else, it will bloat core files a
> >bit more than needed.
>
> I did because REGSET_TLS was implemented that way, and that is simply a 
> subset of the GDT (which made the same code trivially applicable to both.) 
> modify_ldt() does it *both* ways for extra fun (one for reading, and one for 
> writing.)
>
> ->active is defined as "beyond this point the regset contains only the 
> default value", which seemed appropriate in this case.

I saw that definition too.  But I'm still very unclear as to what, if
anything, the code actually does :)

--Andy


Re: [PATCH v3 7/7] x86/ldt,ptrace: provide regset access to the LDT

2018-06-22 Thread Andy Lutomirski
On Fri, Jun 22, 2018 at 8:06 AM  wrote:
>
> On June 22, 2018 7:49:13 AM PDT, Andy Lutomirski  wrote:
> >On Thu, Jun 21, 2018 at 2:18 PM H. Peter Anvin, Intel
> > wrote:
> >>
> >> From: "H. Peter Anvin" 
> >>
> >> Provide ptrace/regset access to the LDT, if one exists.  This
> >> interface provides both read and write access. The write code is
> >> unified with modify_ldt(); the read code doesn't have enough
> >> similarity so it has been kept made separate.
> >
> >For this and for the GDT, you've chosen to use struct user_desc as
> >your format instead of using a native hardware descriptor format.  Any
> >particular reason why?  If nothing else, it will bloat core files a
> >bit more than needed.
>
> I did because REGSET_TLS was implemented that way, and that is simply a 
> subset of the GDT (which made the same code trivially applicable to both.) 
> modify_ldt() does it *both* ways for extra fun (one for reading, and one for 
> writing.)
>
> ->active is defined as "beyond this point the regset contains only the 
> default value", which seemed appropriate in this case.

I saw that definition too.  But I'm still very unclear as to what, if
anything, the code actually does :)

--Andy


Re: [PATCH v3 7/7] x86/ldt,ptrace: provide regset access to the LDT

2018-06-22 Thread hpa
On June 22, 2018 7:49:13 AM PDT, Andy Lutomirski  wrote:
>On Thu, Jun 21, 2018 at 2:18 PM H. Peter Anvin, Intel
> wrote:
>>
>> From: "H. Peter Anvin" 
>>
>> Provide ptrace/regset access to the LDT, if one exists.  This
>> interface provides both read and write access. The write code is
>> unified with modify_ldt(); the read code doesn't have enough
>> similarity so it has been kept made separate.
>
>For this and for the GDT, you've chosen to use struct user_desc as
>your format instead of using a native hardware descriptor format.  Any
>particular reason why?  If nothing else, it will bloat core files a
>bit more than needed.

I did because REGSET_TLS was implemented that way, and that is simply a subset 
of the GDT (which made the same code trivially applicable to both.) 
modify_ldt() does it *both* ways for extra fun (one for reading, and one for 
writing.)

->active is defined as "beyond this point the regset contains only the default 
value", which seemed appropriate in this case.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: [PATCH v3 7/7] x86/ldt,ptrace: provide regset access to the LDT

2018-06-22 Thread hpa
On June 22, 2018 7:49:13 AM PDT, Andy Lutomirski  wrote:
>On Thu, Jun 21, 2018 at 2:18 PM H. Peter Anvin, Intel
> wrote:
>>
>> From: "H. Peter Anvin" 
>>
>> Provide ptrace/regset access to the LDT, if one exists.  This
>> interface provides both read and write access. The write code is
>> unified with modify_ldt(); the read code doesn't have enough
>> similarity so it has been kept made separate.
>
>For this and for the GDT, you've chosen to use struct user_desc as
>your format instead of using a native hardware descriptor format.  Any
>particular reason why?  If nothing else, it will bloat core files a
>bit more than needed.

I did because REGSET_TLS was implemented that way, and that is simply a subset 
of the GDT (which made the same code trivially applicable to both.) 
modify_ldt() does it *both* ways for extra fun (one for reading, and one for 
writing.)

->active is defined as "beyond this point the regset contains only the default 
value", which seemed appropriate in this case.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: [PATCH v3 7/7] x86/ldt,ptrace: provide regset access to the LDT

2018-06-22 Thread Andy Lutomirski
On Thu, Jun 21, 2018 at 2:18 PM H. Peter Anvin, Intel
 wrote:
>
> From: "H. Peter Anvin" 
>
> Provide ptrace/regset access to the LDT, if one exists.  This
> interface provides both read and write access. The write code is
> unified with modify_ldt(); the read code doesn't have enough
> similarity so it has been kept made separate.

For this and for the GDT, you've chosen to use struct user_desc as
your format instead of using a native hardware descriptor format.  Any
particular reason why?  If nothing else, it will bloat core files a
bit more than needed.


Re: [PATCH v3 7/7] x86/ldt,ptrace: provide regset access to the LDT

2018-06-22 Thread Andy Lutomirski
On Thu, Jun 21, 2018 at 2:18 PM H. Peter Anvin, Intel
 wrote:
>
> From: "H. Peter Anvin" 
>
> Provide ptrace/regset access to the LDT, if one exists.  This
> interface provides both read and write access. The write code is
> unified with modify_ldt(); the read code doesn't have enough
> similarity so it has been kept made separate.

For this and for the GDT, you've chosen to use struct user_desc as
your format instead of using a native hardware descriptor format.  Any
particular reason why?  If nothing else, it will bloat core files a
bit more than needed.