Re: AMD Geode NOPL emulation for kernel 2.6.36-rc2

From: Matteo Croce
Date: Sun Aug 29 2010 - 09:39:33 EST


On Sat, Aug 28, 2010 at 1:07 AM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
> On 08/27/2010 02:32 PM, Matteo Croce wrote:
>> can I ignore the return value when I expect val to be non zero?
>> the doc says: "On error, the variable @x is set to zero."
>
> No. ÂYou need to deliver a page fault to the application in this case.
>
> The *real* test for this kind of crap is correct page fault behavior,
> and so forth.
>
> Also, at the very least you need to check for:
>
> - CS == USER_CS
> - IP in the proper range for user space
>
> Your patch in its current form is one big security hole.
>
> Â Â Â Â-hpa
>
> --
> H. Peter Anvin, Intel Open Source Technology Center
> I work for Intel. ÂI don't speak on their behalf.
>
>

If the parsing fails due get_user returning error I call
`do_invalid_op(regs, error_code);`
which is the default handler, which does the page fault.
to check the CS I do `regs->cs != __USER_CS` but how to check the IP value?
convert_ip_to_linear() and then check something?

--
Matteo Croce
OpenWrt developer
 _______         Â ________    __
Â|Â Â ÂÂ |.-----.-----.-----.|Â |Â |Â |.----.|Â |_
Â|ÂÂ -ÂÂ ||Â _Â |Â -__|Â ÂÂ ||Â |Â |Â ||ÂÂ _||ÂÂ _|
Â|_______||ÂÂ __|_____|__|__||________||__|Â |____|
     |__| W I R E L E S S F R E E D O M
ÂKAMIKAZE (bleeding edge) ------------------
 * 10 oz Vodka  Â Shake well with ice and strain
 * 10 oz Triple sec mixture into 10 shot glasses.
 * 10 oz lime juice Salute!
Â---------------------------------------------------
--
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/