Re: [RFC] x86: xsave/xrstor support, ucontext_t extensions
From: Suresh Siddha
Date: Thu May 22 2008 - 17:29:38 EST
On Thu, May 22, 2008 at 02:02:28PM -0700, H. Peter Anvin wrote:
> Suresh Siddha wrote:
> >
> >hpa, What is the virtualization problem? Are you referring to perf problem?
> >As you noted, regular non-rt signal handlers won't need this cpuid check.
> >It's
> >needed only for those who manually look at non-rt signal frames and
> >interpret it.
> >And also, they can do this check only once and not everytime.
> >
>
> No, relying on CPUID and vdso both have implications for virtualization.
can you please elaborate? even in presence of virtualization, appropriate
cpuid bits need to be set/visible for application, for xsave/xrstor to work
properly.
> I don't think it is ... it's not overkill but rather "underkill"... it's
> a low-performance solution but it's guaranteed to be safe in the
> presence of virtualization of all its various ilk. Note that you don't
> need to be able to *set* the format via prctl(), just *query* (get) it.
>
> Using prctl() allows us to make this personality-dependent if we ever
> need to.
>
> >While restoring from the user, kernel also need to find out what layout
> >the user is passing. So it's bi-directional. I prefer the same mechanism
> >(using cookies/magic numbers etc inaddition to uc_flags or cpuid checks) to
> >interpret the fpstate for both user/kernel.
>
> No, it really doesn't: the kernel only needs to be able to read the same
> format as it itself wrote.
But user can potentially change the _fpstate pointer in sigcontext struct.
>
> >ARM also seem to be using similar things while extending their ucontext_t,
> >with out other kernel interfaces to indicate the layout.
> >
> >BTW, how come 32bit kernel doesn't have the X86_FXSR_MAGIC checks, while
> >restoring
> >the extended fxsave data from _fpstate?
>
> Again, the kernel already knows the format, so it doesn't need to check.
What happens with some old applications which change the _fpstate
pointer. they may or may not be fxsave aware...
thanks,
suresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/